intellij-idea
tags question: http://stackoverflow.com/q/24930025
tags question: http://stackoverflow.com/q/24992038
tags question: http://stackoverflow.com/q/24954229
tags question: http://stackoverflow.com/q/25043162
tags question: http://stackoverflow.com/q/25045621
tags question: http://stackoverflow.com/q/24963830
tags question: http://stackoverflow.com/q/25018356
tags question: http://stackoverflow.com/q/24964915
tags question: http://stackoverflow.com/q/25024606
type: Tag
tags question: http://stackoverflow.com/q/25026894
tags question: http://stackoverflow.com/q/24997945
tags question: http://stackoverflow.com/q/24966336
tags question: http://stackoverflow.com/q/24936619
tag name: intellij-idea
tags question: http://stackoverflow.com/q/24935084
tags question: http://stackoverflow.com/q/24937585
tags question: http://stackoverflow.com/q/24994056
tags question: http://stackoverflow.com/q/24935962
tags question: http://stackoverflow.com/q/25010812
tags question: http://stackoverflow.com/q/25013581
tags question: http://stackoverflow.com/q/25017932
tags question: http://stackoverflow.com/q/25060206
tags question: http://stackoverflow.com/q/24925175
tags question: http://stackoverflow.com/q/25016350
tags question: http://stackoverflow.com/q/25068097
tags question: http://stackoverflow.com/q/25028352
tags question: http://stackoverflow.com/q/24912541
tags question: http://stackoverflow.com/q/24921820
tags question: http://stackoverflow.com/q/25019877
tags question: http://stackoverflow.com/q/24943190
tags question: http://stackoverflow.com/q/25008160
tags question: http://stackoverflow.com/q/24965751
tags question: http://stackoverflow.com/q/24922253
tags question: http://stackoverflow.com/q/25044823

http://stackoverflow.com/q/24923755
has body: I am trying to access a soap based webservice . The webservice seems to be updated to jax-ws implementaion from jax-rpc and i am getting the following error from code StepException[message=HTTPS transfer failed while trying to send filename=d:/software/file.xml Cause: HTTP/1.1 415 Unsupported Media Type ] While through SoapUI the webservice works fine. Following is the response header HTTP/1.1 200 OK Date: Thu, 24 Jul 2014 01:16:16 GMT Content-Type: text/xml; charset=utf-8 Accept: text/xml, text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2 Client code is using Content Type: application/soap+xml could this be the reason for the above issue?
type: Question
downvote count: 0
has title: HTTP/1.1 415 Unsupported Media Type - SOAP Webservice
favorite count: 0
answer count: 0
type: UnansweredQuestion
tagged with: soap
upvote count: 1
tagged with: web-services
score: 1
tagged with: java
tagged with: jax-ws

http://stackoverflow.com/q/24990996
has body: I want to enforce certain dependency rules in our code base: e.g. package A should not depend on package B, no circular dependencies etc. And I think the only way that is able to enforce them are (failing) tests, not reports. So I looked around and found JDepend, Classycle and JBoss TattleTale - all appear to be discontinued and lacking Java 8 support. That's when I discovered FindBugs. So I want to use FindBugs to analyze our package structure and use JUnit to validate certain rules about their relations. But since the FindBugs source code is huge, I'm wondering: How do I achieve this? Regards, Stephan
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/58667799
has answer: http://stackoverflow.com/a/24991843
tagged with: circular-dependency
upvote count: 1
type: Question
tagged with: java
has title: FindBugs: Unit test package dependency rules?
answer count: 2
tagged with: junit
downvote count: 0
score: 1
tagged with: findbugs
favorite count: 0

http://stackoverflow.com/comment/38835792
has text: Emphasizing (or somehow "justifying") the comment by johnchen902: You should also think about whether the `Player` class should have a `getCircle()` method at all. Maybe, later there will be a `Rectangle` stored in the `Player`. Then, `getX()` may still make sense, whereas `getCircle()` will not.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24981357

http://stackoverflow.com/q/25005274
type: UnansweredQuestion
tagged with: maven
upvote count: 4
has answer: http://stackoverflow.com/a/28652840
tagged with: sbt
downvote count: 0
tagged with: java
tagged with: ivy
type: Question
tagged with: playframework
score: 4
has body: I downloaded the offline distribution - version 2.3.2 - of Play Framework, where I see it includes a repository with a bunch of libraries. When, though, I create a new project, it starts downloading all these libraries again. What's the point in doing that? Is there a way I can define the repository I already have - the one I downloaded with the offline distro? Or, at least, can I define a different directory when it starts downloading all these libraries? I don't want them in C: drive.
answer count: 1
favorite count: 0
has title: Play framework offline distribution downloads repositories

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

http://stackoverflow.com/a/25151745
upvote count: 1
score: 1
accepted answer of: http://stackoverflow.com/q/25019324
has comment: http://stackoverflow.com/comment/59939864
answers question: http://stackoverflow.com/q/25019324
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/39163365
type: Answer
has body: Getting client-server stuff working reliably can be quite challenging. especially cross-platform; there always seems to be one more edge-case that needs to be resolved. Rather than rebuilding the wheel, I recommend using an existing library where someone else has already worked out all the kinks. I haven't used it for anything beyond a prototype yet, but the AllJoyn open-source project looks very promising. Another option is the Google Nearby APIs, which at the moment are only for Android and iOS.
has comment: http://stackoverflow.com/comment/59956411

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

http://stackoverflow.com/comment/38889619
type: AnswerComment
type: Comment
has text: Hey sorry, that was a copy&paste issue. In my actual Hey sorry, that was a copy&paste issue. In ms actual route from is set correctly! I changes the snippet accordinglyroute from is set correctly! I changes the snippet accordingly
comment on: http://stackoverflow.com/a/25009663
score: 0

http://stackoverflow.com/comment/38894435
comment on: http://stackoverflow.com/q/25012221
score: 0
type: Comment
type: QuestionComment
has text: @khakiout It does! It compiles perfectly fine and prints 100! ;)

char
tags question: http://stackoverflow.com/q/25055659
tags question: http://stackoverflow.com/q/25039827
tags question: http://stackoverflow.com/q/24952298
type: Tag
tags question: http://stackoverflow.com/q/25036297
tags question: http://stackoverflow.com/q/24977783
tag name: char
tags question: http://stackoverflow.com/q/25068852
tags question: http://stackoverflow.com/q/24939425

http://stackoverflow.com/a/25027913
has body: Check what is returned from your service, it is probably a Persons object containing a list of Person rather than just a list of person. In that case, isArray should be false in your Service javascript.
has comment: http://stackoverflow.com/comment/38923628
has comment: http://stackoverflow.com/comment/38923559
has comment: http://stackoverflow.com/comment/38923400
has comment: http://stackoverflow.com/comment/38923455
answers question: http://stackoverflow.com/q/25027785
score: 0
type: Answer

http://stackoverflow.com/comment/38890574
score: 0
comment on: http://stackoverflow.com/q/25010763
has text: try typing `this.someField` and see if it works, and also I think you need to initialize it with a constructor maybe.
type: QuestionComment
type: Comment

http://stackoverflow.com/q/24983655
has comment: http://stackoverflow.com/comment/38840382
favorite count: 0
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/24988662
downvote count: 0
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/24988662
type: Question
tagged with: simpledateformat
has title: Converting minutes since midnight to 24-hour time
has answer: http://stackoverflow.com/a/24983695
has body: I have minutes since midnight. Eg 3Am is represented as = 180 (found using 3*60) Now I need to convert it into 24 hour time format HH24 :mm = 03:00 How can we use simple date formatter/calender for this?
accepted answer: http://stackoverflow.com/a/24983695
answer count: 2
upvote count: 1

http://stackoverflow.com/comment/38909030
type: Comment
type: QuestionComment
score: 0
has text: Can you show the structure of your jar file?
comment on: http://stackoverflow.com/q/25020426

http://stackoverflow.com/comment/38828788
type: AnswerComment
score: 0
type: Comment
has text: @Sotirious : I added in Project properties->Java Build Path-> Libraries. All jars are present there.
comment on: http://stackoverflow.com/a/24977835

java
tags question: http://stackoverflow.com/q/25041700
tags question: http://stackoverflow.com/q/25029228
tags question: http://stackoverflow.com/q/24974388
tags question: http://stackoverflow.com/q/25059031
tags question: http://stackoverflow.com/q/25042776
tags question: http://stackoverflow.com/q/25011968
tags question: http://stackoverflow.com/q/24976657
tags question: http://stackoverflow.com/q/24950070
tags question: http://stackoverflow.com/q/25023909
tags question: http://stackoverflow.com/q/24981186
tags question: http://stackoverflow.com/q/25053057
tags question: http://stackoverflow.com/q/25004320
tags question: http://stackoverflow.com/q/25050544
tags question: http://stackoverflow.com/q/25032577
tags question: http://stackoverflow.com/q/24988232
tags question: http://stackoverflow.com/q/24983925
tags question: http://stackoverflow.com/q/24962763
tags question: http://stackoverflow.com/q/24984406
tags question: http://stackoverflow.com/q/24986341
tags question: http://stackoverflow.com/q/24940092
tags question: http://stackoverflow.com/q/25022182
tags question: http://stackoverflow.com/q/25058903
tags question: http://stackoverflow.com/q/25027184
tags question: http://stackoverflow.com/q/24948651
tags question: http://stackoverflow.com/q/25014814
tags question: http://stackoverflow.com/q/25001020
tags question: http://stackoverflow.com/q/25045237
tags question: http://stackoverflow.com/q/24916639
tags question: http://stackoverflow.com/q/25052628
tags question: http://stackoverflow.com/q/24929806
tags question: http://stackoverflow.com/q/25039608
tags question: http://stackoverflow.com/q/24981640
tags question: http://stackoverflow.com/q/24960408
tags question: http://stackoverflow.com/q/25060976
tags question: http://stackoverflow.com/q/25015629
tags question: http://stackoverflow.com/q/24922396
tags question: http://stackoverflow.com/q/24965901
tags question: http://stackoverflow.com/q/24928154
tags question: http://stackoverflow.com/q/25009445
tags question: http://stackoverflow.com/q/25041000
tags question: http://stackoverflow.com/q/24953290
tags question: http://stackoverflow.com/q/24983655
tags question: http://stackoverflow.com/q/24962150
tags question: http://stackoverflow.com/q/25061456
tags question: http://stackoverflow.com/q/25027467
tags question: http://stackoverflow.com/q/25019784
tags question: http://stackoverflow.com/q/25031445
tags question: http://stackoverflow.com/q/24986101
tags question: http://stackoverflow.com/q/24929575
tags question: http://stackoverflow.com/q/24938197
tags question: http://stackoverflow.com/q/24936566
tags question: http://stackoverflow.com/q/24978231
tags question: http://stackoverflow.com/q/25054903
tags question: http://stackoverflow.com/q/25040827
tags question: http://stackoverflow.com/q/24933564
tags question: http://stackoverflow.com/q/25000695
tags question: http://stackoverflow.com/q/24999850
tags question: http://stackoverflow.com/q/24940165
tags question: http://stackoverflow.com/q/25061923
tags question: http://stackoverflow.com/q/25031405
tags question: http://stackoverflow.com/q/25028511
tags question: http://stackoverflow.com/q/25061237
tags question: http://stackoverflow.com/q/24977748
tags question: http://stackoverflow.com/q/24963587
tags question: http://stackoverflow.com/q/25064019
tags question: http://stackoverflow.com/q/25010843
tags question: http://stackoverflow.com/q/25058100
tags question: http://stackoverflow.com/q/24950613
tags question: http://stackoverflow.com/q/24924632
tags question: http://stackoverflow.com/q/25003013
tags question: http://stackoverflow.com/q/25028145
tags question: http://stackoverflow.com/q/25037244
tags question: http://stackoverflow.com/q/24910757
tags question: http://stackoverflow.com/q/25069122
tags question: http://stackoverflow.com/q/24992863
tags question: http://stackoverflow.com/q/25003553
tags question: http://stackoverflow.com/q/24947561
tags question: http://stackoverflow.com/q/25014416
tags question: http://stackoverflow.com/q/24991957
tags question: http://stackoverflow.com/q/24985594

http://stackoverflow.com/comment/38808800
type: Comment
has text: @Mike, It removes **all** non alphanumeric + non whitespace from the beginning and the end of the string. (I used `+`). If you want to remove only `one`, remove `+`.
comment on: http://stackoverflow.com/a/24967120
score: 0
type: AnswerComment

http://stackoverflow.com/a/24943341
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/24943239
has body: It's a consistency matter. Empty patterns are like empty strings, and if you try System.out.println( "abc".indexOf("") ); you'll see that this is found at offset 0. Clearly there is a substring of length 0 to be found at many places within a string of length > 0, and even in a string of length 0!
downvote count: 0

http://stackoverflow.com/comment/38714606
comment on: http://stackoverflow.com/q/24916549
type: QuestionComment
has text: What I mean is Ctrl -c , did you see shutdown message?
score: 0
type: Comment

http://stackoverflow.com/q/24943239
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/24943340
accepted answer: http://stackoverflow.com/a/24943340
has title: Matcher lookingAt method matching empty String
has answer: http://stackoverflow.com/a/24943341
has body: I'm using a Matcher instance to match patterns at the start of some input using the lookingAt() method. lookingAt() is however returning true when I create a Pattern from an empty String and try to match it with a non-empty (trimmed) String. Firstly, this is as I expect it: String field = "Dave went to Alabama" String escapedQuery = Pattern.quote("Dave went"); Pattern pattern = Pattern.compile(escapedQuery, Pattern.CASE_INSENSITIVE); Matcher matcher = pattern.matcher(field); // matcher.lookingAt() == true However, this pattern generated from an empty String also returns true: String escapedQuery = Pattern.quote(""); Pattern pattern = Pattern.compile(escapedQuery, Pattern.CASE_INSENSITIVE); Matcher matcher = pattern.matcher(field); //matcher.lookingAt() == true All Strings involved have been trimmed before any Patterns are compiled. Can anyone point me as to what I'm missing here? Many thanks.
tagged with: regex
type: AnsweredQuestion
type: Question
tagged with: java
possible better answer: http://stackoverflow.com/a/24943341

http://stackoverflow.com/a/36081565
downvote count: 0
type: Answer
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/25055988
has body: Please read the following article about how to terminate a context correctly: http://zeromq.org/whitepapers:0mq-termination This is only to exclude a fault on your side. Looking at the jeromq source code the current version (0.3.6-SNAPSHOT) is failing its own unit tests regarding the creation and tear down of sockets. You may try a previous version (0.3.4 seems to not have the same issues) or change to jzmq, which is only a wrapper around the stable ZeroMQ library.

http://stackoverflow.com/a/24931352
accepted answer of: http://stackoverflow.com/q/24931211
has comment: http://stackoverflow.com/comment/38743140
has comment: http://stackoverflow.com/comment/38742276
type: Answer
has comment: http://stackoverflow.com/comment/38742567
score: 1
upvote count: 1
has body: .NET 2.0 also supported anonymous delegates, it's just that the syntax was a bit more verbose compared to lambdas, and type inference didn't work. And there were no extension methods in C# 2.0 (although you were able to use C# 3.0 and compile against .NET 2.0), which are the basis of LINQ and being able to operate on interfaces. Compare: .NET 2.0: delegate(int i) { return (i &lt; 5); } .NET 3.5: i =&gt; i &lt; 5 .NET 2.0 also lacks common generic delegate signatures (Func and Action), but you can also easily define them yourself (for all combinations of parameters you like): public delegate void Action&lt;T&gt;(T item); public delegate Tresult Func&lt;T, Tresult&gt;(T item); So, whatever approach your linked answer used to mimic anonymous interfaces can be represented using .NET 2.0 delegates, at the expense of added verbosity. Making you ask yourself: "is this really that shorter to write?" [Update] If your interface is a single method interface, like: interface IFoo { string Bar(int value); } class SomeOtherClass { void DoSomething(IFoo foo); } then you might get rid of it entirely and simply use a delegate instead: class SomeOtherClass { void DoSomething(Func&lt;int, string&gt; bar); } new SomeOtherClass().DoSomething(delegate(int i) { return i.ToString(); }); If you have an interface with many methods that you want to be able to implement inline in many different places, you can use something like this: interface IFoo { string GetSomething(); void DoSomething(int value); } // conditional compile, only if .NET 2.0 #if NET_2_0 public delegate void Action&lt;T&gt;(T item); public delegate Tresult Func&lt;Tresult&gt;(); #endif class DelegatedFoo : IFoo { private readonly Func&lt;string&gt; _get; private readonly Action&lt;int&gt; _do; public DelegatedFoo(Func&lt;string&gt; getStuff, Action&lt;int&gt; doStuff) { _get = getStuff; _do = doStuff; } #region IFoo members simply invoke private delegates public string GetSomething() { return _get(); } public void DoSomethin…
has comment: http://stackoverflow.com/comment/38743554
answers question: http://stackoverflow.com/q/24931211
has comment: http://stackoverflow.com/comment/38741206
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38742855
downvote count: 0

http://stackoverflow.com/comment/38916401
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25018701
has text: Yes - the spacer is the amount to widen (or shorten) the gap between tabs. The indent is the offset for the first tab.
score: 0

http://stackoverflow.com/a/39560746
downvote count: 0
answers question: http://stackoverflow.com/q/25035079
type: Answer
upvote count: 2
score: 2
has body: If the Avaya IVR in question is the experience portal suite, interaction with the IVR is based on VXML and CCXML. Avaya provides the Orchestration Designer (OD) IDE (which is basically a set op Eclipse plugins), with a Java framework (called SCE, for Service Creation Environment) used for developing and interacting with the IVR applications. The IVR applications developed using OD are installed as servlets on application servers like Tomcat. The application then "outputs" the VXML which are interpreted by the IVR system and rendered into voice, and accepts the feedback from the telephony system and feeds it as input into the IVR application. Since the application is written in Java, you can do practically anything you want using Java. A typical workflow would be something like this: Call comes into the IVR system The IVR requests the start page of the IVR application The IVR application is typically a Java servlet, doing some processing depending on the input parameters, and generates a VXML page The IVR system renders this VXML into what the caller hears. The caller makes some input (account nr for example) The IVR Application (servlet on Tomcat), takes the callers response as input. The Avaya Orchestration Designer Java framework provides you with all the classes required to extract the input from the caller. The IVR Application can now verify the response received from the caller against backend systems. Depending on the results, a new VXML page is generated. It is important to note that the IVR system is just a "renderer". The IVR scripting is not done in the IVR system. The IVR "Application" performs this functionality. You can, in the one way or the other, compare it to a web browser requesting a page, and then renders the HTML into a nicely formatted web page. You do not need to make use of Orchestration Designer specifically, but that is the official environment supported by Avaya. The VXML can be crafted by hand (or any other framework) and might work just …

http://stackoverflow.com/a/24979118
downvote count: 0
upvote count: 1
type: Answer
has body: This one works somehow String s="*he**llo*";//anything boolean st=(s.startsWith("*")); boolean et=(s.endsWith("*")); String ns=s.replaceAll("\\*+",""); ns=(st)?("*"+ns):(et)?(ns+"*"):ns;
score: 1
answers question: http://stackoverflow.com/q/24979066

http://stackoverflow.com/comment/38889682
comment on: http://stackoverflow.com/a/25000860
has text: Thanks for guiding me to the Solution, refer to the "Solution Paragraph" for my implementation.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/38720106
type: QuestionComment
comment on: http://stackoverflow.com/q/24916818
score: 0
has text: @KieranHughes If you want `getMaxValueName` to return the "name" or ID number of the salesperson with the highest value, you'll have to fix it. Right now, you set `maxValueName = array[i]` which means `maxValueName` will be holding the highest value (calling it a `Name` doesn't magically make the compiler find the name). So if you want it to be a name instead of a value, how would you change the method?
type: Comment

http://stackoverflow.com/comment/38742834
has text: What I need currently is a dirty ugly hack, this is what I'm asking for :)
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24932256

jfreechart
type: Tag
tags question: http://stackoverflow.com/q/25038424
tags question: http://stackoverflow.com/q/24994704
tag name: jfreechart
tags question: http://stackoverflow.com/q/24961466
tags question: http://stackoverflow.com/q/24982920

http://stackoverflow.com/comment/38894337
score: 1
comment on: http://stackoverflow.com/a/25012442
type: AnswerComment
has text: Well, so **you don't need what you asked**. You asked for PARSING XML FILES (`and parse it with an XML Reader`). While you just need to use the `String myString = getResources().getString(R.string.url);` syntax. NO XML PARSING.
type: Comment

http://stackoverflow.com/q/25043691
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/25043988
accepted answer: http://stackoverflow.com/a/25043988
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
has body: For example, I have two build.xml: build.xml and subbuild.xml. In the build.xml, it will use an ant task to call and run the subbuild.xml like this: &lt;target name="antCall1" &gt; &lt;ant antfile="${basedir}/cache/subBuildTarget/subbuild.xml" /&gt; &lt;/target&gt; My question is like this: I have an "test.xml" next to the build.xml. How can I modified the codes above so that I can pass the "test.xml" into the subbuild.xml and do some operations in the subbuild.xml? Actually, I want to pass the "test.xml" as a of a task in subbuild.xml. I am just confused about how to let the subbuild.xml get accessed to the "test.xml" in the build.xml. Thanks!
tagged with: java
has title: pass an file into antfile when using ANT task
type: Question
tagged with: ant

http://stackoverflow.com/q/24960959
has comment: http://stackoverflow.com/comment/41178897
has answer: http://stackoverflow.com/a/24961422
has title: Java Play: bindFromRequest() not working
tagged with: http-post
tagged with: playframework
tagged with: http://stackoverflow.com/tag/html
has answer: http://stackoverflow.com/a/26297425
answer count: 7
has body: I'm experimenting with Java Play and I've hit an immediate roadblock. The situation is quite straightforward and the setup, simple. I have a model class called Person that is very simple and looks like this; package models.models; import play.db.ebean.Model; import javax.persistence.Entity; import javax.persistence.Id; /** * Created by asheshambasta on 25/07/14. */ @Entity public class Person extends Model { @Id public Integer id; public String name; } And I have a route defined as; POST /person controllers.Application.addPerson() Next, I have an action addPerson inside controllers.Application, which is public static Result addPerson() { Person person = form(Person.class).bindFromRequest().get(); person.save(); Logger.debug(person.toString()); Logger.debug(form().get("name")); return redirect(controllers.routes.Application.index()); } And the index.scala.html looks like: @(message: String) @main("Welcome to Play") { Add person } I've also checked my browser debug tools and I see the name form element correctly being posted to the server. What happens is weird: none of the form parameters seem to be visible in the action. As you can see, I have two Logger.debug's, each of which show me a null for the name property in the person object, as well as when attempted to be retrieved using form.get("name"). I've tried what I could see is the best way to go about this problem but I've not really seen much about this issue online. And this seems too basic to be an issue with the Play framework. What am I doing wrong here? As a note, I'm on a Mac, and I'm using mySQL to store data.
has comment: http://stackoverflow.com/comment/41179408
favorite count: 0
has comment: http://stackoverflow.com/comment/38797414
has answer: http://stackoverflow.com/a/24972590
accepted answer: http://stackoverflow.com/a/26297425
tagged with: scala
has answer: http://stackoverflow.com/a/25014273
possible better answer: http://stackoverflow.com/a/24972590
has answer: http://stackoverflow.com/a/27469306
type: AnsweredQuestion
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/29000340
upvote count: 1
tagged with: forms
has answer: http://stackoverflow.com/a/37994312
type: Question
downvote count: 0

http://stackoverflow.com/comment/38940652
type: Comment
comment on: http://stackoverflow.com/a/24996573
score: 0
type: AnswerComment
has text: Thanks Lune but I has to integrate this with IBM websphere Lombardi Version 7.2 workflow tool.I has to use XSL only so I cant use this code.

http://stackoverflow.com/a/77247516
downvote count: 0
upvote count: 1
type: Answer
has body: For anyone calling their Spring Backend from a ReactJS/Javascript frontend , you can add header.append('Content-Type', 'application/json'); on your header. Basically, you do this: const header = new Headers(); header.append('Content-Type', 'application/JSON);
score: 1
answers question: http://stackoverflow.com/q/24972437

http://stackoverflow.com/comment/38884669
comment on: http://stackoverflow.com/q/25007427
type: Comment
type: QuestionComment
score: 2
has text: the following paper outlines some techniques in the Latte jit compiler but is from 2000: http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.31.9511

http://stackoverflow.com/a/25032947
has body: One of the options is to use @XmlElementRef annotation. Excerpt from javadoc: This annotation dynamically associates an XML element name with the JavaBean property. When a JavaBean property is annotated with XmlElement, the XML element name is statically derived from the JavaBean property name. However, when this annotation is used, the XML element name is derived from the instance of the type of the JavaBean property at runtime. So, you can do something like this: @XmlRootElement class Container { //... //without XmlElementWrapper &lt;shapes&gt; element will be omitted @XmlElementWrapper(name="shapes") @XmlElementRef public List&lt;Shape&gt; getShape() { //your logic here } } Check out the constraints in javadoc. You might need to annotate Shape, Circle and Square with @XmlRootElement for this to work: @XmlRootElement class Circle { //no-arg constructor Circle() { } }
has comment: http://stackoverflow.com/comment/38932784
type: Answer
accepted answer of: http://stackoverflow.com/q/25032186
score: 1
has comment: http://stackoverflow.com/comment/38932686
upvote count: 1
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/25032186

http://stackoverflow.com/comment/38876701
type: Comment
score: 0
comment on: http://stackoverflow.com/q/25003208
has text: Also the answer marked as duplicate shows that there are VM optimizations and diminish the memory impact of enums, although I didn't dig it deeply to compare the benchmarks
type: QuestionComment

http://stackoverflow.com/q/25046374
favorite count: 0
has comment: http://stackoverflow.com/comment/38961724
has comment: http://stackoverflow.com/comment/38958457
has comment: http://stackoverflow.com/comment/38958543
linked to: http://stackoverflow.com/q/25025279
tagged with: android
has answer: http://stackoverflow.com/a/25050954
has comment: http://stackoverflow.com/comment/38983103
has comment: http://stackoverflow.com/comment/38958183
has comment: http://stackoverflow.com/comment/38971660
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38986532
tagged with: java
has comment: http://stackoverflow.com/comment/38958625
upvote count: 1
has comment: http://stackoverflow.com/comment/38958340
tagged with: html-parsing
downvote count: 1
type: Question
has body: I am getting a NullPointerException while using Jsoup to parse a website. The actual webpage which is parsed changes depending on user input. Essentially, sometimes there are images on the webpage and sometimes there are not. Document doc = Jsoup.connect("http://www.forbes.com/colleges/"+college+"/").get(); Elements photos = doc.select("div[id=photos]"); if(photos!=null){ imgSrc1 = photos.select("li").select("img").first().attr("src"); input1 = new java.net.URL(imgSrc1).openStream(); bitmap1 = BitmapFactory.decodeStream(input1); image1.setImageBitmap(bitmap1); }else{ buffer.append("No Pictures"); } As of now, for the webpages which do have images, they show up properly. For those that do not have images, I get a NPE thrown. I tried preventing it by checking whether the id "photos" is present or not, but I am still getting the error. Logcat: 07-30 16:24:43.497: E/AndroidRuntime(30847): FATAL EXCEPTION: main 07-30 16:24:43.497: E/AndroidRuntime(30847): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.collegeselector/com.collegeselector.CollegeInfo}: java.lang.NullPointerException 07-30 16:24:43.497: E/AndroidRuntime(30847): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2180) 07-30 16:24:43.497: E/AndroidRuntime(30847): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230) 07-30 16:24:43.497: E/AndroidRuntime(30847): at android.app.ActivityThread.access$600(ActivityThread.java:141) 07-30 16:24:43.497: E/AndroidRuntime(30847): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234) 07-30 16:24:43.497: E/AndroidRuntime(30847): at android.os.Handler.dispatchMessage(Handler.java:99) 07-30 16:24:43.497: E/AndroidRuntime(30847): at android.os.Looper.loop(Looper.java:137) 07-30 16:24:43.497: E/AndroidRuntime(30847): at android.app.ActivityThread.main(ActivityThread.java:5039) 07-30 16:24:43.497: E/AndroidRuntime(30847): at java.lang.reflect.Method.invokeNative(Native Method) 07-30 16:24:43.…
tagged with: jsoup
has comment: http://stackoverflow.com/comment/38959121
accepted answer: http://stackoverflow.com/a/25050954
has comment: http://stackoverflow.com/comment/38958592
has title: NullPointerException Parsing Jsoup
has comment: http://stackoverflow.com/comment/38961685
score: 0
tagged with: nullpointerexception
answer count: 1
has comment: http://stackoverflow.com/comment/38958776

http://stackoverflow.com/comment/38730248
has text: @user3771102: You will create an `ActionListener` as shown in this [example](http://stackoverflow.com/a/9824555/1057230), and inside the `actionPerformed(...)`, simply write the four lines provided in the answer from __camickr__. And then replace all `button.addActionListener(new ActionListener()...)` with `button.addActionListener(updateListener)`. That is it.
comment on: http://stackoverflow.com/a/24916211
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/tag/json
tags question: http://stackoverflow.com/q/24943084
tags question: http://stackoverflow.com/q/24954124
tags question: http://stackoverflow.com/q/25046843
tags question: http://stackoverflow.com/q/24982424
tags question: http://stackoverflow.com/q/24929575
tags question: http://stackoverflow.com/q/25065745
tags question: http://stackoverflow.com/q/25029040
tags question: http://stackoverflow.com/q/25062298
tags question: http://stackoverflow.com/q/25058130
tags question: http://stackoverflow.com/q/25014340
tags question: http://stackoverflow.com/q/24912992
tags question: http://stackoverflow.com/q/25033473
tags question: http://stackoverflow.com/q/24935437
tags question: http://stackoverflow.com/q/25042177
tags question: http://stackoverflow.com/q/25016526
tags question: http://stackoverflow.com/q/24909809
tags question: http://stackoverflow.com/q/25005481
tags question: http://stackoverflow.com/q/24980476
tags question: http://stackoverflow.com/q/24978388
tags question: http://stackoverflow.com/q/24968893
tags question: http://stackoverflow.com/q/25013255
tags question: http://stackoverflow.com/q/24989312
tags question: http://stackoverflow.com/q/25050107
tags question: http://stackoverflow.com/q/25064773
tags question: http://stackoverflow.com/q/24910193
tags question: http://stackoverflow.com/q/24990853
tags question: http://stackoverflow.com/q/24993357
tags question: http://stackoverflow.com/q/24917509
tags question: http://stackoverflow.com/q/25007124
tags question: http://stackoverflow.com/q/24936778
tags question: http://stackoverflow.com/q/24991730
type: Tag
tags question: http://stackoverflow.com/q/24910224
tags question: http://stackoverflow.com/q/24991437
tags question: http://stackoverflow.com/q/24972589
tags question: http://stackoverflow.com/q/25062898
tags question: http://stackoverflow.com/q/25039844
tags question: http://stackoverflow.com/q/24923418
tags question: http://stackoverflow.com/q/25013359
tags question: http://stackoverflow.com/q/24936636
tags question: http://stackoverflow.com/q/24959167
tags question: http://stackoverflow.com/q/25021376
tags question: http://stackoverflow.com/q/24956396
tags question: http://stackoverflow.com/q/24959766
tags question: http://stackoverflow.com/q/25001462
tags question: http://stackoverflow.com/q/25068699
tags question: http://stackoverflow.com/q/24926786
tags question: http://stackoverflow.com/q/25030278
tags question: http://stackoverflow.com/q/25002558
tags question: http://stackoverflow.com/q/24992471
tags question: http://stackoverflow.com/q/25006431
tags question: http://stackoverflow.com/q/24957261
tags question: http://stackoverflow.com/q/24939724
tags question: http://stackoverflow.com/q/25009966
tags question: http://stackoverflow.com/q/25066237
tags question: http://stackoverflow.com/q/24948152
tags question: http://stackoverflow.com/q/24926739
tags question: http://stackoverflow.com/q/24932383
tags question: http://stackoverflow.com/q/24983024
tags question: http://stackoverflow.com/q/24957920
tags question: http://stackoverflow.com/q/24913696
tags question: http://stackoverflow.com/q/24950315
tags question: http://stackoverflow.com/q/24982754
tags question: http://stackoverflow.com/q/24932907
tags question: http://stackoverflow.com/q/24950411
tags question: http://stackoverflow.com/q/24976181
tags question: http://stackoverflow.com/q/25024999
tag name: json
tags question: http://stackoverflow.com/q/24924955
tags question: http://stackoverflow.com/q/24952582
tags question: http://stackoverflow.com/q/24966519
tags question: http://stackoverflow.com/q/24916213
tags question: http://stackoverflow.com/q/24946034
tags question: http://stackoverflow.com/q/24957391
tags question: http://stackoverflow.com/q/24932080
tags question: http://stackoverflow.com/q/25021203
tags question: http://stackoverflow.com/q/25024632
tags question: http://stackoverflow.com/q/25061895
tags question: http://stackoverflow.com/q/24937319
tags question: http://stackoverflow.com/q/25052046

http://stackoverflow.com/a/25019282
type: AcceptedAnswer
downvote count: 0
score: 1
has body: You'll want to use a tLoop component set to use a for loop to loop through all the possible pages. So you'd want to connect the tLoop in between your tFlowToIterate component and then concatenate the loop iteration variable into your URL with something like: "http://www.absolventa.de/stellenangebote?page=" + ((Integer)globalMap.get("tLoop_1_CURRENT_ITERATION")) + "&amp;query%5Bcity%5D=&amp;query%5Bradius%5D=100&amp;query%5Btext%5D=SAP&amp;utf8=%E2%9C%93" I'm not sure how you could make it end when the page would return nothing (you'd need a while loop that's condition could be set post the loop in processing) but if you just set your output file to append then if nothing is returned then it won't add anything to the file. You'd still have the problem that you'd need to set the amount of loops in your tLoop component to be high enough to cover any possible occurrence but then this would be making lots of pointless requests to fetch those empty pages. You can maybe rework it into a while loop with some extra effort but I don't have much experience in this.
type: Answer
has comment: http://stackoverflow.com/comment/38936125
accepted answer of: http://stackoverflow.com/q/25018691
upvote count: 1
answers question: http://stackoverflow.com/q/25018691
has comment: http://stackoverflow.com/comment/38933915
has comment: http://stackoverflow.com/comment/38931964

http://stackoverflow.com/q/24917314
favorite count: 0
upvote count: 2
type: UnansweredQuestion
score: 2
tagged with: java
has answer: http://stackoverflow.com/a/24917361
has title: Udacity Sunshine app - lesson 1 - NullPointerException when trying to display mock ListView
has answer: http://stackoverflow.com/a/29114069
has comment: http://stackoverflow.com/comment/45184086
type: Question
has body: I'm going through the Android dev training at udacity.com, following along with the implementation of the Sunshine app. I'm using Android Studio, latest version default installation. I'm at the point where I'm supposed to have a ListView with the mock data, and I'm getting a NullPointerException: 07-23 13:12:51.371 1677-1677/com.mydomain.sunshine E/AndroidRuntime﹕ FATAL EXCEPTION: main Process: com.mydomain.sunshine, PID: 1677 java.lang.NullPointerException at android.widget.ArrayAdapter.createViewFromResource(ArrayAdapter.java:392) at android.widget.ArrayAdapter.getView(ArrayAdapter.java:362) at android.widget.AbsListView.obtainView(AbsListView.java:2263) at android.widget.ListView.measureHeightOfChildren(ListView.java:1263) at android.widget.ListView.onMeasure(ListView.java:1175) at android.view.View.measure(View.java:16497) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5125) at android.widget.FrameLayout.onMeasure(FrameLayout.java:310) at android.view.View.measure(View.java:16497) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5125) at android.widget.FrameLayout.onMeasure(FrameLayout.java:310) at android.view.View.measure(View.java:16497) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5125) at android.widget.FrameLayout.onMeasure(FrameLayout.java:310) at android.view.View.measure(View.java:16497) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5125) at com.android.internal.widget.ActionBarOverlayLayout.onMeasure(ActionBarOverlayLayout.java:327) at android.view.View.measure(View.java:16497) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5125) at android.widget.FrameLayout.onMeasure(FrameLayout.java:310) at com.android.internal.policy.impl.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2291) at android.view.View.measure(View.java:16497) at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:1916) at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1113) at…
downvote count: 0
answer count: 2
tagged with: nullpointerexception
tagged with: android

http://stackoverflow.com/q/24985945
tagged with: java
has title: How do I set background color in libgdx?
type: Question
tagged with: libgdx
score: 10
has body: I am trying to make the background a sky blue color with RGB of 135,206,235. When I run it, the background is not the color I expected. public void render () { Gdx.gl.glClearColor(.135f, .206f, .235f, 1); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); batch.begin(); batch.draw(img, 0, 0); batch.end(); }
has answer: http://stackoverflow.com/a/24986006
answer count: 1
favorite count: 0
tagged with: colors
type: UnansweredQuestion
upvote count: 10
downvote count: 0
has comment: http://stackoverflow.com/comment/38843939

http://stackoverflow.com/comment/91483843
type: AnswerComment
type: Comment
has text: @parsecer The compiler doesn't know what exact instance an object is, it only knows what type the variable declares, that's why casting is sometimes necessary. The OP's example compiles, but throws an exception at runtime. Also, yes `A returnA() { return new B();}` and then `(B) returnA();` works fine, just as in your String/Object example
comment on: http://stackoverflow.com/a/24957686
score: 0

bufferedimage
tags question: http://stackoverflow.com/q/25020064
tags question: http://stackoverflow.com/q/25002579
tags question: http://stackoverflow.com/q/24918942
tag name: bufferedimage
tags question: http://stackoverflow.com/q/25029189
tags question: http://stackoverflow.com/q/25007475
tags question: http://stackoverflow.com/q/25018884
tags question: http://stackoverflow.com/q/25007057
type: Tag

http://stackoverflow.com/comment/60072580
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25047753
has text: Is there a way to use $regex here ? Because I couldn't make it work
type: Comment

http://stackoverflow.com/comment/121476053
comment on: http://stackoverflow.com/a/24952058
has text: with all due respect, please refer the OP, it didnt ask for most optimum way to do it, but the way in which null is handled automatically. Please take things in context. By your reasoning I suppose you are advocating not to use Optional? PS: The accepted answer is the best fit.
type: Comment
type: AnswerComment
score: 0

http://stackoverflow.com/q/24924143
type: Question
accepted answer: http://stackoverflow.com/a/24924290
answer count: 2
favorite count: 0
has comment: http://stackoverflow.com/comment/38727875
has comment: http://stackoverflow.com/comment/38731682
has body: So I've been looking through and experimenting some stuff but can't quite get how to remove pre-existing spriteBatch on screen. so basically I have initiated batcher.begin(); (blah blah blah) AssetLoader.font.draw(batcher, "Hey guys", x, y); something like this... now I wish to delete/remove/undraw this thing on screen... how do I do that without using if statement because.. if I start using If statements everything is going to get sooo messy. Thanks so much!
tagged with: android
score: 1
upvote count: 2
has answer: http://stackoverflow.com/a/24924290
downvote count: 1
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/24926404
tagged with: libgdx
has answer: http://stackoverflow.com/a/24926404
tagged with: java
has title: libGDX - how to remove existing spritebatch on screen?

http://stackoverflow.com/comment/38812098
type: AnswerComment
score: 0
has text: @RajeshKumar, glad it helped but I was kinda just proving a point. JB's is better in regards to your question.
type: Comment
comment on: http://stackoverflow.com/a/24968983

sql
tags question: http://stackoverflow.com/q/25025167
tags question: http://stackoverflow.com/q/25038547
tags question: http://stackoverflow.com/q/25030413
tags question: http://stackoverflow.com/q/24943894
tags question: http://stackoverflow.com/q/24978267
tags question: http://stackoverflow.com/q/24912919
tags question: http://stackoverflow.com/q/24997851
tags question: http://stackoverflow.com/q/24909275
tags question: http://stackoverflow.com/q/25069380
tags question: http://stackoverflow.com/q/25031889
tags question: http://stackoverflow.com/q/25032252
tags question: http://stackoverflow.com/q/24917917
tags question: http://stackoverflow.com/q/25058682
tags question: http://stackoverflow.com/q/24919960
tags question: http://stackoverflow.com/q/24980871
tags question: http://stackoverflow.com/q/24967830
tags question: http://stackoverflow.com/q/25057042
tags question: http://stackoverflow.com/q/25052604
tags question: http://stackoverflow.com/q/24977586
tags question: http://stackoverflow.com/q/24996791
tags question: http://stackoverflow.com/q/25030650
tags question: http://stackoverflow.com/q/25044828
tags question: http://stackoverflow.com/q/25047015
tags question: http://stackoverflow.com/q/25036996
tags question: http://stackoverflow.com/q/24934090
tags question: http://stackoverflow.com/q/24934187
tags question: http://stackoverflow.com/q/25051831
tags question: http://stackoverflow.com/q/24964293
tag name: sql
tags question: http://stackoverflow.com/q/25028990
tags question: http://stackoverflow.com/q/25031251
tags question: http://stackoverflow.com/q/24952475
tags question: http://stackoverflow.com/q/25039632
type: Tag
tags question: http://stackoverflow.com/q/24975014
tags question: http://stackoverflow.com/q/24932061
tags question: http://stackoverflow.com/q/24920846
tags question: http://stackoverflow.com/q/25036439
tags question: http://stackoverflow.com/q/25009371
tags question: http://stackoverflow.com/q/24910042
tags question: http://stackoverflow.com/q/25024894
tags question: http://stackoverflow.com/q/24989710
tags question: http://stackoverflow.com/q/24946523
tags question: http://stackoverflow.com/q/24933253
tags question: http://stackoverflow.com/q/25015689
tags question: http://stackoverflow.com/q/24952910
tags question: http://stackoverflow.com/q/24931954
tags question: http://stackoverflow.com/q/25058559
tags question: http://stackoverflow.com/q/25023909
tags question: http://stackoverflow.com/q/25014814
tags question: http://stackoverflow.com/q/24932262
tags question: http://stackoverflow.com/q/25054095
tags question: http://stackoverflow.com/q/25048744
tags question: http://stackoverflow.com/q/24934243
tags question: http://stackoverflow.com/q/25005315
tags question: http://stackoverflow.com/q/24918237
tags question: http://stackoverflow.com/q/24935478
tags question: http://stackoverflow.com/q/25003009
tags question: http://stackoverflow.com/q/25058936
tags question: http://stackoverflow.com/q/25062806
tags question: http://stackoverflow.com/q/24926438
tags question: http://stackoverflow.com/q/24935010
tags question: http://stackoverflow.com/q/24971880
tags question: http://stackoverflow.com/q/25056865
tags question: http://stackoverflow.com/q/25021329
tags question: http://stackoverflow.com/q/24939621
tags question: http://stackoverflow.com/q/25065906
tags question: http://stackoverflow.com/q/24957473
tags question: http://stackoverflow.com/q/24933832
tags question: http://stackoverflow.com/q/24982634
tags question: http://stackoverflow.com/q/25054286
tags question: http://stackoverflow.com/q/25014712
tags question: http://stackoverflow.com/q/24988829
tags question: http://stackoverflow.com/q/24951758
tags question: http://stackoverflow.com/q/24966611
tags question: http://stackoverflow.com/q/24912889
tags question: http://stackoverflow.com/q/25032083
tags question: http://stackoverflow.com/q/25051827
tags question: http://stackoverflow.com/q/24964856
tags question: http://stackoverflow.com/q/25065275

http://stackoverflow.com/q/24933832
type: AnsweredQuestion
has body: I have an object with 70 attributes. For ease of use I created 2 objects, a 'main' object and a 'details' object, with 1:1 relationship based on an auto-generated integer ID. I had a SEARCH screen that allowed searching on any of the main attributes, for which I build Restriction objects for whatever the user typed in. What was nice was that I did this all through iterating through the fields and building criterion - I didn't need ugly code to specifically handle each of the 30 attributes. Now they want to search on the details fields as well. My previous screen-field-iterating code works perfectly with no changes (the whole reason for making it 'generic'), however I cannot get the JOIN to work to query on details fields. class House { Integer houseID; String address; . . . HouseDetails houseDetails; } class HouseDetails { Integer houseID; String color; . . . } I tried to create an alias and add it to the criteria : criteria.createAlias("houseDetails", "houseDetails"); but I get this error : org.hibernate.QueryException: could not resolve property: color of: House Here's the thing - I know this would work if I prefix my restrictions with the alias name, but I do NOT want to have to know which table (House or HouseDetails) the field comes from. That would ruin all the automatic looping code and create specific code for each field. Since SQL can do this as long as the column names are unique : select * from house, housedetails where house.houseID = housedetails.houseID and color = 'blue'; I'm wondering how can I get this to work using criteria?? As an aside, but related to this : Is there a way to perform something like Java's introspection on Hibernate HBM.XML mapping files? A number of times I've wanted to do this to solve problems but never found an answer. For the above problem, if I could easily find out which table contained each field, I could add the prefix to the Restriction. Something like this : // Map of search keys (columns) to searching values for ( Stri…
score: 1
possible better answer: http://stackoverflow.com/a/24953616
tagged with: java
tagged with: hibernate
tagged with: mysql
accepted answer: http://stackoverflow.com/a/24936571
tagged with: hibernate-criteria
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/24936571
answer count: 2
has title: Join using Hibernate Criteria without using Alias on Restriction
tagged with: sql
has answer: http://stackoverflow.com/a/24953616
downvote count: 0
favorite count: 0

http://stackoverflow.com/q/24909275
has comment: http://stackoverflow.com/comment/38699396
tagged with: jdbc
has comment: http://stackoverflow.com/comment/38699197
has comment: http://stackoverflow.com/comment/38699308
accepted answer: http://stackoverflow.com/a/24909399
type: AnsweredQuestion
score: 1
tagged with: java
has title: Inserting String as datetime2(0) into SQL Server 2012 using JDBC causes error
upvote count: 1
type: Question
tagged with: sql-server
has answer: http://stackoverflow.com/a/24909399
tagged with: sql
answer count: 1
downvote count: 0
has body: I gather data from an external source and wish to insert it into my SQL Server 2012 database. When I attempt to insert a String, formatted as follows: "YYYY-MM-DD hh:mm:ss", which complies with the documentation., it doesn't go quite as I want to. For clarification, the first column of my table is of type datetime2(0). Upon executing the following code insertData() { ... insert.execute("INSERT INTO [LindTrading].[dbo].[Bloomberg]" + " VALUES" + "(" + trade.getTimestamp() + " ," + trade.getAmount() + "," + trade.getPrice() + "," + trade.getTicker() + ")"); ... } An example of a timestamp is "2014-07-22 00:04:08". I get the following error: (...).SQLServerException: Incorrect syntax near '00'. Also, getTicker() returns a string such as "CF US EQUITY", and the spaces surrounding US seem to cause similar problems, when I attempt to insert into a varchar(25) column. What am I doing wrong?
favorite count: 0
has comment: http://stackoverflow.com/comment/38699296

http://stackoverflow.com/comment/38839149
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24963385
has text: Hi aishpr, was the problem indeed an old aws-sdk version? Also, I thought that I'd seen a separate question from you on an actual functional issue with dynamodb get-item, but I can't find it. If that's still an issue for you, let me know where the question is and I can look into it soon.

http://stackoverflow.com/a/24970612
answers question: http://stackoverflow.com/q/24970536
has comment: http://stackoverflow.com/comment/38814931
has comment: http://stackoverflow.com/comment/38814969
score: 0
has body: Generate getter and setter in your common class for all variable and then get and set them via those methods. hope it will help
type: Answer

http://stackoverflow.com/a/25053880
type: Answer
has body: You are trying to add the same instance over and over again. Thus the message that "specific child already exists". You would have to create a new template layout instance with different ID (I suppose) and then try to add it in. So rather than: ((RelativeLayout) insertPoint).addView(v1, templateParams); and adding v1 again. Create a new instance v1 = vi.inflate(R.layout.form_template, null); set the id for good measures and then add it again in view. I suppose you don't need to set the id, but you can read more about how id's work here
has comment: http://stackoverflow.com/comment/38973005
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/38972914
has comment: http://stackoverflow.com/comment/38972252
answers question: http://stackoverflow.com/q/25053742
has comment: http://stackoverflow.com/comment/38972095
has comment: http://stackoverflow.com/comment/38973573
accepted answer of: http://stackoverflow.com/q/25053742
has comment: http://stackoverflow.com/comment/38973602
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/38973114
has comment: http://stackoverflow.com/comment/38975277

http://stackoverflow.com/comment/38747074
type: AnswerComment
comment on: http://stackoverflow.com/a/24934542
has text: I want to know the jsp view page location and it's file name
type: Comment
score: 0

http://stackoverflow.com/q/24942495
downvote count: 0
favorite count: 0
has body: I tried to make a little program with Scanner but it says that my While loop is incorrect. The error message is: 'line cannot be resolved to a variable' I tried to fix this problem, but when I do, another error message comes up! Here, I put the code: import java.util.Scanner; public class Application { public static void main(String[] args) { while (line != "yes") { Scanner input = new Scanner(System.in); System.out.println("Do you want some chocolate?"); String line = input.nextLine(); System.out.println("You are wrong!"); } System.out.println("Yup! Good answer! ^.^"); } } What is incorrect? Thanks in advance for your understanding.
has comment: http://stackoverflow.com/comment/38762801
tagged with: while-loop
has comment: http://stackoverflow.com/comment/38763454
has comment: http://stackoverflow.com/comment/38762675
answer count: 4
duplicate of: http://stackoverflow.com/q/513832
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24942795
score: 1
tagged with: loops
upvote count: 1
has answer: http://stackoverflow.com/a/24942523
type: Question
has comment: http://stackoverflow.com/comment/38762674
has answer: http://stackoverflow.com/a/24942516
tagged with: java
possible better answer: http://stackoverflow.com/a/24942523
has answer: http://stackoverflow.com/a/24942524
has comment: http://stackoverflow.com/comment/38762671
has comment: http://stackoverflow.com/comment/38763172
has title: What's wrong with my While loop?
has comment: http://stackoverflow.com/comment/38762679
has comment: http://stackoverflow.com/comment/38762956
has comment: http://stackoverflow.com/comment/38762774
linked to: http://stackoverflow.com/q/513832
accepted answer: http://stackoverflow.com/a/24942524

http://stackoverflow.com/comment/38730407
type: QuestionComment
has text: I dont have much idea about JXL api, but i think [this](http://thinktibits.blogspot.it/2012/12/POI-iText-Convert-XLS-to-PDF-Java-Program.html) might help you
score: 0
comment on: http://stackoverflow.com/q/24925492
type: Comment

http://stackoverflow.com/q/25016040
tagged with: android
answer count: 1
has body: I would like to update my Listview in a fragmen in a onPostExecute() separate class. The first initialization of the the Listview doas work, but wehe I call createList() again, the App crashes (NullPointerException) Any Idea? Main_Fragment: public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState){ View fragmentView = inflater.inflate(R.layout.main_fragment, container, false); StartSocketService = (Button) fragmentView.findViewById(R.id.start_socketservice); StartSocketService.setOnClickListener(this); StopSocketService = (Button) fragmentView.findViewById(R.id.stop_socketservice); StopSocketService.setOnClickListener(this); listview = (ListView) fragmentView.findViewById(R.id.listView1); createList(); return fragmentView; } public void createList(){ //Reading Server IPs from SharedPreferences and put them to ListView SharedPreferences settings = getActivity().getSharedPreferences("Found_Devices", 0); for (int i = 0; i &lt; 255; i++) { if ((settings.getString("Server"+i,null)) != null) { serverList.add(settings.getString("Server"+i, null)); Log.v("Reading IP: " +settings.getString("Server"+i, null), " from SraredPreferrences at pos.: "+i ); } } //Initializing listView final StableArrayAdapter adapter = new StableArrayAdapter(getActivity(),android.R.layout.simple_list_item_1, serverList); listview.setAdapter(adapter); listview.setOnItemClickListener(new AdapterView.OnItemClickListener() { @TargetApi(Build.VERSION_CODES.JELLY_BEAN) @Override public void onItemClick(AdapterView&lt;?&gt; parent, final View view, int position, long id) { final String item = (String) parent.getItemAtPosition(position); view.animate().setDuration(2000).alpha(0).withEndAction(new Runnable() { @Override public void run() { serverList.remove(item); adapter.notifyDataSetChanged(); view.setAlpha(1); } }); } }); } Some class: async_cient = new AsyncTask&lt;Void, Void, Void&gt;() { ... protected void onPostExecute(Void result) { Toast.makeText(mContext, "Sc…
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38900566
tagged with: java
tagged with: sharedpreferences
type: Question
has title: Updating Listview ( SharedPreferences -> ArrayList) from separate Class
has answer: http://stackoverflow.com/a/25016146
tagged with: listview
tagged with: arraylist
score: 0

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

http://stackoverflow.com/q/25068946
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39001066
tagged with: java
has body: Hey Im new to android developing and I was using the tutorial on the official android website to help me create an app. so far I've create a textbox and when you click on it. it simply opens another screen and returns my name. How would I take the input from the textbox as a number and multiply by another value. Heres the code i have so far. &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.example.discountprice2.DisplayMessageActivity$PlaceholderFragment" &gt; &lt;TextView android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content"/&gt; &lt;/RelativeLayout&gt; &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.example.discountprice2.MainActivity$PlaceholderFragment" &gt; &lt;EditText android:id="@+id/edit_message" android:layout_width="wrap_content" android:layout_height="wrap_content" android:ems="10" android:hint="@string/edit_message" android:inputType="text" /&gt; &lt;Button android:id="@+id/button1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentRight="true" android:layout_alignTop="@+id/edit_message" android:text="@string/calc" android:onClick="sendMessage" /&gt; &lt;/RelativeLayout&gt; import android.cont…
type: Question
possible better answer: http://stackoverflow.com/a/25068988
tagged with: textbox
has title: How to take in number from text box and multiple by a Value
score: 0
tagged with: android
has answer: http://stackoverflow.com/a/25069370
answer count: 4
accepted answer: http://stackoverflow.com/a/25069065
tagged with: integer
has answer: http://stackoverflow.com/a/25068997
has answer: http://stackoverflow.com/a/25068988
has answer: http://stackoverflow.com/a/25069065

http://stackoverflow.com/q/25052699
type: Question
has comment: http://stackoverflow.com/comment/38970419
tagged with: android
has comment: http://stackoverflow.com/comment/38969914
tagged with: java
has comment: http://stackoverflow.com/comment/38969690
upvote count: 1
answer count: 1
accepted answer: http://stackoverflow.com/a/25054463
has comment: http://stackoverflow.com/comment/38970011
has comment: http://stackoverflow.com/comment/38969842
tagged with: filechooser
has title: afiledialog android library not working | NoClassDefFoundError
type: AnsweredQuestion
has body: I am trying to get to work this android library https://code.google.com/p/afiledialog/ it also has a sample project named aFileDialogTesting but I cannot get it to work. I'm getting error NoClassDefFoundError when I run it. I'm also getting "Could not find class 'ar.com.daidalos.afiledialog.FileChooserActivity', referenced from method ar.com.daidalos.afiledialog.test.AFileDialogTestingActivity$13.onClick" Probably there is wrong in referencing the android library project. But how can I reference it correctly?
has comment: http://stackoverflow.com/comment/38972923
downvote count: 0
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/38970625
has answer: http://stackoverflow.com/a/25054463

http://stackoverflow.com/a/25066812
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/39030118
has comment: http://stackoverflow.com/comment/39233350
has comment: http://stackoverflow.com/comment/39030286
has comment: http://stackoverflow.com/comment/39102528
has comment: http://stackoverflow.com/comment/39102085
has comment: http://stackoverflow.com/comment/39265955
accepted answer of: http://stackoverflow.com/q/25066571
has comment: http://stackoverflow.com/comment/39032809
has comment: http://stackoverflow.com/comment/39232171
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/25066571
has comment: http://stackoverflow.com/comment/39262532
has body: Update each chart's model, an instance of TimeSeries, in the background of a SwingWorker. A complete example is shown here. The listening view, an instance of ChartPanel, will update itself accordingly.
type: Answer
has comment: http://stackoverflow.com/comment/39036898

http://stackoverflow.com/a/24917913
type: Answer
has comment: http://stackoverflow.com/comment/38716383
has body: To disable the expanding of the group items, you could set a GroupClickListener and return true if you want to disable the expansion. ExpandableList.setOnGroupClickListener(new OnGroupClickListener() { @Override public boolean onGroupClick(ExpandableListView parent, View v, int groupPosition, long id) { return groupPosition == 0; //Index of item in your list that you want to be expandable } }); As for the icons, you could define your own layout for the group items.
has comment: http://stackoverflow.com/comment/86591847
upvote count: 4
has comment: http://stackoverflow.com/comment/38716661
downvote count: 0
has comment: http://stackoverflow.com/comment/38716691
score: 4
accepted answer of: http://stackoverflow.com/q/24917649
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24917649

http://stackoverflow.com/a/25041695
score: 0
type: AcceptedAnswer
has body: This sounds like you haven't set your context-root for your application in Weblogic. You will want to set it in your application.xml or weblogic.xml: MyApp You can see some good example here in the Oracle docs
answers question: http://stackoverflow.com/q/25041206
accepted answer of: http://stackoverflow.com/q/25041206
type: Answer
has comment: http://stackoverflow.com/comment/38950115

http://stackoverflow.com/comment/38857004
comment on: http://stackoverflow.com/q/24992959
score: 0
type: Comment
type: QuestionComment
has text: You should start by reading this http://en.wikipedia.org/wiki/Reflection_(computer_programming)

http://stackoverflow.com/q/25069522
type: Question
tagged with: jasper-reports
has comment: http://stackoverflow.com/comment/39091172
answer count: 2
favorite count: 0
accepted answer: http://stackoverflow.com/a/25128499
has comment: http://stackoverflow.com/comment/53787181
upvote count: 7
downvote count: 1
has title: Jars needed for JasperReports?
has answer: http://stackoverflow.com/a/25128499
has body: I have downloaded JasperReports jars (jasperreports-5.6.0-project.zip from here) and toke all the jars in the dist folder. These are the files I added to my project: jasperreports-5.6.0.jar jasperreports-applet-5.6.0.jar jasperreports-fonts-5.6.0.jar jasperreports-javaflow-5.6.0.jar But when I try my code I always get this error: java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory UPDATE 1 I solved that error and I have a lot of more missing jars. Please tell me all the additional jars needed to use JasperReports.
has comment: http://stackoverflow.com/comment/39008330
possible better answer: http://stackoverflow.com/a/54979108
score: 6
has answer: http://stackoverflow.com/a/54979108
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/q/24998055
accepted answer: http://stackoverflow.com/a/24998384
favorite count: 0
has comment: http://stackoverflow.com/comment/38866867
has answer: http://stackoverflow.com/a/24998389
has comment: http://stackoverflow.com/comment/38866946
upvote count: 0
downvote count: 5
has body: I want to convert a String myString like that: [ ["cd",5,6,7], ["rtt",55,33,12], ["by65",87,87,12] ] into an ArrayList&lt;CustomClass&gt; Where CustomClass have constructor : public CustomClass (String name, int num1, int num2, int num3) I tried first to create ArrayList of Strings : List&lt;String&gt; List = new ArrayList&lt;String&gt;(Arrays.asList(myString.split("["))); Didn't worked for me... How can I get something like that: List - {CustomClass,CustomClass,CustomClass,CustomClass} first CustomClass = CustomClass.name="cd" , CustomClass.num1=5,CustomClass.num2=7... second CustomClass = CustomClass.name="rtt",CustomClass.num1=55,CustomClass.num2=55... and so on...
has comment: http://stackoverflow.com/comment/38866757
tagged with: collections
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38866698
score: -5
has title: Convert String into ArrayList<MyClass>
tagged with: java
possible better answer: http://stackoverflow.com/a/24998389
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/38866945
has answer: http://stackoverflow.com/a/24998384

http://stackoverflow.com/q/25060937
score: 1
tagged with: java
upvote count: 1
downvote count: 0
tagged with: soapheader
tagged with: soap
has comment: http://stackoverflow.com/comment/88617477
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml
tagged with: xml-namespaces
answer count: 0
has body: i want to add the name space for all the items in the SOAPbody, the configuration related to the XML manipulation is in below i added the name space for the header but it doesn't come to the SOAP-body Boolean outboundProperty = (Boolean) smc.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY); if (outboundProperty.booleanValue()) { SOAPMessage message = smc.getMessage(); try { SOAPEnvelope envelope = smc.getMessage().getSOAPPart().getEnvelope(); System.out.println("Envelop : "+envelope); envelope.addNamespaceDeclaration("sch", "http://api.jasperwireless.com/ws/schema"); SOAPHeader header = envelope.addHeader(); SOAPElement security = header.addChildElement("Security", "wsse", "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"); SOAPElement usernameToken = security.addChildElement("UsernameToken", "wsse"); usernameToken.addAttribute(new QName("xmlns:wsu"), "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"); SOAPElement username = usernameToken.addChildElement("Username", "wsse"); username.addTextNode("XXXXXXXXX"); SOAPElement password = usernameToken.addChildElement("Password", "wsse"); password.setAttribute("Type", "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText"); password.addTextNode("XXXXXXXXXXXXXX"); //Print out the outbound SOAP message to System.out message.writeTo(System.out); System.out.println(""); } catch (Exception e) { e.printStackTrace(); } and below is the XML that is created from the above code <S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sch="http://api.jasperwireless.com/ws/schema"> <S:Header> <wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"> <wsse:UsernameToken xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"> <wsse:Username>XXXXXX</wsse:Username> <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oas…
type: UnansweredQuestion
type: Question
has title: Adding the namespace for SOAP message body

http://stackoverflow.com/q/24918252
has answer: http://stackoverflow.com/a/25030484
tagged with: jvm
favorite count: 0
has answer: http://stackoverflow.com/a/24918338
answer count: 5
has answer: http://stackoverflow.com/a/25076347
has answer: http://stackoverflow.com/a/24922347
upvote count: 13
type: UnansweredQuestion
tagged with: java
score: 13
type: Question
has body: I know that the JVM memory model is made for lowest common denominator of CPUs, so it has to assume the weakest possible model of a cpu on which the JVM can run (eg ARM). Now, considering that x64 has a fairly strong memory model, what synchronization practices can I ignore assuming I know my program will only run on 64bit x86 CPUs? Also does this apply when my program is being run through virtualization? Example: It is known that JVM's memory model requires synchronizing read/writes access to longs and doubles but one can assume that read/writes of other 32 bit primitives like int, float etc are atomic. However, if i know that I am running on a 64 bit x86 machine, can i ignore using locks on longs/doubles knowing that the cpu will atomically read/write 64 bit values and just keep them volatile (like i would with ints/floats)?
has title: What JVM synchronization practices can I ignore assuming I know I will run on x64 cpus?
tagged with: java-memory-model
tagged with: concurrency
linked to: http://stackoverflow.com/q/3123326
has answer: http://stackoverflow.com/a/24973890
downvote count: 0

http://stackoverflow.com/q/25021777
has comment: http://stackoverflow.com/comment/38926934
score: 0
tagged with: http://stackoverflow.com/tag/pdf
tagged with: tomcat
has comment: http://stackoverflow.com/comment/38916039
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38916926
has comment: http://stackoverflow.com/comment/38951200
tagged with: javax.imageio
answer count: 0
tagged with: java
has body: I am trying to use PDFBox in a Java application running as a Webservelet on Tomcat 7 and Java 6. I have successfully gotten my code to run as a compiled JAR that works on several different test files that I supply to the application. However, when I try to use it as a WAR file on Tomcat, it throws several errors. PDFBox seems to be unable to access the images in the PDF file I provide to the application. The PDF file is loaded from disk in a directory read/write accessible to the tomcat instance. The structure of the PDF seems to be detected by PDFBox. However, when I try to access images within the PDF using the code below, getRGBImage() returns null. This is only true on the server, however, as the same code successfully returns a BufferedImage when run as a JAR. PDResources resources = page.getResources(); Map&lt;String, PDXObject&gt; pageImages = resources.getXObjects(); if (pageImages != null) { Iterator&lt;String&gt; imageIter = pageImages.keySet().iterator(); while( imageIter.hasNext() ) { String key = (String)imageIter.next(); PDXObject xobject = pageImages.get( key ); PDXObjectImage image = null; if (xobject instanceof PDXObjectImage) { image = (PDXObjectImage) xobject; } else { continue; } // Save image as a separate file BufferedImage pdfImage = image.getRGBImage(); if (pdfImage == null) { logger.error("Null image."); continue; } File outFile = new File(this.temporary + "out" + this.imageIdx + ".png"); ImageIO.write(pdfImage, "png", outFile); } } If allowed to continue on to ImageIO.write(), PDFBox will throw an exception about the org.apache.pdfbox.pdmodel.graphics.xobject.PDPixelMap object being empty. What could be causing this issue? EDIT: The following shows the exception output by the above code if continue; is removed. 3298 [PDFWorker:0] ERROR org.apache.pdfbox.pdmodel.graphics.xobject.PDPixelMap - Something went wrong ... the pixelmap doesn't contain any data. java.lang.NullPointerException at asdf.ImageOCRProcessor.doHOCR(ImageOCRProcessor.java:6…
type: Question
has comment: http://stackoverflow.com/comment/38941435
tagged with: pdfbox
has title: Null BufferedImage when using PDFBox in Tomcat

http://stackoverflow.com/comment/38874620
has text: I'm sorry, I'm not as knowledgeable as most and still am learning. Hence why my question title clearly(as opposed to my distinction between obscuring and encryption) states what is the 'optimal' method for this. I have never said your encoding scheme doesn't work, I simply said I don't know what I ought to use. Hope this clears it up
comment on: http://stackoverflow.com/q/25002093
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25065091
has title: How to add java_opt to wildfly in openshift?
has answer: http://stackoverflow.com/a/29166365
has answer: http://stackoverflow.com/a/25065801
type: UnansweredQuestion
tagged with: wildfly
tagged with: openshift
type: Question
tagged with: java
has body: I want to add JAVA_OPTS setting to the standalone configuration for wildfly in openshift. What is the best way to do this? Do i need to do this by an action hook? Is this action hook also invoked when the server is restarted using "ctl_app restart"? Or is there another way the add JAVA_OPT settings?
answer count: 2
score: 0

http://stackoverflow.com/comment/38944548
type: Comment
comment on: http://stackoverflow.com/q/25039227
score: 3
has text: It may be helpful to to understand what it is you're trying to do with the hook... I'm a little confused as the post-commit hook is going to run on the server - not the client.
type: QuestionComment

http://stackoverflow.com/comment/38733778
comment on: http://stackoverflow.com/q/24927021
score: 0
type: Comment
has text: I am looking answer for both why and how integer++ work. and how i can make myclass++ work.(although i know operator overloading is not allowed in java)
type: QuestionComment

http://stackoverflow.com/a/25012526
score: 1
has comment: http://stackoverflow.com/comment/38894370
downvote count: 0
has body: There is no way to do it automatically, since the parent constructor is always called before the child one (explicitely or implicitely). One solution workaround could be: public abstract class MyComposite { public MyComposite() { construct(); initHandlers(); } protected abstract void construct(); protected abstract void initHandlers(); } public class CollWidget extends MyComposite { @Override protected void construct() { // called firstly } @Override public void initHandlers() { // called secondly } }
type: Answer
has comment: http://stackoverflow.com/comment/38894533
upvote count: 1
answers question: http://stackoverflow.com/q/25012197

http://stackoverflow.com/q/24982432
answer count: 4
has body: I have to create few buttons imagebuttons programatically and i don't know how to change size of them. Changing left and right does not work.
downvote count: 2
type: Question
has title: How to change size of imagebutton in android programatically
has answer: http://stackoverflow.com/a/24982472
has answer: http://stackoverflow.com/a/24982508
tagged with: java
tagged with: resize
score: 4
has answer: http://stackoverflow.com/a/24982500
tagged with: imagebutton
has answer: http://stackoverflow.com/a/24982473
favorite count: 0
type: UnansweredQuestion
tagged with: android
upvote count: 6

http://stackoverflow.com/comment/38874504
has text: Have you tried to synchronize the method using a lock, to make sure that this is not a race condition?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25002261
type: Comment

http://stackoverflow.com/a/24981776
accepted answer of: http://stackoverflow.com/q/24981726
has body: You can use CoundDownLatch A synchronization aid that allows one or more threads to wait until a set of operations being performed in other threads completes. sample code: CountDownLatch startSignal = new CountDownLatch(1); CountDownLatch doneSignal = new CountDownLatch(5); // 5 tasks class Worker implements Runnable { private final CountDownLatch startSignal; private final CountDownLatch doneSignal; private final int threadNumber; // you can pass additional arguments as well Worker(CountDownLatch startSignal, CountDownLatch doneSignal, int threadNumber) { this.startSignal = startSignal; this.doneSignal = doneSignal; this.threadNumber = threadNumber; } public void run() { try { startSignal.await(); doWork(); // actual work to be performed here doneSignal.countDown(); } catch (InterruptedException ex) { LOGGER.error(ex); } } } // 5 new threads are started for(int i=1;i&lt;=5;i++){ new Thread(new Worker(startSignal, doneSignal, i)).start(); } startSignal.countDown(); // let all threads proceed try { doneSignal.await(); // wait for all to finish // all 5 tasks are finished and do whatever you want to do next } catch (InterruptedException interruptedException) { LOGGER.error(interruptedException); } Read more... and Find more examples...
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38837639
answers question: http://stackoverflow.com/q/24981726
score: 1
type: Answer
upvote count: 2
downvote count: 1
has comment: http://stackoverflow.com/comment/38837710

http://stackoverflow.com/comment/38745380
has text: Unfortunately I'm not responsible for the APi, only for the android app. But I will ask for the code, the one who is responsible for that will be back on monday.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24928025
type: AnswerComment

servlets
tags question: http://stackoverflow.com/q/24984257
tags question: http://stackoverflow.com/q/25050944
tags question: http://stackoverflow.com/q/24991804
tags question: http://stackoverflow.com/q/24978143
tags question: http://stackoverflow.com/q/24925358
tags question: http://stackoverflow.com/q/25052818
tags question: http://stackoverflow.com/q/25002366
tags question: http://stackoverflow.com/q/25021285
tags question: http://stackoverflow.com/q/24913918
tags question: http://stackoverflow.com/q/24955786
tags question: http://stackoverflow.com/q/24976736
tags question: http://stackoverflow.com/q/24968990
tags question: http://stackoverflow.com/q/24919748
tags question: http://stackoverflow.com/q/24923002
tags question: http://stackoverflow.com/q/24942844
tags question: http://stackoverflow.com/q/24965261
tags question: http://stackoverflow.com/q/24995773
tags question: http://stackoverflow.com/q/24968305
tags question: http://stackoverflow.com/q/24967377
tags question: http://stackoverflow.com/q/25028645
tags question: http://stackoverflow.com/q/24953785
tags question: http://stackoverflow.com/q/24967510
tags question: http://stackoverflow.com/q/25048238
tags question: http://stackoverflow.com/q/25014807
tags question: http://stackoverflow.com/q/24981726
tags question: http://stackoverflow.com/q/25006488
tags question: http://stackoverflow.com/q/24934823
tags question: http://stackoverflow.com/q/25043194
tags question: http://stackoverflow.com/q/24982462
tags question: http://stackoverflow.com/q/25033594
tags question: http://stackoverflow.com/q/25043564
tags question: http://stackoverflow.com/q/24986352
tags question: http://stackoverflow.com/q/25015856
tags question: http://stackoverflow.com/q/24937494
tags question: http://stackoverflow.com/q/24992412
tags question: http://stackoverflow.com/q/24938351
tags question: http://stackoverflow.com/q/24914008
tags question: http://stackoverflow.com/q/25057589
tags question: http://stackoverflow.com/q/24995026
tags question: http://stackoverflow.com/q/24975944
tags question: http://stackoverflow.com/q/25057422
tags question: http://stackoverflow.com/q/25058763
tags question: http://stackoverflow.com/q/25026313
tags question: http://stackoverflow.com/q/24931226
tags question: http://stackoverflow.com/q/24925910
tags question: http://stackoverflow.com/q/25059602
tags question: http://stackoverflow.com/q/25047015
tags question: http://stackoverflow.com/q/24915678
tags question: http://stackoverflow.com/q/24939199
tags question: http://stackoverflow.com/q/24983931
tags question: http://stackoverflow.com/q/25030600
tags question: http://stackoverflow.com/q/24998395
tags question: http://stackoverflow.com/q/24951627
tags question: http://stackoverflow.com/q/24947312
tags question: http://stackoverflow.com/q/25014568
tags question: http://stackoverflow.com/q/25050376
tags question: http://stackoverflow.com/q/24925615
tags question: http://stackoverflow.com/q/24912489
tags question: http://stackoverflow.com/q/25013687
tags question: http://stackoverflow.com/q/24942153
tags question: http://stackoverflow.com/q/25027714
tags question: http://stackoverflow.com/q/25039915
tags question: http://stackoverflow.com/q/24932806
tag name: servlets
tags question: http://stackoverflow.com/q/24938666
type: Tag
tags question: http://stackoverflow.com/q/25047075
tags question: http://stackoverflow.com/q/25027884
tags question: http://stackoverflow.com/q/25052679
tags question: http://stackoverflow.com/q/24967723
tags question: http://stackoverflow.com/q/24952403
tags question: http://stackoverflow.com/q/24932145
tags question: http://stackoverflow.com/q/24970033
tags question: http://stackoverflow.com/q/25050907

http://stackoverflow.com/comment/38883215
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25006598
has text: You can just get the smallest and largest values in O(n) time.

http://stackoverflow.com/q/24975984
linked to: http://stackoverflow.com/q/5013947
tagged with: java
type: Question
has body: I have made a Generic Class with one type variable, which implements java.lang.Comparable. I'm having problems on how to implement the compareTo() method as the &lt;,> operators are not valid to be used for the generic type. I came across this Create a compareTo to a Generic Class that Implements Comparable By following the accepted ans i was able to implement compareTo method but i don't understand how it works, please can anyone explain.... the answer i was refering to is... public class DoubleKey&lt;K extends Comparable&lt;K&gt;, J extends Comparable&lt;J&gt;&gt; implements Comparable&lt;DoubleKey&lt;K, J&gt;&gt; { private K key1; private J key2; public DoubleKey(K key1, J key2) { this.key1 = key1; this.key2 = key2; } public K getFirstKey() { return this.key1; } public J getSecondKey() { return this.key2; } public int compareTo(DoubleKey&lt;K, J&gt; that) { int cmp = this.getFirstKey().compareTo(that.getFirstKey()); if (cmp == 0) cmp = this.getSecondKey().compareTo(that.getSecondKey()); return cmp; } }
has title: Explaination on CompareTo method for generics
upvote count: 1
answer count: 1
tagged with: generics
favorite count: 0
has comment: http://stackoverflow.com/comment/38825031
score: -3
has answer: http://stackoverflow.com/a/24976420
accepted answer: http://stackoverflow.com/a/24976420
downvote count: 4
has comment: http://stackoverflow.com/comment/38825053
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38825146

http://stackoverflow.com/comment/38837297
comment on: http://stackoverflow.com/a/24982430
score: 0
type: Comment
has text: thank-you for the explanation. I deliberately chose the join table approach, since I really want to keep the player table clean of a foreign key to the player_ref table. So the question is, can I keep my design and still get rid of the N+1 select statements?
type: AnswerComment

http://stackoverflow.com/comment/38864136
score: 1
type: AnswerComment
has text: Wouldn't it be better to add `-I$(JAVA_HOME)/include/linux/` to the compiler option?
type: Comment
comment on: http://stackoverflow.com/a/24996278

http://stackoverflow.com/comment/38957570
type: QuestionComment
comment on: http://stackoverflow.com/q/25026476
has text: Hm, that's a good point; thanks
score: 0
type: Comment

http://stackoverflow.com/comment/38909245
type: Comment
has text: wrapper.setUzivatel(uzivatelia); uzivatelia is observablelist of Uzivatel i copy-pasted your code still nothing. But it depends on number of useres I have. When I have 3 users theres 3 times <Uzivatel/>. I think its creating row for it but it cant fill it with data.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25020125

http://stackoverflow.com/q/24926430
has answer: http://stackoverflow.com/a/24940143
type: UnansweredQuestion
downvote count: 2
has title: How use COM in Linux (Ubuntu)
has body: I am programming in Java and I need to use the Jacob library. Jacob is a COM library and as you can see here I can not use it on Linux (because Jacob uses COM which is Microsoft Windows). But I know that it is possible to do programming in C# (which also is Microsoft Windows) on Linux. So maybe it is also possible to use Jacob on Linux (Ubuntu). Do you have any ideas?
tagged with: java
type: Question
upvote count: 0
score: -2
tagged with: ubuntu
tagged with: com
answer count: 1
has comment: http://stackoverflow.com/comment/38733465
favorite count: 0
tagged with: linux

http://stackoverflow.com/a/25026598
has body: You're looking for LocalTime.now()
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25026588
answers question: http://stackoverflow.com/q/25026588
has comment: http://stackoverflow.com/comment/38920770
type: Answer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/38920761

http://stackoverflow.com/comment/76293791
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/31424682
has text: Are you just assuming or talking from experience? I have exactly the same error and i have a leak. I can clearly see its references are not going to be freed anytime soon.
score: 0

http://stackoverflow.com/comment/38833772
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24980432
score: 0
has text: What started as a comment (because I was not sure if that's what you were asking), turned out into an answer. I reposted it as an answer so that you can mark it as accepted if you feel it should be.

http://stackoverflow.com/a/24978296
has body: private static final ScheduledExecutorService worker = Executors.newSingleThreadScheduledExecutor(); void someMethod() { ⋮ Runnable task = new Runnable() { public void run() { /* Do something… */ } }; worker.schedule(task, 5, TimeUnit.SECONDS); ⋮ } or if you want to use timer you can refer to this post on stackoverflow Android timer? How-to?
score: 0
has comment: http://stackoverflow.com/comment/38829907
type: Answer
accepted answer of: http://stackoverflow.com/q/24978279
has comment: http://stackoverflow.com/comment/38829898
has comment: http://stackoverflow.com/comment/38835651
answers question: http://stackoverflow.com/q/24978279
has comment: http://stackoverflow.com/comment/38835880
type: AcceptedAnswer

http://stackoverflow.com/a/24987286
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24986768
type: Answer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/38852977
has body: Just run your own values, forget about what the current opacity is: protected Void doInBackground() throws Exception { for (int i = 1; i &lt;= 10; i++) try { frame.setOpacity(i/10.0); Thread.sleep(30); } catch(InterruptedException e) { e.printStackTrace(); } return null; } This way you're guaranteed to end up at 1.0.
answers question: http://stackoverflow.com/q/24986768

http://stackoverflow.com/comment/38780621
type: Comment
has text: Yes, I know that, but while the documentation explicitly mentions a contract for `compareTo` in conjunction with`Set`, there is no information about requirements for `sort`.
comment on: http://stackoverflow.com/a/24951765
type: AnswerComment
score: 0

http://stackoverflow.com/a/24949092
type: Answer
has comment: http://stackoverflow.com/comment/38775209
score: 1
has body: What you need is the Factory pattern. Whether or not you need want to use the Enum class as the factory itself is another issue. You could do something like this: public enum Module { FIRST, SECOND, ..., KTH } public class ModuleFactory { public Intr createModule(Module module) { switch (module) { case FIRST: return new C1(); case SECOND: return new C2(); ... case KTH: return new Ck(); ... } } } Without knowing how you plan on using these objects, I can't really say which is the more appropriate approach.
has comment: http://stackoverflow.com/comment/38945939
upvote count: 1
answers question: http://stackoverflow.com/q/24948924
downvote count: 0

http://stackoverflow.com/comment/39010052
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25029880
has text: @Rod_Algonquin Other answers/comments suggest that it is _not_ viable, and the main reason my code was faster was because of the order of the two tests I ran. What you say about non static local fields seems to have merit, however.

http://stackoverflow.com/q/25023636
favorite count: 0
tagged with: binary-tree
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25023803
has body: I have the class Bintree that defines a binary tree. I need to implement a method that returns the maximum displacement of the nodes of the tree. So returns a pair of integers; the first of which is the height of t, the second is the maximum imbalance of the subtrees of t. With 'imbalance of a tree' I mean: imbalance of a tree = absolute value of the difference between the height of the left subtree and the height of the right subtree. I created the private inner class IntPair to contain the two integers. I know that the method is a recursive method, so I wrote the base case and I think it's correct. Instead I miss the recursive step... What I wrote is wrong. How do I find the maximum value? public class BinTreeUtil { protected static class IntPair { int height; int maxUnbal; IntPair(int h, int u) { height = h; maxUnbal = u; } } public static int maxUnbalance(BinTree t) { return heightUnbalance(t).maxUnbal; } private static IntPair heightUnbalance(BinTree t) { if(t == null) return new IntPair(-1, 0); else { int sbil = Math.abs(height(t.left) + height(t.right)); return new IntPair(height(t), ???); } } } Thanks.
upvote count: 1
type: Question
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/25023803
answer count: 1
downvote count: 0
has title: find the maximum unbalance of a binary tree

http://stackoverflow.com/comment/38951651
score: 0
comment on: http://stackoverflow.com/q/25042893
has text: Regarding first question, just put an `if (isAlive)` block around your code that changes the velocity.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38732814
type: AnswerComment
type: Comment
score: 0
has text: check your jar, I have that class as part of hamcrest-core-1.3.jar. Try to open and see in your hamcrest jar. Also if you use JUnit 4.0, hamcrest core comes as part of the JUnit jar itself.
comment on: http://stackoverflow.com/a/24926561

http://stackoverflow.com/comment/38956441
score: 0
has text: What do you mean by "clean cache"?
comment on: http://stackoverflow.com/q/25044076
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38841589
type: QuestionComment
comment on: http://stackoverflow.com/q/24984769
score: 1
has text: From a language perspective, there's nothing *wrong* with it - the code can still be executed and isn't dead. From a practical perspective, it's not uncommon during debugging to replace some complicated expression with `if (true)`, so it's convenient that it doesn't do this.
type: Comment

android-camera
tags question: http://stackoverflow.com/q/24938155
type: Tag
tags question: http://stackoverflow.com/q/24916670
tag name: android-camera
tags question: http://stackoverflow.com/q/25064131
tags question: http://stackoverflow.com/q/24937325

http://stackoverflow.com/a/76790049
answers question: http://stackoverflow.com/q/25013103
has body: <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance
has comment: http://stackoverflow.com/comment/135420168
score: 0
type: Answer

http://stackoverflow.com/a/24983386
type: Answer
score: 1
upvote count: 1
has body: When inside a Fragment, you can access getApplicationContext() directly only if the Fragment is not Static. If it is, for getting a Context object, use getActivity(). As for accessing your Views from the fragment layout file, you have to call findViewById() from your Fragment rootView, that is returned on the onViewCreated() callback first parameter (View v).
answers question: http://stackoverflow.com/q/24981344
accepted answer of: http://stackoverflow.com/q/24981344
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/38815903
has text: @Braj - But that statement does not "create" the interned string. Rather, loading the class does that (assuming that "Rohit" wasn't already interned by some other class).
comment on: http://stackoverflow.com/q/24971120
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25004834
tagged with: java
has comment: http://stackoverflow.com/comment/38880489
type: UnansweredQuestion
has body: I'm working on an automated data identification program. The program is supposed to read through a text file and modify certain lines. For a simplified example, if a directory is "Folder/SubfolderZ/index.html", I would want it changed to "Folder/SubfolderX/index.html". "Folder" contains various subfolders. The exact problem is a little more complicated, but follows the same logic. (edited) Pattern pattern = Pattern.compile(" . "); Matcher matcher = pattern.matcher(" Box Plot"); The code above is not giving a match. I'll admit I don't have much experience with regular expressions. Could someone point out why the code is not working properly??
has comment: http://stackoverflow.com/comment/38883837
type: Question
tagged with: regex
has comment: http://stackoverflow.com/comment/38879806
has comment: http://stackoverflow.com/comment/38879699
has title: Java regex data modification
score: 0
has comment: http://stackoverflow.com/comment/38880464
answer count: 1
has answer: http://stackoverflow.com/a/25206105

http://stackoverflow.com/q/25044983
answer count: 1
score: 0
type: UnansweredQuestion
has title: Table does not exists error in hibernate
has answer: http://stackoverflow.com/a/25052463
has comment: http://stackoverflow.com/comment/38956913
tagged with: java
tagged with: hibernate
tagged with: mysql
has body: I have an inheritance relationship in my program as Car and Van extends Vehicle. In my case it is a mandatory participation therefore if a vehicle exists it must be a car or a van. Therefore I am using only two tables(car & van) which have columns for super class and subclass fields. public class Vehicle { protected int vin; protected String brand; public Vehicle(){} public Vehicle(int vin, String brand) { this.vin = vin; this.brand = brand; } public int getVin() { return vin; } public void setVin(int vin) { this.vin = vin; } public String getBrand() { return brand; } public void setBrand(String brand) { this.brand = brand; } Car.java public class Car extends Vehicle { private String model; public String getModel() { return model; } public void setModel(String model) { this.model = model; } public Car(){ } public Car(int vin, String brand, String model) { this.vin = vin; this.brand = brand; this.model = model; } Van.java public class Van extends Vehicle { private String vanModel; public Van(){} public Van(int vin,String brand,String vanModel) { this.vanModel = vanModel; this.vin=vin; this.brand=brand; } public String getVanModel() { return vanModel; } public void setVanModel(String vanModel) { this.vanModel = vanModel; } Mapping file <?xml version="1.0" encoding="UTF-8"?> <generator class="increment"/> <property name="brand" column="brand"/> <property name="model" column="model"/> <property name="vanModel" column="vanmodel"/> When I try to insert anything to car or van table the following error comes. com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'myjdbc.vehicle' doesn't exist. I have no idea about this. I never mentioned a table name as vehicle. So why am I getting this error? As I am quite new to hibernate please give me a detailed answer.
type: Question

http://stackoverflow.com/a/25018089
score: 0
has comment: http://stackoverflow.com/comment/38906502
has comment: http://stackoverflow.com/comment/38904433
has comment: http://stackoverflow.com/comment/38906724
has comment: http://stackoverflow.com/comment/38922064
has comment: http://stackoverflow.com/comment/38905104
type: Answer
has comment: http://stackoverflow.com/comment/38906283
answers question: http://stackoverflow.com/q/25017973
has comment: http://stackoverflow.com/comment/38904579
has comment: http://stackoverflow.com/comment/38904847
has body: keep alive **in the background** are you going to send a notification while the app is not showing on the screen? if so, please take a look at the: google gcm
has comment: http://stackoverflow.com/comment/38904508

http://stackoverflow.com/a/25001086
downvote count: 0
has body: You can use the recipient list EIP per this camel FAQ.
accepted answer of: http://stackoverflow.com/q/24996776
type: Answer
answers question: http://stackoverflow.com/q/24996776
score: 4
has comment: http://stackoverflow.com/comment/51905915
upvote count: 4
type: AcceptedAnswer

http://stackoverflow.com/a/34900597
has body: The issue here was likely the while (rs.next()) { tableModel.addRow(...) Each call to addRow() means a "Notification of the row being added will be generated." This notification of the Listener(s) means quite some overhead. Likely, each call indirectly involves a call to invalidate the GUI's state, and more, because the table will have to be redrawn after it changed. Doing that 1300x in ~15s means 100 of those calls per second, which is quite reasonable. The OP should probably look for a way to first gather all data and then update the table model only once with all the data. This may mean having to implement his own variation of DefaultTableModel or AbstractTableModel.
upvote count: 2
type: Answer
answers question: http://stackoverflow.com/q/24966611
score: 2
downvote count: 0

http://stackoverflow.com/comment/38972115
comment on: http://stackoverflow.com/q/25054045
score: 0
type: Comment
type: QuestionComment
has text: Multiple jars on classpath ?

http://stackoverflow.com/comment/38912130
comment on: http://stackoverflow.com/q/25022027
has text: You know, that you don't have to use any line breaks in a Java program?
type: Comment
type: QuestionComment
score: 8

http://stackoverflow.com/q/24947029
tagged with: extends
has comment: http://stackoverflow.com/comment/38771295
type: Question
accepted answer: http://stackoverflow.com/a/24948456
tagged with: android
score: 0
tagged with: java
has title: Android extends Activity
answer count: 1
has answer: http://stackoverflow.com/a/24948456
tagged with: inheritance
type: AnsweredQuestion
has body: I'm developing an Android app. And my classes relationships are like this: https://i.sstatic.net/9CCpA.jpg I'm getting some problems about it. The biggest are: 1) Working with Context. SocialNetWorkClass has a SQLiteDatabase object. But I don't know how to work about it. Because I can't pass the Context with constructor from FacebookClass. 2) On FacebookClass I can't use methods like findViewById, because I don't access BaseClass objects (super super class), it's like if I can't use Activity methods. Aditional informations: BaseClass extends android.app.Activity; BaseClass and SocialNetworkClass are abstract classes; My intention with this hierarchy is produce less code (and reuse code). Could anyone help me, please? Thanks a lot!
has comment: http://stackoverflow.com/comment/38805773
tagged with: android-activity
has comment: http://stackoverflow.com/comment/38771386

google-app-engine
tags question: http://stackoverflow.com/q/25021775
tag name: google-app-engine
tags question: http://stackoverflow.com/q/25008594
type: Tag
tags question: http://stackoverflow.com/q/24987944
tags question: http://stackoverflow.com/q/25042502
tags question: http://stackoverflow.com/q/25041716
tags question: http://stackoverflow.com/q/24987894
tags question: http://stackoverflow.com/q/24940092
tags question: http://stackoverflow.com/q/24910427
tags question: http://stackoverflow.com/q/24976072
tags question: http://stackoverflow.com/q/25050907
tags question: http://stackoverflow.com/q/25030639
tags question: http://stackoverflow.com/q/24950178
tags question: http://stackoverflow.com/q/25051094
tags question: http://stackoverflow.com/q/24924558
tags question: http://stackoverflow.com/q/24910066
tags question: http://stackoverflow.com/q/24965751
tags question: http://stackoverflow.com/q/24952028
tags question: http://stackoverflow.com/q/24965261
tags question: http://stackoverflow.com/q/25017600
tags question: http://stackoverflow.com/q/25009293
tags question: http://stackoverflow.com/q/24946972
tags question: http://stackoverflow.com/q/24955392
tags question: http://stackoverflow.com/q/24947098
tags question: http://stackoverflow.com/q/25020895
tags question: http://stackoverflow.com/q/25051419
tags question: http://stackoverflow.com/q/25046225

fft
tags question: http://stackoverflow.com/q/25025927
tags question: http://stackoverflow.com/q/24929341
type: Tag
tag name: fft

http://stackoverflow.com/comment/38885523
score: 0
comment on: http://stackoverflow.com/q/25008119
type: QuestionComment
has text: Nothing difficult here. Convert it to an array of two columns and sort all rows by the 1st column. At the most you will need a custom Comporator.
type: Comment

http://stackoverflow.com/comment/39111669
comment on: http://stackoverflow.com/a/25124669
type: AnswerComment
has text: Looks like there is a differences between someone who documented it and someone who coded a server side :)
type: Comment
score: 1

http://stackoverflow.com/comment/38820789
score: 1
has text: How are you going to convert from `Object` to `String`? Do you need to call `toString()` on each? Or do you have some a priori knowledge that the objects are `String`?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24973624

http://stackoverflow.com/comment/38825355
comment on: http://stackoverflow.com/q/24976142
score: 0
type: QuestionComment
type: Comment
has text: or any hint for implementing this?

http://stackoverflow.com/q/24912430
linked to: http://stackoverflow.com/q/7771888
has comment: http://stackoverflow.com/comment/87720860
tagged with: java
upvote count: 6
has title: JCIFS - connection breaks
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/43187177
has comment: http://stackoverflow.com/comment/65746087
has comment: http://stackoverflow.com/comment/64864853
favorite count: 0
has answer: http://stackoverflow.com/a/50348113
tagged with: jcifs
downvote count: 0
has comment: http://stackoverflow.com/comment/47460635
type: UnansweredQuestion
score: 6
has body: I need to connect to a UNC "directory" and to create a file in that directory. I found this entry on stackoverflow : access to file using Java with Samba JCIFS. A good thing is that it works well on my system, but when I put the program to the server I get the following exception : Exception in thread "main" jcifs.smb.SmbException: Failed to connect: &lt;serverName&gt; jcifs.util.transport.TransportException: Connection in error jcifs.util.transport.TransportException java.net.ConnectException: Connection timed out: 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 jcifs.smb.SmbTransport.ssn139(SmbTransport.java:196) at jcifs.smb.SmbTransport.negotiate(SmbTransport.java:249) at jcifs.smb.SmbTransport.doConnect(SmbTransport.java:322) at jcifs.util.transport.Transport.run(Transport.java:241) at java.lang.Thread.run(Unknown Source) at jcifs.util.transport.Transport.run(Transport.java:258) at java.lang.Thread.run(Unknown Source) at jcifs.util.transport.Transport.connect(Transport.java:154) at jcifs.smb.SmbTransport.connect(SmbTransport.java:307) at jcifs.smb.SmbTree.treeConnect(SmbTree.java:156) at jcifs.smb.SmbFile.doConnect(SmbFile.java:911) at jcifs.smb.SmbFile.connect(SmbFile.java:954) at jcifs.smb.SmbFile.connect0(SmbFile.java:880) at jcifs.smb.SmbFile.open0(SmbFile.java:972) at jcifs.smb.SmbFile.open(SmbFile.java:1006) at jcifs.smb.SmbFileOutputStream.&lt;init&gt;(SmbFileOutputStream.java:142) at jcifs.smb.SmbFileOutputStream.&lt;init&gt;(SmbFileOutputStream.java:97) at jcifs.smb.SmbFileOutputStream.&lt;init&gt;(SmbFileOutputStream.java:67) at path.unc.TestUNC.main(TestUNC.java:79) at jcifs.smb.SmbTransport.connect(SmbTransport.java:309) at jcifs.smb.SmbTree.treeConnect(SmbTree.java:156) a…

http://stackoverflow.com/comment/38737995
type: Comment
has text: @laune - Apparently the 0 0 0 0 is caused by the `byte [] textSetting =new byte [5];` and `4` is because it is a Signal that I use to send to my microcontroller side to be able to display on a LED Panel. When I tried to change to `byte [] textSetting =new byte [2];` it shows a 0x04 0x00 0x34 0x35 0x36 0x39 Mind elaborating on the + msg + ?
comment on: http://stackoverflow.com/q/24928785
type: QuestionComment
score: 0

http://stackoverflow.com/comment/38831520
comment on: http://stackoverflow.com/q/24979362
type: Comment
type: QuestionComment
score: 0
has text: yeah , i found alot of tutorial for a simple adapter but does not work on my custom adapter :(

http://stackoverflow.com/comment/38832834
has text: I guess property key name and `<param-name>` have to be same, As you your code says `System.setProperty(prop, propsFromFile.getProperty(prop));`
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24980063

http://stackoverflow.com/comment/38981911
type: Comment
comment on: http://stackoverflow.com/a/25040806
type: AnswerComment
score: 0
has text: yes it might be better to simplify this when i'll have time for it. Thanks a lot for taking some time to help

http://stackoverflow.com/q/25004910
tagged with: java
tagged with: slick2d
has answer: http://stackoverflow.com/a/25011064
answer count: 1
accepted answer: http://stackoverflow.com/a/25011064
has title: How do I create text with different colors
has body: I currently use this line: font.drawString(Display.getWidth()/2 - offset, height, "Hi, Stackoverflow!", Color.yellow); However, that only allows for me to use one colour per message. Whereas, I would like to have a line like this: font.drawString(Display.getWidth()/2 - offset, height, BLUE TEXT HERE + "Team A score: " + score + RED TEXT HERE + " || " + YELLOW TEXT HERE + "Team B score: " + score, Color.yellow); The variable font is of type UnicodeFont. @SuppressWarnings("unchecked") static void setUpFonts() { java.awt.Font awtFont = new java.awt.Font("Times New Roman", java.awt.Font.BOLD, 18); font = new UnicodeFont(awtFont); font.getEffects().add(new ColorEffect(java.awt.Color.white)); font.addAsciiGlyphs(); try { font.loadGlyphs(); } catch (SlickException e) { e.printStackTrace(); cleanUp(); } } Would be nice if there was a solution that did not require multiple messages.
type: AnsweredQuestion
score: 0
type: Question

http://stackoverflow.com/a/25017994
has body: Use .equals() as opposed to == when comparing objects. == will compare the objects' references, whereas .equals() will check to see if they have the same values. Since two objects will very rarely have the same reference you should never use == except for comparing primitive types (int, char, but String is not a primitive type!) where it doesn't matter. So you want: if (pkPublicExBI.equals(pkPublicExBIrecreated)) { Instead of if (pkPublicExBI == pkPublicExBIrecreated) {
has comment: http://stackoverflow.com/comment/38904743
upvote count: 2
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38975660
accepted answer of: http://stackoverflow.com/q/25017930
type: Answer
answers question: http://stackoverflow.com/q/25017930
score: 2
downvote count: 0

http://stackoverflow.com/comment/38862458
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24995964
score: 1
has text: That is because the `Label` component is not thread-safe. Therefore, you cannot directly update it from a thread that it was not created on

android
tags question: http://stackoverflow.com/q/24966753
tags question: http://stackoverflow.com/q/25024575
tags question: http://stackoverflow.com/q/24949161
tags question: http://stackoverflow.com/q/24973059
tags question: http://stackoverflow.com/q/24915686
tags question: http://stackoverflow.com/q/25007402
tags question: http://stackoverflow.com/q/24998257
tags question: http://stackoverflow.com/q/25031563
tags question: http://stackoverflow.com/q/25020535
tags question: http://stackoverflow.com/q/24924463
tags question: http://stackoverflow.com/q/24982248
tags question: http://stackoverflow.com/q/25012055
tags question: http://stackoverflow.com/q/25016930
tags question: http://stackoverflow.com/q/24987990
tags question: http://stackoverflow.com/q/24924143
tags question: http://stackoverflow.com/q/25012893
tags question: http://stackoverflow.com/q/24979926
tags question: http://stackoverflow.com/q/24990094
tags question: http://stackoverflow.com/q/25009293
tags question: http://stackoverflow.com/q/24953739
tags question: http://stackoverflow.com/q/24940313
tags question: http://stackoverflow.com/q/25060962
tags question: http://stackoverflow.com/q/24914287
tags question: http://stackoverflow.com/q/24930552
tags question: http://stackoverflow.com/q/25064391
tags question: http://stackoverflow.com/q/24987289
tags question: http://stackoverflow.com/q/24995953
tags question: http://stackoverflow.com/q/24978654
tags question: http://stackoverflow.com/q/24917839
tags question: http://stackoverflow.com/q/24987587
tags question: http://stackoverflow.com/q/24961946
tags question: http://stackoverflow.com/q/25004508
tags question: http://stackoverflow.com/q/25003526
tags question: http://stackoverflow.com/q/25007126
tags question: http://stackoverflow.com/q/24979839
tags question: http://stackoverflow.com/q/24979035
tags question: http://stackoverflow.com/q/24965825
tags question: http://stackoverflow.com/q/25032449
tags question: http://stackoverflow.com/q/24941832
tags question: http://stackoverflow.com/q/24982318
tags question: http://stackoverflow.com/q/24992670
tags question: http://stackoverflow.com/q/25046392
tags question: http://stackoverflow.com/q/25061063
tags question: http://stackoverflow.com/q/24920014
tags question: http://stackoverflow.com/q/25040753
tags question: http://stackoverflow.com/q/24925940
tags question: http://stackoverflow.com/q/24970039
tags question: http://stackoverflow.com/q/24962479
tags question: http://stackoverflow.com/q/24966196
tags question: http://stackoverflow.com/q/25065518
tags question: http://stackoverflow.com/q/25058183
tags question: http://stackoverflow.com/q/25025230
tags question: http://stackoverflow.com/q/24983373
tags question: http://stackoverflow.com/q/24991805
tags question: http://stackoverflow.com/q/24919806
tags question: http://stackoverflow.com/q/25040331
tags question: http://stackoverflow.com/q/25027006
tags question: http://stackoverflow.com/q/24996791
tags question: http://stackoverflow.com/q/24911649
tags question: http://stackoverflow.com/q/25035523
tags question: http://stackoverflow.com/q/25001716
tags question: http://stackoverflow.com/q/24968992
tags question: http://stackoverflow.com/q/25041625
tags question: http://stackoverflow.com/q/25068799
tags question: http://stackoverflow.com/q/25044632
tags question: http://stackoverflow.com/q/24980097
tags question: http://stackoverflow.com/q/24956532
tags question: http://stackoverflow.com/q/24917110
tags question: http://stackoverflow.com/q/25012265
tags question: http://stackoverflow.com/q/25006403
tags question: http://stackoverflow.com/q/25042663
tags question: http://stackoverflow.com/q/24943921
tags question: http://stackoverflow.com/q/24932665
tags question: http://stackoverflow.com/q/24959747
tags question: http://stackoverflow.com/q/24938900
tags question: http://stackoverflow.com/q/25028259
tags question: http://stackoverflow.com/q/24965841
tags question: http://stackoverflow.com/q/24960455
tags question: http://stackoverflow.com/q/25012675
tags question: http://stackoverflow.com/q/24947477

http://stackoverflow.com/q/25037092
downvote count: 0
favorite count: 0
has body: I'm trying to use the ConfirmListener but the execution never reaches its methods. I'm doing it like this: channel.addConfirmListener(new ConfirmListener() { public void handleNack(long deliveryTag, boolean multiple) throws IOException { System.out.println("Not ack received"); } public void handleAck(long deliveryTag, boolean multiple) throws IOException { System.out.println("Ack received"); } }); channel.exchangeDeclare(directExchangeName, directExchangeType, DURABLE, AUTO_DELETE, arguments); channel.queueBind(directQueueName, directExchangeName, routingKey); // AUTO_ACK = false channel.basicConsume(directQueueName, AUTO_ACK, routingKey, directConsumer); Then I publish with this: channel.basicPublish(directExchangeName, routingKey, MANDATORY, properties, message.getBytes()); And later I consume with this: @Override public void handleDelivery(String consumerTag, Envelope envelope, AMQP.BasicProperties properties, byte[] body) throws IOException { // Send ack channel.basicAck(envelope.getDeliveryTag(), false); } What I'm doing wrong? Thanks, cheers.
has title: Rabbitmq Confirm Listener does not work
tagged with: rabbitmq
type: AnsweredQuestion
upvote count: 2
tagged with: java
has answer: http://stackoverflow.com/a/25239962
type: Question
accepted answer: http://stackoverflow.com/a/25239962
score: 2
answer count: 1

http://stackoverflow.com/q/25003891
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml
score: 1
has answer: http://stackoverflow.com/a/25004186
upvote count: 1
has title: Unmarshalling empty tag into new instances of collections
type: AnsweredQuestion
tagged with: java
tagged with: jaxb
has comment: http://stackoverflow.com/comment/38878170
type: Question
accepted answer: http://stackoverflow.com/a/25004186
answer count: 1
downvote count: 0
has body: I am trying to unmarshal something like below into their JAXB equivalents, and the fields are as expected being populated with nulls XML &lt;University&gt; &lt;StudentFirstNames/&gt; &lt;/University&gt; JAXB POJO public class University { List&lt;StudentFirstNames&gt; studentFirstNames = null; public void getStudentFirstNames() { return studentFirstNames } public void setStudentFirstNames() { this.studentFirsNames = studentFirstNames; } } After unmarshalling I am returned back null when I lookup the member in the JAXB object university.getStudentFirstNames() --&gt; null In this specific situation I am trying to resolve, I need to replace empty tags with new instance of that particular type. For example in the above, I am expecting back a new ArrayList () instead of null. I know this sounds counter intuitive but that is what I have to do for satisying code downstream. Is there a global fix to resolve such instances. Thanks in advance.

http://stackoverflow.com/q/24962150
duplicate of: http://stackoverflow.com/q/5752307
downvote count: 1
type: Question
upvote count: 0
tagged with: get
has answer: http://stackoverflow.com/a/24962183
answer count: 1
has comment: http://stackoverflow.com/comment/38799211
has title: I want to get the text from a JTextField
favorite count: 0
has comment: http://stackoverflow.com/comment/38799299
tagged with: field
type: UnansweredQuestion
tagged with: input
has comment: http://stackoverflow.com/comment/38799274
tagged with: text
linked to: http://stackoverflow.com/q/5752307
has body: I'm trying to code a game where the user try's to guess a number, randomly generated between 1 and 10, I need to know how to get the text from the JTextField JFrame frame = new JFrame("The Guessing Game"); frame.setVisible(true); frame.setSize(400, 300); frame.setDefaultCloseOperation(EXIT_ON_CLOSE); JPanel panel = new JPanel(); JButton rndbutton = new JButton("Click to create random nubmer!"); panel.add(rndbutton); frame.add(panel); JTextField tField = new JTextField(15); panel.add(tField); //^^ The GUI code ^^ game.game(); } }
tagged with: java
score: -1

http://stackoverflow.com/q/24949953
has body: i want to show listview in popupmenu ? i build initializeVars() method for listview how icall this method on my showPopupMenu(View v) tell me solution of this program public void initializeVars(){ lv_sample = (ListView)findViewById(R.id.lv_sample); adapter = new ArrayAdapter&lt;String&gt;(this, R.layout.setlanguage, R.id.tv_content, values); if(adapter==null) return; lv_sample.setAdapter(adapter); } private void showPopupMenu(View v){ PopupMenu popupMenu = new PopupMenu(MainActivity.this, v); popupMenu.getMenuInflater().inflate(R.menu.main, popupMenu.getMenu()); popupMenu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() { public boolean onMenuItemClick(MenuItem item) { Toast.makeText(MainActivity.this, item.toString(), Toast.LENGTH_LONG).show(); return true; } }); popupMenu.show();
score: -1
downvote count: 2
has title: How I call my ownMethod in Popup Menu
upvote count: 1
answer count: 1
favorite count: 0
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/24951039
tagged with: java
type: Question

http://stackoverflow.com/a/24982926
has comment: http://stackoverflow.com/comment/43811241
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/43812955
upvote count: 2
accepted answer of: http://stackoverflow.com/q/24982772
answers question: http://stackoverflow.com/q/24982772
has comment: http://stackoverflow.com/comment/43809044
has body: Oracle now manages the UI delegates used by the Apple Look &amp; Feel as part of OpenJDK, com.apple.laf.AquaLookAndFeel You can see the sources here, but you may want to wait for Oracle to incorporate them into a future build.
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/38934174
score: 2
has text: Note that `System.gc()` does *not* guarantee that the GC is run. Especially in your case, where `System.gc()` is probably called with sub-millisecond intervals, the VM may decide to defer the GC run to some arbitrary time; usually to when available memory becomes low by some measure.
comment on: http://stackoverflow.com/q/25033458
type: Comment
type: QuestionComment

imagebutton
tags question: http://stackoverflow.com/q/24982432
tags question: http://stackoverflow.com/q/24943921
tags question: http://stackoverflow.com/q/24947395
type: Tag
tag name: imagebutton

http://stackoverflow.com/comment/38978324
type: Comment
has text: In java i can assume there in an abstraction. I dont know of a <<< or >>> in c or c++. But if you try my example with a negative. you get what you expect. -4 << 2 = -16 just as 4 << 2 = 16. Though it makes no sense to me logically. it seems to be the answer i get. So what i meant by masking is. I have used x << 2^x to square numbers but then i always mask it to be a positive number. because my intent is to square.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25057343

http://stackoverflow.com/comment/38851573
type: Comment
has text: @DavidWallace You are right although the OP does not specify whether the `list` is the result of gathering the raw input the user provides, which could result in hazardous SQL injection situations for the two answers you mention, or if it is composed by his/her program indirectly. Case, the latter, where SQL injection could not be possible.
comment on: http://stackoverflow.com/a/24953286
score: 0
type: AnswerComment

http://stackoverflow.com/q/24972268
has comment: http://stackoverflow.com/comment/38818256
has comment: http://stackoverflow.com/comment/38818303
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/24972309
downvote count: 1
has answer: http://stackoverflow.com/a/24972303
type: Question
has body: Update :: I have changed my code a bit but still bug with lines.get(0) which makes my app crashed again. final List&lt;String&gt; lines = new ArrayList&lt;String&gt;(); String line; int i = 0; BufferedReader buffreader = null; try { buffreader = new BufferedReader( new InputStreamReader(getAssets().open("test.txt"))); while((line = buffreader.readLine()) != null) { lines.add(line); i++; } } catch (IOException e) { }
possible better answer: http://stackoverflow.com/a/24972309
score: -1
answer count: 2
upvote count: 0
accepted answer: http://stackoverflow.com/a/24972303
has title: Read File from text file on Android doesn't work
favorite count: 0
tagged with: android

http://stackoverflow.com/comment/38795386
comment on: http://stackoverflow.com/q/24960162
score: 0
type: Comment
has text: Based on the title I thought I'd have my first close as dupe of the day. You should just be able to call sendMessage in the doInBackground() function. Its probably best to create the message you want to send in onPreExecute, then send it in doInBackground so there's no synchronization errors around the classes you want to use to generate the parameters. But I think to give more help than that you need to be a little more specific about what your problem is.
type: QuestionComment

http://stackoverflow.com/a/24972141
has body: The problem is with placing braces in wrong position.Just replace the addnode method with this one public void addnode(int key, String name) { Node newNode = new Node(key, name); if (root == null) { root = newNode; System.out.println("Inserted : "+newNode); } else { Node focusNode = root; Node parent; while (true) { parent = focusNode; if (key &lt; focusNode.key) { focusNode = focusNode.leftChild; if (focusNode == null) { parent.leftChild = newNode; System.out.println("Inserted : "+newNode); return; } } else { focusNode = focusNode.rightChild; if (focusNode == null) { parent.rightChild = newNode; System.out.println("Inserted : "+newNode); return; } } } } }
type: Answer
score: 0
answers question: http://stackoverflow.com/q/24971570

http://stackoverflow.com/comment/38919352
type: Comment
type: AnswerComment
has text: yet another question if you don't mind. it works properly, but when i press pause button on the 4th second for example, it still updates the textview to 5, i guess because the message for the handler is already in the queue, and then stops updating, how can i solve this problem?
comment on: http://stackoverflow.com/a/25025631
score: 0

http://stackoverflow.com/comment/38911855
comment on: http://stackoverflow.com/a/25021644
score: 0
type: AnswerComment
type: Comment
has text: thanks for your help, you teach me the immutable and mutable concept clearly!

http://stackoverflow.com/a/25035549
type: Answer
answers question: http://stackoverflow.com/q/25035413
score: 1
upvote count: 1
downvote count: 0
has body: When you use a type argument T which extends Number class,then T represents a class which extends Number class.Please note that comparison operators can only be used for primitives,not for classes (unless it is wrapped to its corresponding class,say int is wrapped to Integer).Since,the compiler cannot ascertain whether you are using a wrapper class(Long,Integer,Double,Float etc) or a user defined class which extends Number ,it gives compile time error. Example:- class MyNumber extends Number{ } Objects of MyNumber class do not understand > operator.Please use a comparator for comparing Objects.

http://stackoverflow.com/comment/38865132
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/24996436
type: Comment
has text: Pass the element by locator to this function.. that is source element to mainmenu and destination element to submenu..

http://stackoverflow.com/a/24989045
has comment: http://stackoverflow.com/comment/38849897
has comment: http://stackoverflow.com/comment/38849964
has body: myTextView.setHint("My conditional hint");
type: Answer
has comment: http://stackoverflow.com/comment/38855783
has comment: http://stackoverflow.com/comment/38851557
answers question: http://stackoverflow.com/q/24989022
score: 1
upvote count: 1
downvote count: 0

http://stackoverflow.com/comment/38761755
type: Comment
type: QuestionComment
has text: Phesmo hit the nail on the head. Changed it to a string and it worked. Thanks a lot man. I was stuck for days on the simple issue.
comment on: http://stackoverflow.com/q/24939213
score: 0

http://stackoverflow.com/comment/38963561
score: 0
comment on: http://stackoverflow.com/a/25048224
type: Comment
has text: hi,how can i print `regexMatcher.group(1)`
type: AnswerComment

http://stackoverflow.com/q/25048385
has comment: http://stackoverflow.com/comment/38962062
tagged with: concurrency
type: Question
has comment: http://stackoverflow.com/comment/38977171
has comment: http://stackoverflow.com/comment/38962083
score: 5
answer count: 1
favorite count: 0
has title: Deterministic assignment of tasks to threads using ExecutorService
has comment: http://stackoverflow.com/comment/38961817
tagged with: executorservice
has comment: http://stackoverflow.com/comment/38961845
has answer: http://stackoverflow.com/a/25049590
accepted answer: http://stackoverflow.com/a/25049590
upvote count: 5
tagged with: multithreading
has comment: http://stackoverflow.com/comment/38962452
type: AnsweredQuestion
downvote count: 0
has body: Given Executor service with a fixed pool of threads, is it possible to guarantee deterministic assignment of tasks to threads? More precisely, assume there are just two threads, namely pool-thread-0 and pool-thread-1 and there is a collection of 2 tasks to be executed. What I wish to achieve is that the former thread always executes the first one, while the latter handles the remaining one. Here is an example: public static void main(String[] args) throws InterruptedException, ExecutionException { ExecutorService executorService = newFixedThreadPool(2, new ThreadFactoryBuilder().setNameFormat("pool-thread-%d").build()); for (int i = 0; i &lt; 5; i++) { List&lt;Callable&lt;Integer&gt;&gt; callables = ImmutableList.of(createCallable(1), createCallable(2)); executorService.invokeAll(callables); } } public static Callable&lt;Integer&gt; createCallable(final int task) { return new Callable&lt;Integer&gt;() { @Override public Integer call() throws Exception { currentThread().sleep(1000); System.out.println(Thread.currentThread().getName() + " executes task num: " + task); return task; } }; } Exemplary output from my machine: pool-thread-0 executes task num: 1 pool-thread-1 executes task num: 2 pool-thread-0 executes task num: 2 pool-thread-1 executes task num: 1 pool-thread-0 executes task num: 2 pool-thread-1 executes task num: 1 pool-thread-0 executes task num: 2 pool-thread-1 executes task num: 1 pool-thread-0 executes task num: 1 pool-thread-1 executes task num: 2 In a nutshell, I wish to ensure that pool-thread-0 always executes the first task. Any help will be greatly appreciated!
tagged with: java

http://stackoverflow.com/comment/38753553
has text: possible duplicate of [Can one class extend two classes?](http://stackoverflow.com/questions/6587621/can-one-class-extend-two-classes)
score: 0
comment on: http://stackoverflow.com/q/24937901
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25008939
has title: execute query on table that contains billions of record
linked to: http://stackoverflow.com/q/9013177
has comment: http://stackoverflow.com/comment/38891154
duplicate of: http://stackoverflow.com/q/9013177
type: Question
has comment: http://stackoverflow.com/comment/38893084
tagged with: java
has comment: http://stackoverflow.com/comment/38895042
has comment: http://stackoverflow.com/comment/38887891
has comment: http://stackoverflow.com/comment/38889708
has answer: http://stackoverflow.com/a/25009683
score: 0
answer count: 2
has body: I want to fetch some record(it can be 50,100 or something else that is configured by user) from database without using limit clause because our application may be work on multiple database like mysql,oracle,mssql,db2.... i did following solution package com.test; import java.sql.Connection; import java.sql.Statement; import java.sql.ResultSet; import java.sql.DriverManager; import java.util.Date; public class BatchRetrieveTest extends Object { private static final int FETCH_SIZE = 10; public BatchRetrieveTest() { } public static void main(String[] args) { BatchRetrieveTest batchRetrieveTest = new BatchRetrieveTest(); batchRetrieveTest.test(); } void test() { Connection conn = null; Statement stmt2 = null; Date start = null; Date end = null; int i = 0; try { conn = DriverManager.getConnection( "jdbc:mysql://localhost:3306/test", "root", "root"); stmt2 = conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_READ_ONLY); conn.setAutoCommit(false); stmt2.setFetchSize(FETCH_SIZE); stmt2.setPoolable(true); start = new Date(); System.out.println(new Date() + "second execute start" + new Date().getTime()); ResultSet rs2 = stmt2 .executeQuery("SELECT * FROM sample_final_attendance limit 1000"); end = new Date(); System.out.println(new Date() + "*************second execute end" + (end.getTime() - start.getTime())); rs2.absolute(200000); i = 0; while (rs2.next()) { if (i++ &gt; 100) { break; } } rs2.close(); stmt2.close(); end = new Date(); System.out.println(new Date() + "second read end" + (end.getTime() - start.getTime())); conn.close(); } catch (Exception e) { e.printStackTrace(); } finally { try { stmt2.close(); conn.close(); } catch (Exception e) { } } } } Here sample_final_attendance table contains 15 columns and 3.2 millions of record while executing this program it requires 2GB of memory and 47 seconds of execution time here i wonder that if some table has billions of record then it fails to execute also i used setFetchSize as suggested but problem is …
has comment: http://stackoverflow.com/comment/38895656
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25010164
tagged with: jdbc

http://stackoverflow.com/comment/38732241
comment on: http://stackoverflow.com/q/24925204
score: 0
type: Comment
type: QuestionComment
has text: What issue are you facing, did you try to implement his suggested change?

http://stackoverflow.com/a/24935594
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/24935480
type: Answer
has body: Implement equals (and hashCode) for Person, so two objects are equal if the 3 attributes are equal. Then, create a temporary Set from the ArrayList. If the set has fewer elements than the list, you have duplicates.
upvote count: 1

http://stackoverflow.com/comment/38948336
has text: No, knowing the date format is not possible, hence trying to find out different options. Can you suggest any other alternative other than using a `|` ?
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25041227

http://stackoverflow.com/comment/38814095
type: AnswerComment
comment on: http://stackoverflow.com/a/24968975
type: Comment
has text: @laune: Which kinda puts the lie to my *"In fact, your assignment in the loop you've shown isn't overwriting the previous value at all."* :-) (In purely pragmatic terms.)
score: 0

http://stackoverflow.com/q/25001500
has comment: http://stackoverflow.com/comment/38874559
has comment: http://stackoverflow.com/comment/38873485
type: Question
has comment: http://stackoverflow.com/comment/38873220
has answer: http://stackoverflow.com/a/25002785
downvote count: 0
answer count: 1
favorite count: 0
type: UnansweredQuestion
tagged with: cryptography
has title: Trying to compare my two hash values. Both in big integer form
has comment: http://stackoverflow.com/comment/38873224
score: 2
has comment: http://stackoverflow.com/comment/38882465
upvote count: 2
has body: Am trying to compare two values, hcB has been hashed then exponentiation is done on the value, and hci is doing the inverse of exp value. then comparing. They should be equal but are not. public class Hash { static MessageDigest sha1; private static final int unitLength = 160; // SHA-1 has 160-bit output. public static void main(String[] args)throws Exception { String s = new String("hello"); BigInteger b =new BigInteger(s.getBytes()); // Big integer conversion MessageDigest sha1 = MessageDigest.getInstance("SHA-1"); sha1.reset(); sha1.update(s.getBytes()); byte[] hc = sha1.digest(); BigInteger hcB=new BigInteger(1,hc); KeyGenerator keyRC=new KeyGenerator(); try { keyRC.initialize();//generating key BigInteger HashClValueExp=hcB.modPow(keyRC.RC, keyRC.p);// exponentiate of hashed value System.out.println("HasheCldExp Value: "+HashClValueExp); //Inverse RC BigInteger inv = keyRC.RC.modInverse(keyRC.q); System.out.println("Inverse RC: " + inv); // Hash value inverse computation BigInteger hci = HashClValueExp.modPow(inv, keyRC.p); System.out.println("hci: " + hci); // prints in hex System.out.println("hcB: " + hcB); System.out.println("Compare hci and hcB :" + hci.compareTo(hcB)); } catch (Exception e) { e.printStackTrace(); } } }
tagged with: java

http://stackoverflow.com/comment/38740250
score: 0
type: Comment
type: QuestionComment
has text: Just found out that I ain't using it anyway. proguard.config=[...] is commented out in project.properties.
comment on: http://stackoverflow.com/q/24930782

http://stackoverflow.com/comment/38767167
score: 0
comment on: http://stackoverflow.com/a/24940867
type: Comment
has text: i can, but then this will mess up other classes uses `executeAsync()` because this method comes from the facebook sdk
type: AnswerComment

http://stackoverflow.com/comment/38932992
comment on: http://stackoverflow.com/a/25031647
type: AnswerComment
type: Comment
has text: This could be a possible solution, however I want my tests to be as independent as possible and therefore drop my complete database after every test. I solved the problem on my own, I'll add it as an answer
score: 0

http://stackoverflow.com/a/25036875
has body: I have modified the code for you just take a look:import java.util.Random; class Die{ int dots,roll; Random number = new Random(); public Die(){ dots = number.nextInt(6)+1 ; } public void roll(){ roll = number.nextInt(dots)+1; } public int getDots(){ return roll; } } public class Uppg1 { public static void main (String args[]){ Die die = new Die(); die.roll(); System.out.println("Du fick" +die.getDots()); } } remove int from Die constructor as it already defined as global, your prog. doesn't call roll method anywhere hence need to call that.
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/25036505
downvote count: 0
type: Answer

http://stackoverflow.com/a/24984286
downvote count: 0
has body: You could pass an array : public void method (int[] params) This would still require that you allocate an array of n elements, where n is the max number of potential parameters, and could be wasteful for a large n. It also requires that you have a default empty value (such as 0), that tells you a certain position in the array has no value. int[] params = new int[13]; params[0] = value1; params[3] = value4; params[4] = value5; method (params); Or you could pass a List : public void method (List&lt;Integer&gt; params) Or you could pass a Map : public void method (Map&lt;Integer,Integer&gt; params) The latter would be the most eficient if you have a large number of optional parameters, and you want to pass just few of them : Map map = new HashMap&lt;Integer,Integer&gt;(); map.put (5, value5); map.put (13, value13); method (map);
accepted answer of: http://stackoverflow.com/q/24984264
score: 1
answers question: http://stackoverflow.com/q/24984264
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38844792
type: Answer
has comment: http://stackoverflow.com/comment/38845359

http://stackoverflow.com/comment/38980481
type: Comment
comment on: http://stackoverflow.com/q/25056549
score: 0
type: QuestionComment
has text: I have updated the question .Please check

http://stackoverflow.com/q/25030413
has answer: http://stackoverflow.com/a/25030515
score: 0
tagged with: oracle-database
tagged with: sql
has comment: http://stackoverflow.com/comment/38927716
linked to: http://stackoverflow.com/q/2225221
has title: How to solve ORA-12516 error?
has comment: http://stackoverflow.com/comment/38933925
tagged with: error-handling
type: AnsweredQuestion
has body: I am using oracle database 10g express edition. Recently I am facing ORA-12516 error frequently. It says -- "java.sql.SQLException: Listener refused the connection with the following error: ORA-12516, TNS:listener could not find available handler with matching protocol stack The Connection descriptor used by the client was: //127.0.0.1:1521/XE" As far as I am concerned this error is shown when user doesn't close variables like "Statement" "Resultset" and opens a lot of them. Every time I created any "Statement" or "ResultSet" type variables in a function I used this function -- http://paste.ubuntu.com/7902053/ to close those variables. I didn't close those variables in a final block of the function inside which those were declared. Instead I called this function (close_calls(..)) to close those variables and sent them as parameters inside the function close_calls(..). For example I called the function given above in no 17 and 23 line here -- http://paste.ubuntu.com/7902114/ But this error is still shown in the console. Is close_call(...) not working ? How can I get rid of this error ? I got the idea of closing those variables from here --- Closing Database Connections in Java
tagged with: java
accepted answer: http://stackoverflow.com/a/25030515
type: Question
answer count: 1

http://stackoverflow.com/comment/60765818
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27097243
has text: do you have a documentation for implementing java RESTful client using hapi? Unfortunately the documents are not rich enough!
type: AnswerComment

user-interface
tags question: http://stackoverflow.com/q/24979898
tags question: http://stackoverflow.com/q/24943190
tags question: http://stackoverflow.com/q/24993240
tags question: http://stackoverflow.com/q/25044143
tags question: http://stackoverflow.com/q/25037139
tags question: http://stackoverflow.com/q/25005935
tags question: http://stackoverflow.com/q/24980980
tags question: http://stackoverflow.com/q/24997280
tags question: http://stackoverflow.com/q/25014700
tags question: http://stackoverflow.com/q/24924658
tags question: http://stackoverflow.com/q/25057740
type: Tag
tags question: http://stackoverflow.com/q/25038117
tags question: http://stackoverflow.com/q/25009001
tags question: http://stackoverflow.com/q/24976918
tags question: http://stackoverflow.com/q/25058094
tags question: http://stackoverflow.com/q/25002801
tags question: http://stackoverflow.com/q/24994261
tags question: http://stackoverflow.com/q/25053057
tags question: http://stackoverflow.com/q/24929011
tags question: http://stackoverflow.com/q/24962793
tags question: http://stackoverflow.com/q/24980539
tags question: http://stackoverflow.com/q/25067871
tags question: http://stackoverflow.com/q/25062983
tags question: http://stackoverflow.com/q/24982202
tags question: http://stackoverflow.com/q/24958869
tags question: http://stackoverflow.com/q/25008764
tags question: http://stackoverflow.com/q/25028884
tags question: http://stackoverflow.com/q/24948004
tags question: http://stackoverflow.com/q/25021297
tags question: http://stackoverflow.com/q/24961717
tags question: http://stackoverflow.com/q/24956245
tags question: http://stackoverflow.com/q/24909882
tags question: http://stackoverflow.com/q/25026458
tags question: http://stackoverflow.com/q/24974099
tags question: http://stackoverflow.com/q/24971180
tags question: http://stackoverflow.com/q/24973077
tags question: http://stackoverflow.com/q/24932977
tags question: http://stackoverflow.com/q/25054903
tags question: http://stackoverflow.com/q/24986736
tags question: http://stackoverflow.com/q/25021576
tags question: http://stackoverflow.com/q/25011882
tags question: http://stackoverflow.com/q/25068749
tags question: http://stackoverflow.com/q/24970760
tags question: http://stackoverflow.com/q/25057147
tag name: user-interface
tags question: http://stackoverflow.com/q/24944237
tags question: http://stackoverflow.com/q/25000035
tags question: http://stackoverflow.com/q/25032880
tags question: http://stackoverflow.com/q/25033781

http://stackoverflow.com/q/24967533
linked to: http://stackoverflow.com/q/2211990
possible better answer: http://stackoverflow.com/a/24972486
tagged with: big-o
has answer: http://stackoverflow.com/a/24972486
tagged with: primes
type: AnsweredQuestion
tagged with: java
tagged with: sieve-of-eratosthenes
tagged with: queue
type: Question
has comment: http://stackoverflow.com/comment/39125080
has body: for this assignment, I have to create a program that finds and returns a queue of all prime numbers up to integer n using the Sieve of Eratosthenes. While I got it to work, I am still pondering about the big O for my code. It seems like I've nested too many loops into it making it run too slow when calculating very large numbers. For instance, calculating: Queue&lt;Integer&gt; q = PrimeQueue.getPrimes(1234567); Takes nearly three minutes! What I'm asking is: Is such a long run-time expected for a task such as this? Is there is a more process-friendly way to do this within the confines of this assignemnt(While still using two queues and returning one of them)? What is the complexity class of this program? Thanks! Here's my code: public static Queue&lt;Integer&gt; getPrimes(int n) { if (n &lt; 2) { // If illegal argument throw new IllegalArgumentException("n can't be less than 2."); } Queue&lt;Integer&gt; numbers = new LinkedList&lt;Integer&gt;(); Queue&lt;Integer&gt; primes = new LinkedList&lt;Integer&gt;(); // fills queue w/ numbers from 2 to n inclusive // throw exception if n &lt; 2 for (int i = 2; i &lt;= n; i++) { numbers.add(i); } do { // do while b/c it will always execute once int prime = numbers.remove(); // gets first prime number from first value of numbers primes.add(prime); // adds to the prime int numbersSize = numbers.size(); // used to keep track when looping over the numbers queue for (int i = 0; i &lt; numbersSize; i++) { // goes through each number to elim multiples of prime int numTemp = numbers.remove(); // will add to back of numbers if not divisible by prime (otherwise deleted) if (numTemp % prime != 0) { numbers.add(numTemp); // put back into back of queue } } } while (!numbers.isEmpty()); // Keeps running as long as there is a value in numbers return primes; }
answer count: 2
has answer: http://stackoverflow.com/a/24967575
accepted answer: http://stackoverflow.com/a/24967575
upvote count: 1
has title: Java Complexity Class for this Program?
favorite count: 0
score: 0
downvote count: 1

http://stackoverflow.com/q/25039080
tagged with: java
answer count: 6
score: 27
accepted answer: http://stackoverflow.com/a/25039131
type: Question
has title: Java: How to determine if type is any of primitive/wrapper/String, or something else
has answer: http://stackoverflow.com/a/25039320
linked to: http://stackoverflow.com/q/709961
has answer: http://stackoverflow.com/a/25039341
tagged with: types
has body: Is there a single method in JDK or common basic libraries which returns true if a type is a primitive, a primitive wrapper, or a String? I.e. Class&lt;?&gt; type = ... boolean isSimple = SomeUtil.isSimple( type ); The need for such information can be e.g. to check whether some data can be represented in formats like JSON. The reason for a single method is to be able to use it in expression language or templates.
has answer: http://stackoverflow.com/a/25039183
has comment: http://stackoverflow.com/comment/38943807
favorite count: 0
possible better answer: http://stackoverflow.com/a/25039320
has comment: http://stackoverflow.com/comment/38944055
linked to: http://stackoverflow.com/q/11978139
upvote count: 29
has comment: http://stackoverflow.com/comment/38943957
has answer: http://stackoverflow.com/a/25040053
has answer: http://stackoverflow.com/a/25039131
downvote count: 2
has answer: http://stackoverflow.com/a/58181159
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38944832

http://stackoverflow.com/comment/60151046
comment on: http://stackoverflow.com/a/24950259
type: AnswerComment
type: Comment
score: 0
has text: @Jimmy Lunceford, you can share the future ref with some other thread and call get there upto you, but point here is to demonstrate what it does. Even here the future task executes in thread 't' and not 'main'

http://stackoverflow.com/comment/38953502
comment on: http://stackoverflow.com/q/25043191
score: 0
has text: @laune yes, indeed, I just wonder why under same conditions (measurements) `JLabel` presents different versions of a string.
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24929862
answers question: http://stackoverflow.com/q/24922873
has comment: http://stackoverflow.com/comment/38754850
type: Answer
has body: When using Java based configuration for Spring Security, CSRF protection is enabled by default. You can switch it off as http.csrf().disable().
score: 0

http://stackoverflow.com/comment/38847840
type: QuestionComment
comment on: http://stackoverflow.com/q/24987860
has text: `getContext` expects an argument of type `ActionHandler`. Is `Foo` an `ActionHandler`? Is `Foo` what you should be passing in or what you should be getting out?
score: 0
type: Comment

http://stackoverflow.com/a/24928175
type: Answer
upvote count: 6
has body: The basic principle is to feed the InputStream into the OutputStream, for example... byte bytes[] = null; try (FileInputStream fis = new FileInputStream(new File("..."))) { try (ByteArrayOutputStream baos = new ByteArrayOutputStream()) { byte[] buffer = new byte[1024]; int read = -1; while ((read = fis.read(buffer)) != -1) { baos.write(buffer, 0, read); } bytes = baos.toByteArray(); } } catch (IOException exp) { exp.printStackTrace(); }
downvote count: 0
answers question: http://stackoverflow.com/q/24927932
score: 6

http://stackoverflow.com/a/25050002
upvote count: 5
type: Answer
has comment: http://stackoverflow.com/comment/38966632
downvote count: 0
has comment: http://stackoverflow.com/comment/38965250
has comment: http://stackoverflow.com/comment/38964792
has comment: http://stackoverflow.com/comment/38965578
score: 5
has comment: http://stackoverflow.com/comment/38965484
has comment: http://stackoverflow.com/comment/38964844
accepted answer of: http://stackoverflow.com/q/25049921
answers question: http://stackoverflow.com/q/25049921
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38965483
has body: In your RetrieveActivity class, do this: Intent intent = new Intent(RetrieveActivity.this, GraphActivity.class); intent.putStringArrayListExtra("list1", mArrayList1); intent.putStringArrayListExtra("list2", mArrayList2); intent.putStringArrayListExtra("list3", mArrayList3); startActivity(intent); And then in your GraphActivity, do this to retrieve the list: Intent i = getIntent(); ArrayList&lt;String&gt; newList1 = i.getStringArrayListExtra("list1"); ArrayList&lt;String&gt; newList2 = i.getStringArrayListExtra("list2"); ArrayList&lt;String&gt; newList3 = i.getStringArrayListExtra("list3");

http://stackoverflow.com/q/24942961
score: 0
answer count: 2
possible better answer: http://stackoverflow.com/a/24942970
has comment: http://stackoverflow.com/comment/38764555
has answer: http://stackoverflow.com/a/24943378
tagged with: jdbc
type: AnsweredQuestion
has body: I have a function as follow: public static ArrayList&lt;Article&gt; getNewsList(Database db, Date start,Date end,int nextNth,int limit,String tableName,String entityQuery,String topicQuery) throws SQLException { long a=System.currentTimeMillis(); ArrayList&lt;Article&gt; youTube=new ArrayList&lt;Article&gt;(); System.out.println("starting time is : "+a+" "); Connection conn = db.getConnection(); PreparedStatement stmt = conn .prepareStatement("SELECT n.title,n.link,n.Description,n.NewsContent,n.IURL,date(n.Published) FROM "+tableName+" as en inner join news as n on " + " en.dataitemid=n.id where en.dataitemtype=1 and dateAdded between ? and ? "+entityQuery+" "+topicQuery+" limit ?,?;"); stmt.setDate(1, start); stmt.setDate(2, end); stmt.setLong(3, nextNth); stmt.setLong(4, limit); ResultSet rset = stmt.executeQuery(); while (rset.next()) { Article nw=new Article(); nw.setTitle(rset.getString(1)); nw.setLink(rset.getString(2)); nw.setDescription(rset.getString(3)); nw.setContent(rset.getString(4)); nw.setiURL(rset.getString(5)); nw.setDate(rset.getDate(6)); youTube.add(nw); } long b=System.currentTimeMillis(); System.out.println(b+" total time it takes is: "+(b-a)); return youTube; } this function acts very funny. As you see I have 2 variables for starting and ending time of the function and when I run the function it takes 36 seconds(the result of b-a) but if I run the same query with the same parameters in mysql it takes only 0.019 seconds which shows the huge difference though as you can see I do not have anything special in my java code that takes long time . I am so curious to know what causes this huge difference. Can anyone help?
tagged with: java
tagged with: mysql
has title: huge difference between the running time of the same SQL query in java and mysql
type: Question
accepted answer: http://stackoverflow.com/a/24943378
has answer: http://stackoverflow.com/a/24942970

http://stackoverflow.com/a/24983703
answers question: http://stackoverflow.com/q/24983618
has body: It isn't size W*H because they're probably not storing the data quite like you think. Usually, data of this nature is stored such that the first row of the data is stored in the first W entries, the second in the second W, etc.; this results in an array of size W*H. Thus, to get information about something in row X, column Y, you have to get the element at index (W * X) + Y public int getPixel(x,y) { return pixels(y + W*X); }
upvote count: 1
downvote count: 0
score: 1
type: Answer

http://stackoverflow.com/comment/38988859
score: 0
type: Comment
type: QuestionComment
has text: @Spidy Yes, you are correct. I made the change to the code above that you suggested. Still same problem though. And no, I havent tried startForegroundCompat but cant find an example anywhere to figure out how to use it.
comment on: http://stackoverflow.com/q/25060962

http://stackoverflow.com/comment/38873009
comment on: http://stackoverflow.com/a/25001508
has text: If I remember correctly Gson doesn't need getters/setters. Anyway upvote for pointing out `static`.
type: AnswerComment
type: Comment
score: 1

http://stackoverflow.com/a/24974799
has comment: http://stackoverflow.com/comment/38823243
has comment: http://stackoverflow.com/comment/38832980
answers question: http://stackoverflow.com/q/24973714
score: 0
type: Answer
has body: At least you have to close the Socket connection instance inside finally. Test if it is null, if you don't do that a reference may persist in memory. And also make sure that it is not executing in the main thread. After that if the same error persist, try to reinstall the application to clean up the memory cache. And also avoid close the Socket instance inside the Tool Class.

http://stackoverflow.com/a/24943194
downvote count: 0
answers question: http://stackoverflow.com/q/24943122
score: 3
has body: Should this be able to happen? Is this a glitch in Java? Or just a freak accident. All the above. Let us image you are adding to the ArrayList in one thread and accessing it in another. Lets say you have a size of 14, but you access index 15 T1: if (index &gt;= size) // is true T2: for(int i=0;i&lt;5;i++) list.add(N); // so now we have 19. T1: outOfBoundsMsg(index); // Index: 15, Size: 19
upvote count: 3
type: Answer

php
tags question: http://stackoverflow.com/q/25016526
tags question: http://stackoverflow.com/q/25039336
tags question: http://stackoverflow.com/q/24953290
tags question: http://stackoverflow.com/q/25029040
tags question: http://stackoverflow.com/q/25031950
tags question: http://stackoverflow.com/q/24974523
tag name: php
tags question: http://stackoverflow.com/q/24931201
tags question: http://stackoverflow.com/q/24933710
tags question: http://stackoverflow.com/q/25036826
tags question: http://stackoverflow.com/q/24933757
tags question: http://stackoverflow.com/q/25017600
tags question: http://stackoverflow.com/q/24966198
tags question: http://stackoverflow.com/q/24944380
tags question: http://stackoverflow.com/q/25014535
tags question: http://stackoverflow.com/q/24982058
tags question: http://stackoverflow.com/q/24981723
type: Tag

http://stackoverflow.com/q/24930782
has answer: http://stackoverflow.com/a/33392069
has comment: http://stackoverflow.com/comment/38741273
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38740026
has comment: http://stackoverflow.com/comment/38740250
tagged with: java
has title: ClassNotFoundException: Didn't find class "com.google.android.gms.ads.AdView"
score: 4
has comment: http://stackoverflow.com/comment/38741586
tagged with: google-play-services
tagged with: admob
type: Question
upvote count: 4
has answer: http://stackoverflow.com/a/25865864
downvote count: 0
has answer: http://stackoverflow.com/a/24934429
favorite count: 0
has body: I did a lot of research and this seems to be a common error for many users but for very different reasons. None of which I found worked for me. I'm getting java.lang.RuntimeException: Unable to start activity ComponentInfo{ [...]/[...].activities.StartActivity}: android.view.InflateException: Binary XML file line #173: Error inflating class [...].BannerAd [...] Caused by: android.view.InflateException: Binary XML file line #8: Error inflating class com.google.android.gms.ads.AdView [...] Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.ads.AdView" on path: DexPathList[[zip file "/data/app/[...]-1.apk"],nativeLibraryDirectories=[/data/app-lib/[...]-1, /vendor/lib, /system/lib]] I'm having the newest versions of ADT and SDK packages installed. I copied google-play-services_lib to my workspace and imported it as a Android project. I added it as a library to my app project. I checked everything under "Order and Export". I'm having a banner_ad.xml: &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_gravity="center_horizontal|top" android:orientation="vertical" &gt; &lt;com.google.android.gms.ads.AdView xmlns:ads="http://schemas.android.com/apk/res-auto" android:id="@+id/adView" android:layout_width="match_parent" android:layout_height="wrap_content" ads:adSize="BANNER" ads:adUnitId="[...]" /&gt; &lt;/LinearLayout&gt; And a BannerAd.java which I am using: package [...]; import android.content.Context; import android.util.AttributeSet; import android.view.LayoutInflater; import android.widget.LinearLayout; import [...].R; import [...].general.Settings; import com.google.android.gms.ads.AdRequest; import com.google.android.gms.ads.AdView; public class BannerAd extends LinearLayout { public BannerAd(Context context, AttributeSet attrs) { super(context, attrs); if (!Settings.PRO) { LayoutInflater mInflater = (LayoutInflater) con…
answer count: 3
tagged with: android
linked to: http://stackoverflow.com/q/14142496

http://stackoverflow.com/comment/38846093
type: QuestionComment
has text: Where do you see this error? Is it a compile error or a runtime one? What API version do you use in your emu?
score: 0
comment on: http://stackoverflow.com/q/24986930
type: Comment

http://stackoverflow.com/comment/38893133
comment on: http://stackoverflow.com/q/25011779
type: Comment
type: QuestionComment
score: 2
has text: Yes. This behavior is browser specific. zk or otherwise.

http://stackoverflow.com/q/24938798
tagged with: restful-architecture
has comment: http://stackoverflow.com/comment/38763903
favorite count: 0
answer count: 0
type: UnansweredQuestion
has title: How to create an aggregating REST service?
tagged with: spring-mvc
score: 2
downvote count: 0
tagged with: java
has body: In my company we have several basic REST services consumed by our web and mobile applications. (Please read REST as only JSON over HTTP with only POST calls). In order to improve the performance of the mobile client (network overhead of many http calls) we would like to be able to aggregate some REST calls. We would like to find a generic solution so the mobile client is free to choice which services to aggregate. The solution currently found is a generic REST service that receives the json with the list of requests and delegates to a pool of threads the execution of each request. When all requests are completed the service collects all the responses in a list and return it as aggregated response. This solution has some problems: The spring or javax validation is not applied (is invoked in the aggregating service) Session scoped data is not available in servant thread (a workaround found via ThreadLocal) Filters and Interceptors are not applied on the single request (no solution yet) Potentially others issues yet undiscovered Does spring(mvc) offer a better way to do the same? Can HandlerInterceptor help me in re-implement the same logic in a safer way? Thanks Vito
type: Question
upvote count: 2

http://stackoverflow.com/a/24914130
has comment: http://stackoverflow.com/comment/38709066
has comment: http://stackoverflow.com/comment/38708811
has comment: http://stackoverflow.com/comment/38709147
has comment: http://stackoverflow.com/comment/38711487
type: Answer
has comment: http://stackoverflow.com/comment/38709134
upvote count: 1
has body: My main recommendation: don't ignore OOP practices to solve your problem, such as by using public fields and such. Don't have another class directly manipulate the state of your JTextArea which should be private anyway. Instead, give the class that holds the JTextArea a public setFont method that other classes can call on valid instances of the containing class. public class MyGui { private JTextArea textarea = .....; public void setTextAreaFont(Font font) { textarea.setFont(font); } So for an object to call this method, all it needs is a valid reference to the MyGui class, with valid being the key term here. This may require that you pass the reference into the object that needs it by a setter method or a constructor parameter. There is no need to use an inner class here, none at all. And of course, the JTextArea field should never be static as that would throw all OOP to the wind, making it very difficult maintaining, enhancing or testing your code. Edit You now state: The "Font Chooser" object is instantiated after the creation of the main Frame, in fact the instantiation is done by the main JFrame class, and apparently I cannot access to the main JFrame public members. Then what is stopping you from passing the GUI class into your font chooser on its creation? MyFontChooser myFontChooser = new MyFontChooser(this); // ??? Again, please tell the details of your problem. class MyFontChooser { private MyGui myGui; public MyFontChooser(MyGui myGui) { this.myGui = myGui; } // some event caused method public void changeFont() { myGui.setTextAreaFont(someFont); }
answers question: http://stackoverflow.com/q/24914099
has comment: http://stackoverflow.com/comment/38709289
score: 1
has comment: http://stackoverflow.com/comment/38709577
has comment: http://stackoverflow.com/comment/38708882
has comment: http://stackoverflow.com/comment/38709746
accepted answer of: http://stackoverflow.com/q/24914099
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/38709616
has comment: http://stackoverflow.com/comment/38711032
has comment: http://stackoverflow.com/comment/38711102

http://stackoverflow.com/comment/38765421
has text: Thanks for the response. Since it doesn't seem like there is a way to just 'reset' the Fragment's view is there any way to recreate the Fragment (ie `myFragment = new MyFragment();`) while retaining the Fragment's location on the backstack? I tried the basic `mMyFragment = MyFragment.newInstance();` in the `onActivityResult()` but it doesn't recreate the fragment as I expected.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/24942381
type: Comment

http://stackoverflow.com/comment/38990194
type: QuestionComment
comment on: http://stackoverflow.com/q/25059863
has text: http://stackoverflow.com/questions/11723400/get-response-data-using-harlib-in-java see this discussion may help you
score: 1
type: Comment

http://stackoverflow.com/q/24983411
tagged with: swing
tagged with: text
type: AnsweredQuestion
tagged with: java
upvote count: 1
has answer: http://stackoverflow.com/a/24983461
downvote count: 1
type: Question
tagged with: graphics
has body: I'm working on a game that has a chatbox in it, but despite looking into it, (I might not be searching for the right thing), I can't figure out the best way to create a custom 'scroll pane' for a 'textbox' draw on the graphics. This horrible paint representation kind of shows what I'm trying to accomplish: If I can give anymore information on this, please ask. This is the best way I could figure out how to explain it. Edit: OK, so to give more info on this, the JPanel the game uses to display the game. It's done via overriding PaintComponent in the JPanel. I'm not sure if it's possible to add a new component to draw this with. If it is, then that might work. I just need to be able to position it in a specific spot. If adding a new component to this would work, then that would work and I feel like an idiot.
score: 0
accepted answer: http://stackoverflow.com/a/24983461
answer count: 1
has title: Java graphics object and scrolling - easiest way to do it?
favorite count: 0

http://stackoverflow.com/comment/38716478
score: 0
has text: than I have an error to set String: `code` statement.setString(1,"%"+ surname + "%"); statement.setString(2, "%" + name + "%"); `code`
comment on: http://stackoverflow.com/q/24917917
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24991258
tagged with: android
has comment: http://stackoverflow.com/comment/38853842
has comment: http://stackoverflow.com/comment/38853860
upvote count: 3
has comment: http://stackoverflow.com/comment/38853913
type: UnansweredQuestion
type: Question
has body: What's better? private EditText mPhoneNumber; private EditText mEmail; private EditText mFirstName; private EditText mLastName; or private EditText mPhoneNumberEditText; private EditText mEmailEditText; private EditText mFirstNameEditText; private EditText mLastNameEditText; I tend to think that in strong typed language, you don't need to suffix your variables with the type name. However, I don't have enough experience in Java to be sure of it. Is this a non question? Or are there best practice regarding this matter?
tagged with: naming-conventions
tagged with: java
has comment: http://stackoverflow.com/comment/38853844
has comment: http://stackoverflow.com/comment/38853951
has comment: http://stackoverflow.com/comment/38853808
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/24991283
has title: Should I suffix my variables with object type?
score: 3

http://stackoverflow.com/comment/38857893
has text: I have also noticed a different in your mapping annotations when comparing with the tutorial. Look @ RequestMapping on your openRepaidsInJson method and compare it with getShopInJson method on the tutorial
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24993357

http://stackoverflow.com/comment/38758107
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/24940123
has text: What have you tried so far? Note that you should *consider* overriding equals and hashCode to implement custom equality.
type: Comment

http://stackoverflow.com/a/32305649
score: 8
answers question: http://stackoverflow.com/q/25026185
has body: If you, like me, for some reason can not use custom Application class, just surround the init method with try/catch, like this: private void initParse() { try { Parse.initialize(getApplication(), "some id here", "another id here"); ParseInstallation.getCurrentInstallation().saveInBackground(); } catch (Exception e) { e.printStackTrace(); } } That way it won't crash the whole app, and the SDK will still work, tested it.
downvote count: 0
upvote count: 8
type: Answer

http://stackoverflow.com/q/24972087
answer count: 1
tagged with: android
has body: navigation drawer is working perfect also splash screen code is working perfect in other app but when i add splash screen code to this navigation drawer the app won't open i tried all different methods but no luck it always display an error and wont open at all an no reference on the internet package com.tutecentral.navigationdrawer; public class MainActivity extends Activity { private DrawerLayout mDrawerLayout; private ListView mDrawerList; private ActionBarDrawerToggle mDrawerToggle; private CharSequence mDrawerTitle; private CharSequence mTitle; CustomDrawerAdapter adapter; private ImageView splashImageView; boolean splashloading = false; List&lt;DrawerItem&gt; dataList; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); splashImageView = new ImageView(this); splashImageView.setScaleType(ScaleType.FIT_XY); splashImageView.setImageResource(R.drawable.ic_launcher); setContentView(splashImageView); splashloading = true; Handler h = new Handler(); h.postDelayed(new Runnable() { public void run() { splashloading = false; setContentView(R.layout.activity_main); } }, 3000); // Initializing dataList = new ArrayList&lt;DrawerItem&gt;(); mTitle = mDrawerTitle = getTitle(); mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); mDrawerList = (ListView) findViewById(R.id.left_drawer); mDrawerLayout.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START); // Add Drawer Item to dataList dataList.add(new DrawerItem("Message", R.drawable.ic_action_email)); dataList.add(new DrawerItem("Likes", R.drawable.ic_action_good)); dataList.add(new DrawerItem("Games", R.drawable.ic_action_gamepad)); dataList.add(new DrawerItem("Lables", R.drawable.ic_action_labels)); dataList.add(new DrawerItem("Search", R.drawable.ic_action_search)); dataList.add(new DrawerItem("Cloud", R.drawable.ic_action_cloud)); dataList.add(new DrawerItem("Camara", R.drawable.ic_action_camera)); dataList.add(new DrawerItem("Video", R.drawable.ic_action…
tagged with: splash-screen
has title: navigation drawer error with splash screen
has answer: http://stackoverflow.com/a/24974483
accepted answer: http://stackoverflow.com/a/24974483
tagged with: java
tagged with: navigation-drawer
type: AnsweredQuestion
type: Question
score: 0

http://stackoverflow.com/a/26916190
type: Answer
has comment: http://stackoverflow.com/comment/61018439
has body: If you don't mind it being rasterized at a specifc size, you could use the SwingFXUtils.toFXImage static method in javafx.embed.swing: TeXFormula tex = new TeXFormula("a + b \\cdot x"); java.awt.Image awtImage = tex.createBufferedImage(TeXConstants.STYLE_TEXT, 12, java.awt.Color.BLACK, null); Image fxImage = SwingFXUtils.toFXImage((BufferedImage) awtImage, null); ImageView view = new ImageView(fxImage); The fxImage instance could also be passed to the Labeled.setGraphic method for use in certain controls (e.g. buttons).
score: 5
upvote count: 5
downvote count: 0
answers question: http://stackoverflow.com/q/25027060
has comment: http://stackoverflow.com/comment/84889729

http://stackoverflow.com/q/24963789
tagged with: ant
has body: This is what I get after I installed Ant: ant -v Apache Ant(TM) version 1.9.4 compiled on April 29 2014 Trying the default build file: build.xml Buildfile: build.xml does not exist! Build failed Debug option: (not clear to me) ant --execdebug exec "/Library/Java/JavaVirtualMachines/jdk1.7.0_40.jdk/Contents/Home/jre/bin/java" -classpath "/Users/sridhar/software_downloads/apache-ant-1.9.4/lib/ant-launcher.jar" -Dant.home="/Users/sridhar/software_downloads/apache-ant-1.9.4" -Dant.library.dir="/Users/sridhar/software_downloads/apache-ant-1.9.4/lib" org.apache.tools.ant.launch.Launcher -cp "" Buildfile: build.xml does not exist! Build failed I have set the environment variable correctly: echo $ANT_HOME /Users/software_downloads/apache-ant-1.9.4 echo $JAVA_HOME /Library/Java/JavaVirtualMachines/jdk1.7.0_40.jdk/Contents/Home I followed this post: sudo mkdir /usr/lib/java-1.7.0 /usr/share/java-1.7.0 I still get same error I am using Mac OS X mavericks and Jdk1.7
score: 0
answer count: 1
has title: unable to run Ant on my mac Os X?
tagged with: macos
has comment: http://stackoverflow.com/comment/38802523
has comment: http://stackoverflow.com/comment/38802475
has answer: http://stackoverflow.com/a/24963918
accepted answer: http://stackoverflow.com/a/24963918
type: AnsweredQuestion
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/2336299

http://stackoverflow.com/comment/38771065
type: Comment
has text: Yeah it was caused by setActionListeners (); and start_timer.setOnClickListener(new View.OnClickListener() hmm I wonder why
comment on: http://stackoverflow.com/a/24946549
type: AnswerComment
score: 0

http://stackoverflow.com/q/24988576
tagged with: package
has body: I am not sure how to fix this but I think it's rather a classpath error. I need to know where to run the following command if this is my file structure: monas-mbp:p3 mona$ java Huffman c p3code.txt p3input.txt p3output.tx Exception in thread "main" java.lang.NoClassDefFoundError: Huffman (wrong name: p3/Huffman) at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:800) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) at java.net.URLClassLoader.defineClass(URLClassLoader.java:449) at java.net.URLClassLoader.access$100(URLClassLoader.java:71) at java.net.URLClassLoader$1.run(URLClassLoader.java:361) at java.net.URLClassLoader$1.run(URLClassLoader.java:355) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:354) at java.lang.ClassLoader.loadClass(ClassLoader.java:425) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) at java.lang.ClassLoader.loadClass(ClassLoader.java:358) at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:482) Well, I already copied the Huffman.class from the following path actually to the current directory which is /Users/mona/java/p3/src/p3 using cp /Users/mona/java/p3/bin/p3/Huffman.class Huffman.class so here's what I have in Eclipse. I created project p3 and then it automatically created package p3 while previously it used to create default package. Any idea what's the fix? Also why it didn't create the default package automatically like always? [UPDATE]Well, I didn't expect to receive such confusing answers specially because both project name as well as the automatically package name is p3. Can you please be more elaborate and detailed about your answers? Here's the structure created by Eclipse in my computer: Also when I run the command in bin/p3 I get this result: monas-mbp:p3 mona$ pwd /Users/mona/java/p3/bin/p3 monas-mbp:p3 mona$ java Huffman c p3code.txt p3input.t…
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24988621
tagged with: java
tagged with: eclipse
tagged with: classpath
type: Question
answer count: 2
has title: Exception in thread "main" java.lang.NoClassDefFoundError: Huffman (wrong name: p3/Huffman)
upvote count: 1
favorite count: 0
score: 0
possible better answer: http://stackoverflow.com/a/24988621
downvote count: 1
has answer: http://stackoverflow.com/a/24988603
accepted answer: http://stackoverflow.com/a/24988603

http://stackoverflow.com/a/24974328
accepted answer of: http://stackoverflow.com/q/24972589
score: 2
answers question: http://stackoverflow.com/q/24972589
downvote count: 0
type: AcceptedAnswer
has body: Parsing JSON is pretty easy in Android. This is how you can parse your current JSON - //Assuming json holds your JSON as String try { //Create a JSON array JSONArray jsonArray = new JSONArray(json); //Iterate through all the JSON objects for(int i=0;i&lt;jsonArray.length();i++){ //Get ith object JSONObject item = jsonArray.getJSONObject(i); //Get required data from the object String title = (String) item.get("title"); String location = (String) item.get("location"); String imageUrl = (String) item.get("imageUrl"); String pubDate = (String) item.get("pubDate"); //You can now do anything with the data. Log.i("TITLE", title); Log.i("LOC", location); Log.i("IMG_URL", imageUrl); Log.i("P_DATE", pubDate); } } catch (JSONException e) { Log.i("EXP", "Ooi..! There's an exception."); e.printStackTrace(); } If you are new to parsing JSON there are many easy tutorials for this, like - tutorialspoint androidhive
upvote count: 2
type: Answer

background
tags question: http://stackoverflow.com/q/25019096
tag name: background
tags question: http://stackoverflow.com/q/25024519
tags question: http://stackoverflow.com/q/24986621
type: Tag
tags question: http://stackoverflow.com/q/24919441

http://stackoverflow.com/q/24960817
has title: Spring: Migrating database configuration from XML file to annotation
downvote count: 0
has answer: http://stackoverflow.com/a/24961293
has body: I'm trying to update my project to the newest version of Spring, Hibernate etc. and the issue I'm facing now is the migration of the database configuration from my old XML configuration file to the annotation (I really like the annotated based configuration). Below is my old configuration: /WEB-INF/hibernate.cfg.xml org.hibernate.cfg.AnnotationConfiguration <tx:annotation-driven transaction-manager="transactionManager" /> Did any one know how to configure the sessionfactory and the transaction manager using annotations only ?
has answer: http://stackoverflow.com/a/25140548
favorite count: 0
upvote count: 1
possible better answer: http://stackoverflow.com/a/25140548
tagged with: spring
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24961293
score: 1
tagged with: java
tagged with: hibernate
type: Question
answer count: 2

http://stackoverflow.com/comment/38972169
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25053879
type: Comment
has text: the benefit that i think you will get from sprite sheets is that instead of having a frame by frame picture of the character or object then store it in a bitmap array, in sprite sheet you could just have only 1 bitmap and 1 image resource. and about the activities if you dont want the user to use the back button you should finish the old activity before starting/opening the new activity. because if you're not finishing the activity and pressed the back button several times you can see that it is layered.

http://stackoverflow.com/comment/38742522
type: QuestionComment
has text: @stealthjong In real time, the class type of arguments is not known. Hence I used the above approach. If any arguments is null, Then Null Pointer Exception has been thrown out. I need a solution to invoke a method having set of arguments which might have any one or more null arguments with out knowing the class type
comment on: http://stackoverflow.com/q/24931842
score: 0
type: Comment

http://stackoverflow.com/comment/38982414
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25056465
type: Comment
has text: The class-path error. if have to dig more i guess. i wouold delete this answer then.

recursion
type: Tag
tags question: http://stackoverflow.com/q/24969599
tags question: http://stackoverflow.com/q/24946004
tags question: http://stackoverflow.com/q/25033405
tag name: recursion
tags question: http://stackoverflow.com/q/24973572
tags question: http://stackoverflow.com/q/24985990
tags question: http://stackoverflow.com/q/24944454
tags question: http://stackoverflow.com/q/25066346
tags question: http://stackoverflow.com/q/24917907
tags question: http://stackoverflow.com/q/24966235
tags question: http://stackoverflow.com/q/24986776
tags question: http://stackoverflow.com/q/24962555
tags question: http://stackoverflow.com/q/24965215
tags question: http://stackoverflow.com/q/24983336
tags question: http://stackoverflow.com/q/24948553

http://stackoverflow.com/comment/38752049
has text: Do you extend Activity or FragmentActivity?
comment on: http://stackoverflow.com/q/24937042
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25055210
answer count: 3
tagged with: lru
has body: new to stack-overflow so please dont mind my noob way of asking this. I'm trying to implement LRU caching using a linked list, I've seen other implementations here using linkedHashMap and other data structures but for this case i'm trying to create the best optimized version using linked lists as i was asked during a technical round. I've limited the cache size here to 3 Is there any way to better optimize this LRU implementation ? Also what will be the time complexity for this implementation ? will it be of the order O(N) without considering the for-loops which are simply printing the values in the linkedList? public class LRU { public static void main(String[] args) { LinkedList list = new LinkedList(); int[] feed = { 7, 0, 1, 2, 0, 3, 0, 4, 2, 3, 0, 3, 2, 1, 2, 0, 1, 7, 0, 1 }; for (int i = 0; i &lt; feed.length - 1; i++) { if (list.size() &lt;= 2) { list.add(feed[i]); System.out.println(); System.out.println("Added " + feed[i]); System.out.println("size of list is " + list.size()); System.out.print("this is list "); for (int k = 0; k &lt; list.size(); k++) { System.out.print(" " + list.get(k)); } } System.out.println(); if (list.size() &gt;= 3) { System.out.println(); System.out.println("feed is *" + feed[i + 1] + "*"); Integer value1 = (Integer) list.get(0); Integer value2 = (Integer) list.get(1); Integer value3 = (Integer) list.get(2); if ((feed[i + 1] != value1) || (feed[i + 1] != value2) || (feed[i + 1] != value3)) { list.removeLast(); list.addLast(feed[i + 1]); list.set(0, value2); list.set(1, value3); list.set(2, feed[i + 1]); } if (feed[i + 1] == value1) { list.removeLast(); list.addLast(value1); list.removeFirst(); list.addFirst(value2); list.set(1, value3); } if (feed[i + 1] == value2) { list.removeLast(); list.addLast(value2); list.set(1, value3); list.removeFirst(); list.addFirst(value1); } if (feed[i + 1] == value3) { list.set(0, value1); list.set(1, value2); } } System.out.println("Current elements in cache at " + i); for (int t = 0; t &lt; list.siz…
favorite count: 0
has comment: http://stackoverflow.com/comment/38996781
type: UnansweredQuestion
downvote count: 2
has comment: http://stackoverflow.com/comment/38974421
score: 2
has comment: http://stackoverflow.com/comment/38975846
has comment: http://stackoverflow.com/comment/38975328
tagged with: java
tagged with: caching
has comment: http://stackoverflow.com/comment/38975373
type: Question
upvote count: 4
has comment: http://stackoverflow.com/comment/38981441
has comment: http://stackoverflow.com/comment/38975022
has answer: http://stackoverflow.com/a/27324376
has comment: http://stackoverflow.com/comment/38975086
has title: Java LRU cache using LinkedList
has answer: http://stackoverflow.com/a/25056171
has answer: http://stackoverflow.com/a/25056082

http://stackoverflow.com/q/25067850
has comment: http://stackoverflow.com/comment/38999114
has answer: http://stackoverflow.com/a/25068152
accepted answer: http://stackoverflow.com/a/25068152
score: 0
answer count: 3
possible better answer: http://stackoverflow.com/a/25068132
tagged with: android
has title: Call a method when fragment is visible to user
type: AnsweredQuestion
tagged with: android-fragments
tagged with: java
has answer: http://stackoverflow.com/a/25068132
has answer: http://stackoverflow.com/a/25067934
has body: I need execute a method when the fragment is visible (to the user). Example: I have 2 buttons (button 1 and button 2) , 2 fragments(fragment 1 and fragment 2) and the method loadImages() inside the class fragment 2. when I press "button2" I want to replace fragment 1 by fragment 2 and then after the fragment 2 is visible (to the user) call loadImages(). I tried to use onResume() in the fragment class but it calls the method before the fragment is visible and it makes some delay to the transition. I tried setUserVisibleHint() too and did not work. A good example is the Instagram app. when you click on profile it loads the profile activity first and then import all the images. I hope someone can help me. I will appreciate your help so much. Thank you.
type: Question

http://stackoverflow.com/a/25007878
downvote count: 0
answers question: http://stackoverflow.com/q/25002700
type: Answer
has comment: http://stackoverflow.com/comment/38923307
score: 1
upvote count: 1
has body: Ideally, your continuous integration server would do this for you. But if you're not using that, you can deploy from your dev machine. Use the Tomcat Maven Plugin. You need to setup your remote tomcat server to enable remote deploy. In conf/tomcat-users.xml: <user name="manager" password="s3cr3t" roles="manager-script" /> In your maven pom.xml build/plugins section: org.apache.tomcat.maven tomcat7-maven-plugin 2.2 http://my-remote-server.com/manager/text true manager s3cr3t Then run mvn clean package tomcat7:deploy

public
tags question: http://stackoverflow.com/q/25062506
tags question: http://stackoverflow.com/q/24968622
type: Tag
tag name: public

http://stackoverflow.com/q/25000371
has comment: http://stackoverflow.com/comment/38883328
type: Question
has answer: http://stackoverflow.com/a/37048583
linked to: http://stackoverflow.com/q/15686611
downvote count: 0
answer count: 1
favorite count: 0
has body: I have below multi module maven project. Parent pom.xml artifactId1 pom.xml artifactId2 pom.xml now i want to rename artifactId2. how can i do this? Thanks!
type: UnansweredQuestion
tagged with: maven
has title: Renaming module in maven project?
score: 1
has comment: http://stackoverflow.com/comment/38870828
tagged with: java
upvote count: 1

http://stackoverflow.com/a/24925226
has body: I have used JNDI to solve this very problem in the past. Here is a nice example to show you how to do this with Spring: http://www.journaldev.com/2597/spring-datasource-jndi-with-tomcat-example
downvote count: 0
has comment: http://stackoverflow.com/comment/38730109
score: 1
has comment: http://stackoverflow.com/comment/38729945
upvote count: 1
answers question: http://stackoverflow.com/q/24925146
type: Answer

http://stackoverflow.com/comment/38996891
has text: You are welcome :) Please see my edit (Off-topic comment). If you're starting in Swing world then it's worth to re-consider the use of GUI builders. @user3896336
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25066510

http://stackoverflow.com/a/25013777
has body: You are mostly on the right track ... but there are a few mistakes: public JSONObject createGroupInServer( Activity activity, String lastSyncDateTime, ArrayList&lt;ContactGroup&gt; groups) throws JSONException { JSONObject jResult = new JSONObject(); jResult.putOpt("last_sync_date", lastSyncDateTime); JSONArray jArray = new JSONArray(); for (int i = 0; i &lt; groups.size(); i++) { JSONObject jGroup = new JSONObject(); jGroup.put("guid", groups.get(i).getGroupId()); jGroup.put("name", groups.get(i).getGroupName()); jGroup.put("isDeleted", groups.get(i).getIsDeleted()); // etcetera JSONObject jOuter = new JSONObject(); jOuter.put("contact_group", jGroup); jArray.put(jOuter); } jResult.put("recordset", jArray); return jResult; } But I agree with the other Answers that suggest you use a "mapping" technology like GSON rather than coding this by hand. Especially if this gets more complicated.
answers question: http://stackoverflow.com/q/25013255
type: Answer
accepted answer of: http://stackoverflow.com/q/25013255
downvote count: 0
score: 6
upvote count: 6
type: AcceptedAnswer

http://stackoverflow.com/q/25021329
tagged with: java
downvote count: 1
type: Question
has body: I am having an error in this code: public List&lt;AvailableTest&gt; srchInTestsInDb(String search, String catg) { try { Connection conn = Dbconn.Connect(); System.out.println(catg); String sql = "SELECT * " + "FROM AVAILABLE_TESTS " + "WHERE TST_CATAGORY="+catg+""; // + "TST_NAME LIKE '"+search+"%'";// AND TST_CATAGORY ="+catg+""; Statement statement = conn.createStatement(); ResultSet rs = statement.executeQuery(sql); List&lt;AvailableTest&gt; testList = new ArrayList&lt;AvailableTest&gt;(); while (rs.next()) { AvailableTest newtest = new AvailableTest(); newtest.setTstNo(rs.getInt("TST_NO")); newtest.setTstName(rs.getString("TST_NAME")); newtest.setTstCatagory(rs.getString("TST_CATAGORY")); newtest.setTstNormalValue(rs.getString("TST_NORMALVAL")); testList.add(newtest); } return testList; } catch (SQLException ex) { Logger.getLogger(DbHandeler.class.getName()).log(Level.SEVERE, null, ex); return null; } } Its output is: chem Jul 29, 2014 10:02:28 PM Db.DbHandeler srchInTestsInDb SEVERE: null java.sql.SQLSyntaxErrorException: ORA-00904: "CHEM": invalid identifier When I print "catg" it prints "chem" which I need in my query, but it's not working.
score: -1
has answer: http://stackoverflow.com/a/25021448
answer count: 3
tagged with: oracle-database
upvote count: 0
tagged with: sql
has answer: http://stackoverflow.com/a/25021370
has answer: http://stackoverflow.com/a/25021399
favorite count: 0
has comment: http://stackoverflow.com/comment/38910713
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38910711
has title: having error in WHERE clause of SQL query,

http://stackoverflow.com/a/24926346
downvote count: 0
score: 3
type: Answer
answers question: http://stackoverflow.com/q/24925797
accepted answer of: http://stackoverflow.com/q/24925797
has body: You can set onclickListener to your container layout like this: LinearLayout lay = (LinearLayout) findViewById(R.id.layout); lay.setOnClickListener(new OnClickListener() { @Override public boolean onClick(View view, MotionEvent ev) { ----enter your code--- } });
upvote count: 3
type: AcceptedAnswer

http://stackoverflow.com/comment/38831058
has text: It will give you an error if the user can not pay you. Sandbox by default is set up so the user can ALWAYS pay you. This is only on sandbox default setup tho.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24969266

http://stackoverflow.com/comment/38883169
type: Comment
has text: I doubt this is still accurate in a 64-bit JVM.
type: AnswerComment
comment on: http://stackoverflow.com/a/25006810
score: 0

http://stackoverflow.com/q/24956123
has answer: http://stackoverflow.com/a/24956262
downvote count: 0
favorite count: 0
has body: me and several experienced Java developers worked on this for like 1 hour now and we cannot get it to work. Someone has any tips for me? Problem: We got a text in an Excel file which seems to be encoded completely inconsistent and stupid. Sometimes there are special chars, sometimes not, sometimes they are shown and interpreted differently. What i wanted to do now is to write a little Java-Script, that checks the given Text in the Excel File and converts all the different Char-sequences into what we want it to be. My Code: while (iterator.hasNext()) { Entity entity = (Entity) iterator.next(); Dataset dataset = produkt_store.getDataset(entity); FormData formdata = dataset.getFormData(); DomElement dom = (DomElement) formdata.get(lang, "cs_description_short").get(); String beschreibung = dom.toText(true); System.out.println("Before: " + beschreibung); String hexBeschreibung = StringToHex(beschreibung); String newHexBeschreibung = hexBeschreibung.replaceAll("75 3F", "FC"); newHexBeschreibung = newHexBeschreibung.replaceAll("75 A8", "FC"); //beschreibung2 = beschreibung2.replaceAll("75A8", "FC"); System.out.println("After: " + HexToString(newHexBeschreibung)); System.out.println(hexBeschreibung.equals(newHexBeschreibung) + "\n"); // dom.set(beschreibung); } Also i got those functions to encode / decode to hex: private static String StringToHex(String s) { if (s.length() == 0) return ""; char c; StringBuffer buff = new StringBuffer(); for (int i = 0; i &lt; s.length(); i++) { c = s.charAt(i); buff.append(Integer.toHexString(c) + " "); } return buff.toString().trim(); } private static String HexToString(String s) { if (s.length() == 0) return ""; String[] arr = s.split(" "); StringBuffer buff = new StringBuffer(); int i; for (String str : arr) { i = Integer.valueOf(str, 16).intValue(); String hs = new Character((char) i).toString(); buff.append(hs); } return buff.toString(); } Example: Sometimes where there should be an "ü" it is shown as "u?" which we obviously want to a…
accepted answer: http://stackoverflow.com/a/24956660
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
type: Question
has title: hex-Encoding in Java goes wrong
has answer: http://stackoverflow.com/a/24956660
tagged with: ascii
has comment: http://stackoverflow.com/comment/38787741
answer count: 2
possible better answer: http://stackoverflow.com/a/24956262
has comment: http://stackoverflow.com/comment/38787447
has comment: http://stackoverflow.com/comment/38787884

http://stackoverflow.com/comment/38787965
type: Comment
has text: I suggest always using UTF-8 and throw ASCII, ANSI and Windows-1252 out of the window.
type: AnswerComment
comment on: http://stackoverflow.com/a/24956148
score: 0

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

http://stackoverflow.com/q/25006308
possible better answer: http://stackoverflow.com/a/25006425
has answer: http://stackoverflow.com/a/25006425
downvote count: 0
has comment: http://stackoverflow.com/comment/38882373
has title: Does random function does not executes again in repaint?
favorite count: 0
has comment: http://stackoverflow.com/comment/38882221
has comment: http://stackoverflow.com/comment/38882425
has answer: http://stackoverflow.com/a/25006395
has comment: http://stackoverflow.com/comment/38882353
tagged with: repaint
type: AnsweredQuestion
score: 2
has body: I am working on a code, where I am drawing multiple shapes on the JPanel and then calling repaint. I think that when I call repaint, the shapes in the JPanel should move to a new location as the random function will now provide different values. But the shapes do not move at all. Any ideas why is this happening? import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.ArrayList; import java.util.Collections; import java.util.Random; import javax.swing.BorderFactory; import javax.swing.BoxLayout; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.SwingUtilities; import javax.swing.WindowConstants; @SuppressWarnings("serial") public class Filter extends JFrame { public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { public void run() { Filter mainFrame = new Filter(); mainFrame.setVisible(true); } }); } public Filter() { //Creating the JFrame main window setSize(800, 500); setTitle("Particle Filter"); setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); setLocation(100, 100); getContentPane().setLayout(new BoxLayout(this.getContentPane(), BoxLayout.X_AXIS)); //creates two panels content and sidebar. Sidebar has null layout JPanel content = new JPanel(); content.setPreferredSize(new Dimension(700,500)); content.setBackground(Color.LIGHT_GRAY); this.getContentPane().add(content); JPanel sidebar = new JPanel(); sidebar.setBackground(Color.LIGHT_GRAY); sidebar.setPreferredSize(new Dimension(100,500)); this.getContentPane().add(sidebar); sidebar.setLayout(null); //creates three buttons in sidebar JButton start_button = new JButton("START"); start_button.setBounds(10, 75, 77, 23); start_button.addActionListener(new MainPanel()); sidebar.add(start_button); JButton stop_button = new JButton("STOP"); stop_button.setBounds(10, 109, 77, 23); sidebar.add(stop_button); JButton reset_button =…
upvote count: 2
tagged with: java
has comment: http://stackoverflow.com/comment/38882296
tagged with: swing
type: Question
has comment: http://stackoverflow.com/comment/38882185
accepted answer: http://stackoverflow.com/a/25006395
has comment: http://stackoverflow.com/comment/38885062
tagged with: jpanel
answer count: 2
has comment: http://stackoverflow.com/comment/38882248

http://stackoverflow.com/comment/38742221
type: QuestionComment
comment on: http://stackoverflow.com/q/24932061
score: 1
has text: how about we see some of your code first
type: Comment

http://stackoverflow.com/q/24939129
has comment: http://stackoverflow.com/comment/38772586
answer count: 1
has body: I made an android calculator in Eclipse. And in my program, I imported folder1name.folder2name.file1name and folder1name.folder2name.file2name. I also added the external library(folder1/folder2/) which contains the JAVA Files(file2, file1) and the JAR Files required for the class which I imported. But, when I try to run it on the Emulator, it gives an error in the LogCat. I think it's a problem with the way I added the libs and JARs. It shows no error with the code. Please help me fix this error! I use Eclipse Luna. Edit: Here're the last 2 lines (red lines) of output. [2014-07-25 09:23:00 - Dex Loader] Unable to execute dex: Multiple dex files define Lorg/apache/tools/ant/taskdefs/optional/junit/AggregateTransformer$Format; [2014-07-25 09:23:00 - OwnCode] Conversion to Dalvik format failed: Unable to execute dex: Multiple dex files define Lorg/apache/tools/ant/taskdefs/optional/junit/AggregateTransformer$Format;
favorite count: 0
duplicate of: http://stackoverflow.com/q/7870265
has comment: http://stackoverflow.com/comment/38755945
type: UnansweredQuestion
tagged with: android
score: -3
linked to: http://stackoverflow.com/q/7870265
tagged with: java
upvote count: 1
tagged with: eclipse
has comment: http://stackoverflow.com/comment/38755935
has answer: http://stackoverflow.com/a/24947921
type: Question
has title: Android: External Library and JAR Issue
downvote count: 4

http://stackoverflow.com/q/25023788
type: Question
has title: Receive byte array from data with persian character
tagged with: java
has body: My code is a messenger that sends messages from an android device to another android device over WiFi. Here's my code, in this class I send the message: public class ClientThread extends Thread { String address; String message; int portNum; InetAddress serverAddr; Socket socket; PrintWriter out; boolean broadcast; public ClientThread(String addr, int port, String msg, boolean bcast) throws IOException { address = addr; portNum = port; message = msg; broadcast = bcast; } public void run() { try { ChatService.portsocket.setBroadcast(broadcast); // Charset.forName("UTF-8").encode(message); // Log.d("client",new String(message.getBytes())); // byte[] b = EncodingUtils.getBytes(message, // Charset.forName("UTF-8").name()); DatagramPacket packet1 = new DatagramPacket(message.getBytes(), message.length(), InetAddress.getByName(address), 5555); ChatService.portsocket.send(packet1); } catch (Exception e) { e.printStackTrace(); } } } and in this class I receive the message : public class ChatService extends Service { public static String serverIP; public static int serverPort = 5555; private ServerSocket serverSocket; private serverThread sThread; public static final String BROADCAST_ACTION = "UpdateEvent"; public static DatagramSocket portsocket; Intent intent; int i = 0; @Override public IBinder onBind(Intent arg0) { return null; } private class serverThread extends Thread { public void run() { try { serverIP = getLocalIpAddress(); Log.v("addr", serverIP); if (serverIP != null) { serverSocket = new ServerSocket(serverPort); Log.v("socket", "created"); while (true) { /* * Socket client = serverSocket.accept(); * Log.v("client", "received"); */ try { byte [] buf = new byte [1024]; DatagramPacket packet = new DatagramPacket(buf, buf.length); ChatService.portsocket.receive(packet); byte [] result = new byte [packet.getLength()]; System.arraycopy(packet.getData(), 0, result, 0, packet.getLength()); String msg = new String(result); Log.d("armin", msg); updateGui(msg, packet.getAd…
accepted answer: http://stackoverflow.com/a/25024026
tagged with: persian
score: 0
answer count: 1
tagged with: android
tagged with: utf-8
has answer: http://stackoverflow.com/a/25024026
type: AnsweredQuestion

http://stackoverflow.com/comment/38709616
type: Comment
comment on: http://stackoverflow.com/a/24914130
type: AnswerComment
score: 0
has text: I needed a reference to the main class, otherwise I couldn't access its static public members, right dude

http://stackoverflow.com/a/24958684
answers question: http://stackoverflow.com/q/24957057
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24957057
downvote count: 0
upvote count: 2
type: Answer
has body: Instead of trying to make a generated ValueProvider type for this, there is one that already exists. But first: what is a ValueProvider that you need one that talks about the whole object? The idea is that it provides a sort of simple 'reflection' on properties of an object, but without actual reflection (since GWT doesn't support it). These are read/write by default, allowing both a setValue and a getValue method to not only read the value out, but optionally write something back again. This ValueProvider interface can easily be implemented by hand as well - there is no need to start with the PropertyAccess to do it for you if it doesnt know how to solve your problem. In the case of talking about an object itself, you can just return the original object. Here is a (partially implemented) idea of how that should look: public class IdentityValueProvider&lt;T&gt; implements ValueProvider&lt;T, T&gt; { public T getObject(T object) { return object; } public void setValue(T object, T value) { //can't do anything to set object to a new value, ignore, or throw exception } //... } This class actually exists in GXT, and is called IdentityValueProvider, since it returns the same object as it is given (it is an "identity function"). You can make your own if you want to customize, otherwise, just pass it in as-is: ColumnConfig&lt;Stock, Stock&gt; column = new ColumnConfig&lt;Stock, Stock&gt;(new IdentityValueProvider&lt;Stock&gt;()); In one of your comments, you further clarify that you need to print out id + "-" + name from the full object, so ideally you want to just return that string? This might look like this: public class IdAndNameStringProvider implements ValueProvider&lt;Stock, String&gt; { public String getValue(Stock object) { return object.getId() + "-" + object.getName(); } //... }
score: 2

http://stackoverflow.com/q/25034005
upvote count: 1
tagged with: maven-surefire-plugin
has answer: http://stackoverflow.com/a/25034102
tagged with: java
tagged with: groovy
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38985169
tagged with: junit
downvote count: 0
score: 1
accepted answer: http://stackoverflow.com/a/25034102
possible better answer: http://stackoverflow.com/a/25039686
has comment: http://stackoverflow.com/comment/38985429
favorite count: 0
has body: To depict the problem I encountered, let's assume there is a dummy class: import static java.lang.System.exit class Example { void methodGeneratingSystemExit1() { exit 1 } void methodGeneratingSystemExit2() { exit 2 } } And a test against it: import org.junit.Test import org.junit.Rule import org.junit.contrib.java.lang.system.ExpectedSystemExit class ExampleTest { @Rule public final ExpectedSystemExit expectedSystemExit = ExpectedSystemExit.none() @Test void "System exits with code 1 when method1 is generated"() { expectedSystemExit.expectSystemExitWithStatus(1) methodGeneratingSystemExit1() } @Test void "System exits with code 1 when method1 is generated"() { expectedSystemExit.expectSystemExitWithStatus(2) methodGeneratingSystemExit2() } } As I said, it's just dummy example but still test does what is supposed o do - when System.exit() is called, test notices that and is all green. The problem is, I have a surefire plugin that gives me a message like: ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.17:test (default-test) on project xtrakter: Execution default-test of goal org.apache.maven.plugins:maven-surefire-plugin:2.17:test failed: The forked VM terminated without properly saying goodbye. VM crash or System.exit called? How can I suppress that error in surefire? Or any other workaround/solution to that problem?
has answer: http://stackoverflow.com/a/25039686
type: Question
has title: Surefire fails because of checking if System.exit() was called in one of junit tests
answer count: 2
linked to: http://stackoverflow.com/q/309396

configuration-files
type: Tag
tags question: http://stackoverflow.com/q/25036357
tag name: configuration-files

http://stackoverflow.com/a/24962859
answers question: http://stackoverflow.com/q/24962664
accepted answer of: http://stackoverflow.com/q/24962664
type: AcceptedAnswer
score: 0
has comment: http://stackoverflow.com/comment/38822939
type: Answer
has body: I wouldn't recommend using your home computer as a web server. Here are the steps it takes to get a java web app up and running exposed to the internet. Buy a domain name from a registrar Find a host provider that gives you some sort of linux VM (CentOS, Debian, RHEL, etc). Lowendbox has some cheap ones. AWS is more expensive but you'll get the same thing Modify the DNS for wherever you registered to point to the IP address of the VM you just rented. ssh to your VM and install Java, as well as all the dependencies for your application server (Tomcat, JBoss, Netty, etc) via the command line Most of these servers run at port 8080 by default, so you will need to find a way to reroute requests from 80 to 8080 (do not run your server directly on 80). Best to let Apache run on 80 and forward the requests to 8080 (dependent on the server that you run) Deploy your application

http://stackoverflow.com/a/24971500
has comment: http://stackoverflow.com/comment/38830234
has comment: http://stackoverflow.com/comment/38837270
has comment: http://stackoverflow.com/comment/38840900
has comment: http://stackoverflow.com/comment/38840454
upvote count: 3
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38824758
accepted answer of: http://stackoverflow.com/q/24912060
type: Answer
has comment: http://stackoverflow.com/comment/38840150
has comment: http://stackoverflow.com/comment/38817944
answers question: http://stackoverflow.com/q/24912060
has body: Hej Peter, have you tried to put the TilePane into a ScrollPane, so you can scroll to the right if there are more Columns. Another idea is to increase the number of the Rows within the TilePane. I have a small example, i used a Person class, not your DataObject. Here is the Service class import java.util.ArrayList; import java.util.List; import java.util.Random; import javafx.concurrent.ScheduledService; import javafx.concurrent.Task; /** * * @author Patrick Ott &lt;Patrick.Ott@professional-webworkx.de&gt; * @version 1.0 */ public class JVMDataService extends ScheduledService&lt;List&lt;Person&gt;&gt; { private final Random generator = new Random(); @Override protected Task&lt;List&lt;Person&gt;&gt; createTask() { return new Task&lt;List&lt;Person&gt;&gt;() { @Override protected List&lt;Person&gt; call() throws Exception { int n = generator.nextInt(50); List&lt;Person&gt; persons = new ArrayList&lt;&gt;(); for (int i = 0; i &lt; n; i++) { System.out.println("i = " + i); persons.add(new Person("Max", "Mustermann", "max" + i + ".mustermann@example.com")); } return persons; } }; }; } And the App class import java.util.List; import javafx.application.Application; import static javafx.application.Application.launch; import javafx.concurrent.WorkerStateEvent; import javafx.event.EventHandler; import javafx.geometry.Orientation; import javafx.scene.Scene; import javafx.scene.control.ScrollPane; import javafx.scene.layout.AnchorPane; import javafx.scene.layout.HBox; import javafx.scene.layout.TilePane; import javafx.scene.layout.VBox; import javafx.scene.text.Text; import javafx.stage.Stage; import javafx.util.Duration; public class MainApp extends Application { JVMDataService service = new JVMDataService(); @Override public void start(Stage stage) throws Exception { AnchorPane root = new AnchorPane(); Scene scene = new Scene(root, 1280, 768); HBox hBox = new HBox(); final TilePane tilePane = new TilePane(Orientation.VERTICAL, 25, 20); tilePane.setPrefRows(15); ScrollPane s…
score: 3
downvote count: 0

http://stackoverflow.com/q/24924319
tagged with: generics
favorite count: 0
has answer: http://stackoverflow.com/a/24924559
type: Question
has title: Bound Mismatch error java generics
tagged with: java
upvote count: 1
answer count: 1
tagged with: mismatch
type: UnansweredQuestion
has body: Getting the error Bound mismatch: The generic method insertData(TreeNode, E) of type BinarySearchTree is not applicable for the arguments (TreeNode, T). The inferred type T is not a valid substitute for the bounded parameter > What is wrong with the below code? public class BinarySearchTree&lt;T extends Comparable&lt;? extends T&gt;&gt; implements Tree&lt;T&gt; { private TreeNode&lt;T&gt; root; @Override public void insert(T data) { // TODO Auto-generated method stub root = insertData(root,data); } @Override public void insert(TreeNode&lt;T&gt; node) { // TODO Auto-generated method stub } @Override public T remove(T data) { // TODO Auto-generated method stub return null; } @Override public boolean hasNode(T data) { // TODO Auto-generated method stub return false; } private &lt;E extends Comparable&lt;? super E&gt;&gt; TreeNode&lt;E&gt; insertData(TreeNode&lt;E&gt; node, E data) { if(node == null) { node = new TreeNode&lt;E&gt;(data); //return node; } else if(node.data.compareTo(data) &lt;= 0) node.left = insertData(node.left,data); else node.right = insertData(node.right,data); return node; } } public class TreeNode&lt;T&gt; { public TreeNode&lt;T&gt; left; public TreeNode&lt;T&gt; right; public T data; public TreeNode(T data) { this.left = null; this.right = null; this.data = data; } }
downvote count: 0
score: 1

http://stackoverflow.com/q/25014047
type: AnsweredQuestion
tagged with: java
score: -1
tagged with: dom
has comment: http://stackoverflow.com/comment/38896991
type: Question
has comment: http://stackoverflow.com/comment/38896838
accepted answer: http://stackoverflow.com/a/25194548
tagged with: arrays
answer count: 1
favorite count: 0
linked to: http://stackoverflow.com/q/8186896
has answer: http://stackoverflow.com/a/25194548
downvote count: 1
has comment: http://stackoverflow.com/comment/38933870
tagged with: parsing
tagged with: http://stackoverflow.com/tag/xml
upvote count: 0
has title: How to read nested elements in xml with dom parser or whatever
has comment: http://stackoverflow.com/comment/38897191
has body: I want to read nested elements and assign all elements and datas to two dimensional array. In the following xml example, the elements are , , , , , and the datas are m111,m22,m3. I want to transfer to 2D array like that is String array[][] = {{"M-1","M-11","M-111","m111"},{"M-2","M-22","m22"},{"M-3","m3"}}; Thanks. <MENU> m111 m22 m3 ...

http://stackoverflow.com/comment/38873965
comment on: http://stackoverflow.com/q/25001301
type: Comment
score: 0
type: QuestionComment
has text: This problem has nothing to do with Selenium! You are just looking for a way to parse arguments passed to a Java app.

http://stackoverflow.com/comment/38988925
type: QuestionComment
comment on: http://stackoverflow.com/q/25059576
score: 0
has text: highgui was split up into videoio,imcdodecs and highgui. it's not included in the jar, since there *is* no gui functionality for java
type: Comment

http://stackoverflow.com/comment/38859315
has text: The joys of copy-pasting .... String.valueOf(addressTxt.getText()), <-- you have an extra comma.
comment on: http://stackoverflow.com/q/24986341
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38995324
type: QuestionComment
comment on: http://stackoverflow.com/q/24996509
score: 0
has text: For a given .java file, the byte codes generated by javac compiler are always same. But at runtime JVM makes certain optimizations that may exclude some of the byte codes while execution. I'd recommend you to run your code in 2 JVMs with same settings (same compiler) and execute it for same duration. If it's a simple main method that you're running, you won't be able to capture the results accurately. You have to do some warm-up before you actually measure anything. Keep your logic in a loop of say 1M iterations and then see your counts
type: Comment

http://stackoverflow.com/q/24915256
upvote count: 0
has title: Split Java String with multiple occurence of special character
has comment: http://stackoverflow.com/comment/38711078
tagged with: string
has answer: http://stackoverflow.com/a/24915284
favorite count: 0
type: UnansweredQuestion
score: -3
has body: I would like to do the following in Java, and I can't figure out how. Suppose I have this variable: String text = "test1;test2;test3;test4;"; I would like to create a variable splitText that has the following : splitText[0] = test1 splitText[1] = test2 splitText[2] = test3 splitText[3] = test4 If I use the split method given in Java, I obtain: splitText[0] = test1 splitText[1] = test2;test3;test4 How can I do this?
tagged with: java
downvote count: 3
has answer: http://stackoverflow.com/a/24915308
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/38711002

spring-mvc
tags question: http://stackoverflow.com/q/24948882
tags question: http://stackoverflow.com/q/24917702
tags question: http://stackoverflow.com/q/24938798
tags question: http://stackoverflow.com/q/24917378
tags question: http://stackoverflow.com/q/24959658
tags question: http://stackoverflow.com/q/24939581
tags question: http://stackoverflow.com/q/25056207
tags question: http://stackoverflow.com/q/25028171
tags question: http://stackoverflow.com/q/25047751
tags question: http://stackoverflow.com/q/24910066
tags question: http://stackoverflow.com/q/24992521
tags question: http://stackoverflow.com/q/24933378
tags question: http://stackoverflow.com/q/24925053
tags question: http://stackoverflow.com/q/24978143
tags question: http://stackoverflow.com/q/25053215
tags question: http://stackoverflow.com/q/24927048
tags question: http://stackoverflow.com/q/24911984
tags question: http://stackoverflow.com/q/24970969
tags question: http://stackoverflow.com/q/24950411
tags question: http://stackoverflow.com/q/25005400
tags question: http://stackoverflow.com/q/24989608
tags question: http://stackoverflow.com/q/25065036
tags question: http://stackoverflow.com/q/25010454
tags question: http://stackoverflow.com/q/25037473
tags question: http://stackoverflow.com/q/24985832
tags question: http://stackoverflow.com/q/24987897
tags question: http://stackoverflow.com/q/25020331
tags question: http://stackoverflow.com/q/25045854
tags question: http://stackoverflow.com/q/24985177
tags question: http://stackoverflow.com/q/25062239
tags question: http://stackoverflow.com/q/24977431
tags question: http://stackoverflow.com/q/24947876
tags question: http://stackoverflow.com/q/24933866
tags question: http://stackoverflow.com/q/25002700
tags question: http://stackoverflow.com/q/24991123
tags question: http://stackoverflow.com/q/24992893
tags question: http://stackoverflow.com/q/24994351
tag name: spring-mvc
tags question: http://stackoverflow.com/q/25030008
tags question: http://stackoverflow.com/q/24935480
tags question: http://stackoverflow.com/q/25029438
tags question: http://stackoverflow.com/q/24992373
tags question: http://stackoverflow.com/q/25035125
tags question: http://stackoverflow.com/q/25042247
tags question: http://stackoverflow.com/q/25056937
tags question: http://stackoverflow.com/q/25048038
tags question: http://stackoverflow.com/q/24974451
tags question: http://stackoverflow.com/q/25004081
tags question: http://stackoverflow.com/q/25030534
tags question: http://stackoverflow.com/q/24932341
tags question: http://stackoverflow.com/q/25020895
tags question: http://stackoverflow.com/q/25055610
type: Tag
tags question: http://stackoverflow.com/q/25051958
tags question: http://stackoverflow.com/q/24955534
tags question: http://stackoverflow.com/q/24986367
tags question: http://stackoverflow.com/q/24928804
tags question: http://stackoverflow.com/q/25049404
tags question: http://stackoverflow.com/q/25054915
tags question: http://stackoverflow.com/q/24926646
tags question: http://stackoverflow.com/q/24985561
tags question: http://stackoverflow.com/q/24954345
tags question: http://stackoverflow.com/q/24969759
tags question: http://stackoverflow.com/q/24972437
tags question: http://stackoverflow.com/q/24916866
tags question: http://stackoverflow.com/q/25003013
tags question: http://stackoverflow.com/q/24950395
tags question: http://stackoverflow.com/q/25045217
tags question: http://stackoverflow.com/q/24917583
tags question: http://stackoverflow.com/q/24925146
tags question: http://stackoverflow.com/q/25054652
tags question: http://stackoverflow.com/q/25055878
tags question: http://stackoverflow.com/q/24922294
tags question: http://stackoverflow.com/q/25031241
tags question: http://stackoverflow.com/q/24969577
tags question: http://stackoverflow.com/q/25057478
tags question: http://stackoverflow.com/q/24957691
tags question: http://stackoverflow.com/q/24996726
tags question: http://stackoverflow.com/q/24993357
tags question: http://stackoverflow.com/q/25053527

http://stackoverflow.com/comment/38850732
comment on: http://stackoverflow.com/a/24984107
has text: Okay I see. Will do. Also I get an error in setActionListeners saying that it is an invalid method declaration when I move the start_timer.setOnClickListener to onCreate. tryna figure out why
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/24968218
score: 2
answers question: http://stackoverflow.com/q/24968171
upvote count: 2
accepted answer of: http://stackoverflow.com/q/24968171
type: AcceptedAnswer
downvote count: 0
has body: I want each [][] to have the same number of items that is equal to the number of people on the plane. Then I will add a nested for loop that will add a name for each of the flyers, and a meal choice. ultimately i need to be able to print out the array Name and their Meal choice. Almost, the issue here is you haven't specified a type for the array. flyer = new [numberOfFlyers][numberOfFlyers]; should probably be flyer = new String[numberOfFlyers][numberOfFlyers]; However that doesn't make a lot sense. One solution is to use, flyer = new String[numberOfFlyers][2]; where 0 is name and 1 is meal. But, really you should probably have a flyer POJO, flyer = new Flyer[numberOfFlyers]; Where Flyer might look something like, class Flyer { Flyer(String name, String mealType) { this.name = name; this.mealType = mealType; } String name; String mealType; public String toString() { return "Name: " + name + ", Meal: " + mealType; } } Then you can create new Flyer(s) and call toString() in your loop. You might also choose to add getter and setter functions for name and mealType.
type: Answer

http://stackoverflow.com/q/25049730
answer count: 0
score: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38964267
tagged with: web-services
has body: I have a web service method to take my own type object parameter and return it back after concatenating two strings of the parameter. This is my data type public class MyType implements Serializable{ String fName; String lName; public MyType(){ fName="fname"; lName="lanme"; } public MyType(String s1, String s2) { fName = s1; lName = s2; } } NetBeans did not allow me to deploy the web service with out the no argument constructor. This is my code part of the web service. @WebMethod(operationName = "objectMethod") public String objectMethod(@WebParam(name = "parameter") MyType parameter) { //TODO write your implementation code here: String s1=parameter.fName; String s2 = " Darshana "; String s=s1.concat(s2.concat(parameter.lName)); return s; } I am invoking this web service method by using an android application. It gives the output as fname Darshana lname. fname and lname are the values I have given in the no argument constructor for MyType. I am passing a same type object from the android application. I need to invoke the second constructor of the MyType class. How do I need to change my web service method for that? Thanks!
has comment: http://stackoverflow.com/comment/38964906
tagged with: java
has title: Invoking a constructor other than the default constructor for a self created object
type: Question
has comment: http://stackoverflow.com/comment/38964658
has comment: http://stackoverflow.com/comment/38964451
has comment: http://stackoverflow.com/comment/38964513
tagged with: constructor

http://stackoverflow.com/q/24955479
has answer: http://stackoverflow.com/a/24955847
has comment: http://stackoverflow.com/comment/38786210
possible better answer: http://stackoverflow.com/a/24955847
tagged with: int
score: 0
answer count: 3
tagged with: string
has answer: http://stackoverflow.com/a/24955557
has title: Java String to complete mathematical sum
accepted answer: http://stackoverflow.com/a/24955557
has body: In java, I am currently in the process of trying to find a way to do mathematical sums by typing in text to a JTextField, putting it into a String, and converting it to an int and solving. The problem is however, I don't want to simply put a number into the string but an actual sum including addition, subtraction etc. Currently it will accept just doing something like, 1 which will go from string and convert to an int, but when I do '1+1' or even just '1+' it throws exceptions everywhere because '+' isn't a number. Which I already understand that it wont work because int's only allow numbers. Is there a way I can safely type a complete sum into the text field and convert it to an int somehow? Like typing 7-2*5 and then the answer being held in an int? Thanks.
type: AnsweredQuestion
tagged with: numbers
tagged with: java
has answer: http://stackoverflow.com/a/24955676
type: Question

http://stackoverflow.com/comment/38910831
has text: @user1888162 in my case, I use the `SharedPreferences` to show the `WebView` just once everytime I open the application. So when I open another activity, and back again it won't show. But when I re start the application, It'll show again.
comment on: http://stackoverflow.com/q/25021116
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25028685
has comment: http://stackoverflow.com/comment/38940731
answers question: http://stackoverflow.com/q/25027946
score: 0
type: AcceptedAnswer
type: Answer
has body: Put your arrays into an ArrayList, then use Random to select one of the values within the array. Selecting a random value with the "R" file is not a good idea - your arrays may not be in numeric order. The Resource file is not generated always in an order that is intuitive or reliable for the code you have written. Pseudo code to initialize the array: ArrayList&lt;String[]&gt; randomArray = new ArrayList&lt;String[]&gt;(); int arrayCount = 0; randomArray.add(getResources().getStringArray(R.array.Array1)); // continue adding arrays Then use a random integer to select an array from randomArray based on its length. Since you are using "res" StringArrays, you can't have an indefinite number of arrays, otherwise your problem would be more complex.
accepted answer of: http://stackoverflow.com/q/25027946

http://stackoverflow.com/q/24984648
has comment: http://stackoverflow.com/comment/38841575
answer count: 1
tagged with: selenium-webdriver
tagged with: java
has body: I am trying to highlight an element. I want the highlight to remain for around 5-6 seconds but I'm not able to do so. The code for highlighting is working fine but it appears only for a flash. I tried achieving this using thread.sleep(), but couldn't achieve it. Can I define a conditional wait for such highlight using Explicit wait or any other method. Here is the code for highlighting the element : import java.util.Set; import java.util.concurrent.TimeUnit; import org.openqa.selenium.*; import org.openqa.selenium.firefox.FirefoxDriver; public class HighlightElement { public WebDriver driver; private String baseUrl; public static void main(String[] args) { HighlightElement obj=new HighlightElement(); obj.func(); // TODO Auto-generated method stub } public void func(){ driver=new FirefoxDriver(); driver.manage().window().maximize(); driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); baseUrl="http://www.creativebloq.com/netmag/get-started-django-7132932"; driver.get(baseUrl); WebElement ele=driver.findElement(By.xpath("//*[@id='main- content']/section/article/div/div/figure[1]/img")); highlightElement(driver, ele); try { Thread.sleep(5000); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } public void highlightElement(WebDriver driver, WebElement element) { for (int i = 0; i &lt; 2; i++) { JavascriptExecutor js = (JavascriptExecutor) driver; js.executeScript("arguments[0].setAttribute('style', arguments[1]);", element, "color: yellow; border: 2px solid yellow;"); js.executeScript("arguments[0].setAttribute('style', arguments[1]);", element, ""); }} } I also tried using the sleep method within the highlighElement(), but it is also not serving the purpose.
accepted answer: http://stackoverflow.com/a/24987167
has title: Waiting for a few seconds after highlighting an element using Webdriver
type: AnsweredQuestion
tagged with: javascript
has comment: http://stackoverflow.com/comment/38848422
type: Question
has answer: http://stackoverflow.com/a/24987167
score: 0
tagged with: selenium

http://stackoverflow.com/comment/38764498
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24943393
has text: This seems to be the easiest way, since my knowledge about Comparators is close to zero. My only question is why to use NavigableMap and not TreeMap at the start?
type: AnswerComment

http://stackoverflow.com/q/24922856
tagged with: java
has comment: http://stackoverflow.com/comment/38725836
has answer: http://stackoverflow.com/a/24922953
has title: In Java: Assigning a value in an array to a variable outside of an array
answer count: 3
possible better answer: http://stackoverflow.com/a/24922919
tagged with: arrays
has comment: http://stackoverflow.com/comment/38725813
has answer: http://stackoverflow.com/a/24922967
has answer: http://stackoverflow.com/a/24922919
favorite count: 0
tagged with: arraylist
accepted answer: http://stackoverflow.com/a/24922953
type: AnsweredQuestion
downvote count: 3
has comment: http://stackoverflow.com/comment/38725723
upvote count: 1
has body: EDITED QUESTION FOR CLARITY: Assume that an array of int named a has been declared with 12 elements. The integer variable k holds a value between 0 and 6. Assign 15 to the array element whose index is k. Currently I did something like this: for(int i = 0; i &lt; w.length; i++) { if(w[i] == k) { w[i] = k; } } Is my mode of thinking wrong? EDIT: This isn't homework. It's from my CS textbook practice exercises. I'm currently on break and have no teacher to ask. Sorry if it seems like I'm asking for homework help - that is not my intention. Just trying to understand, but this book isn't the most comprehensible thing I've read.
has comment: http://stackoverflow.com/comment/38725706
has comment: http://stackoverflow.com/comment/38725700
type: Question
score: -2

http://stackoverflow.com/q/24932763
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38743675
has comment: http://stackoverflow.com/comment/38743660
answer count: 4
tagged with: selenium-webdriver
score: 2
tagged with: junit4
downvote count: 0
tagged with: java
has body: I am new to junits. When I try to run my testsuite it is giving me this error. I googled but didn't get any answer. Posting the stacktrace. org.junit.runner.manipulation.NoTestsRemainException at org.junit.runners.ParentRunner.filter(ParentRunner.java:327) at org.junit.experimental.categories.Categories.&lt;init&gt;(Categories.java:151) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java:513) at org.junit.internal.builders.AnnotatedBuilder.buildRunner(AnnotatedBuilder.java:35) at org.junit.internal.builders.AnnotatedBuilder.runnerForClass(AnnotatedBuilder.java:24) at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:57) at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:29) at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:57) at org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:24) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.&lt;init&gt;(JUnit4TestReference.java:33) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestClassReference.&lt;init&gt;(JUnit4TestClassReference.java:25) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createTest(JUnit4TestLoader.java:48) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.loadTests(JUnit4TestLoader.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:452) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197) Here is the…
tagged with: webdriver
has answer: http://stackoverflow.com/a/50138606
has comment: http://stackoverflow.com/comment/38744024
type: Question
upvote count: 2
has answer: http://stackoverflow.com/a/24933312
has comment: http://stackoverflow.com/comment/38744288
linked to: http://stackoverflow.com/q/16587994
has answer: http://stackoverflow.com/a/75860202
has comment: http://stackoverflow.com/comment/38744141
has comment: http://stackoverflow.com/comment/38744012
tagged with: junit
linked to: http://stackoverflow.com/q/3257080
has answer: http://stackoverflow.com/a/27205516
favorite count: 0
has title: Getting NoTestsRemainException when I try to run my junits

http://stackoverflow.com/a/24986091
type: Answer
accepted answer of: http://stackoverflow.com/q/24985925
answers question: http://stackoverflow.com/q/24985925
has body: As your log says, your array index is out of bounds, because your array is empty. Initialize stringOnScreen and colorOnScreen AFTER calling setUpGame and do both before accessing the array. public class Stroop extends ActionBarActivity { HashMap&lt;String, Integer&gt; colors = new HashMap&lt;&gt;(); Object stringOnScreen[]; Object colorsOnScreen[]; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.stroop); setUpGame() stringOnScreen = colors.keySet().toArray(); colorOnScreen = colors.values().toArray(); Log.d("test", "test: " + stringOnScreen[2].toString()); } ... }
has comment: http://stackoverflow.com/comment/38844448
score: 0
has comment: http://stackoverflow.com/comment/38844352
type: AcceptedAnswer

http://stackoverflow.com/q/24944928
downvote count: 2
tagged with: swing
has comment: http://stackoverflow.com/comment/38767634
has body: In this program I am trying to initialize an array of book objects and have them displayed in a JPanel that will allow them to be sorted based on which radio button is selected by the user. I have not finished some of the back-end sorting constructors but I am trying to get through the full functionality first. Here is my object class that has all the getters/setters: import java.util.Comparator; public class SchoolTextBook { private String author; private String title; private int pageCount; private String ISBN; private double price; public String getAuthor() { return author; } public void setAuthor(String author) { this.author = author; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public int getPageCount() { return pageCount; } public void setPageCount(int pageCount) { this.pageCount = pageCount; } public String getISBN() { return ISBN; } public void setISBN(String iSBN) { ISBN = iSBN; } public double getPrice() { return price; } public void setPrice(double price) { this.price = price; } public static Comparator<SchoolTextBook> BookAuthorComparator = new Comparator<SchoolTextBook>() { public int compare(SchoolTextBook book1, SchoolTextBook book2) { String bookName1 = book1.getAuthor().toUpperCase(); String bookName2 = book2.getAuthor().toUpperCase(); //ascending order return bookName1.compareTo(bookName2); } }; public static Comparator<SchoolTextBook> BookTitleComparator = new Comparator<SchoolTextBook>() { public int compare(SchoolTextBook book1, SchoolTextBook book2) { String bookName1 = book1.getTitle().toUpperCase(); String bookName2 = book2.getTitle().toUpperCase(); //ascending order return bookName1.compareTo(bookName2); } }; } And here is my sort class that initializes the objects and sets their attributes(this class will also display the gui... I think): import java.util.Arrays; import javax.swing.*; public class SchoolTextBookSort { public static String show() { StringBuilder sb = new StringBuilde…
tagged with: java
type: Question
upvote count: 0
score: -2
tagged with: event-handling
tagged with: sorting
has answer: http://stackoverflow.com/a/24946318
has comment: http://stackoverflow.com/comment/38767317
has title: Book sort program
has comment: http://stackoverflow.com/comment/38768746
tagged with: radio-button
answer count: 1
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/q/24962242
has comment: http://stackoverflow.com/comment/38814397
has comment: http://stackoverflow.com/comment/38809706
type: UnansweredQuestion
tagged with: android
type: Question
linked to: http://stackoverflow.com/q/23353173
has comment: http://stackoverflow.com/comment/38814437
linked to: http://stackoverflow.com/q/15346199
tagged with: java
has comment: http://stackoverflow.com/comment/38800073
has comment: http://stackoverflow.com/comment/38799776
has comment: http://stackoverflow.com/comment/38809875
score: 0
has answer: http://stackoverflow.com/a/24962488
has title: My program when rum on emulator it says "unfortunately stopped"
answer count: 1
has body: hey guys i am doing a basic program and i want to add an mp3 file in the setContentView file if i use setContentView(R.layout.yoyo) "yoyo my mp3 file name" i got errors actually i created a sub folder in "lib" as "raw" in which my mp3 file "yoyo" was placed. so i gave setContentView(R.raw.yoyo) the error was gone but when i stimulate in the emulator there are errors Installation failed due to invalid URI! [2014-07-26 11:35:49 - Firstone] Please check logcat output for more details. [2014-07-26 11:35:50 - Firstone] Launch canceled! my Log cat out put 07-26 18:52:15.958: W/ActivityManager(1263): Activity destroy timeout for ActivityRecord{b2209a10 u0 com.firstone/.Splash t7 f} 07-26 18:52:34.779: W/linker(1756): libdvm.so has text relocations. This is wasting memory and prevents security hardening. Please fix. 07-26 18:52:36.829: E/memtrack(1756): Couldn't load memtrack module (No such file or directory) 07-26 18:52:36.829: E/android.os.Debug(1756): failed to load memtrack module: -2 07-26 18:52:38.489: W/linker(1767): libdvm.so has text relocations. This is wasting memory and prevents security hardening. Please fix. 07-26 18:52:40.319: E/memtrack(1767): Couldn't load memtrack module (No such file or directory) 07-26 18:52:40.319: E/android.os.Debug(1767): failed to load memtrack module: -2 07-26 18:52:41.219: I/ActivityManager(1263): START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=com.firstone/.Splash} from pid 1767 on display 0 07-26 18:52:41.719: E/libEGL(938): called unimplemented OpenGL ES API 07-26 18:52:41.729: E/libEGL(938): called unimplemented OpenGL ES API 07-26 18:52:41.729: E/libEGL(938): called unimplemented OpenGL ES API 07-26 18:52:41.729: E/libEGL(938): called unimplemented OpenGL ES API 07-26 18:52:41.729: E/SurfaceFlinger(938): glCheckFramebufferStatusOES error 779177132 07-26 18:52:41.729: E/SurfaceFlinger(938): got GL_FRAMEBUFFER_COMPLETE_OES error while taking screenshot 07-26 18:52:41.729: E/lib…

http://stackoverflow.com/q/24948132
tagged with: icecast
has comment: http://stackoverflow.com/comment/38774465
tagged with: java
tagged with: file
tagged with: inputstream
type: Question
score: 0
has body: Im trying to write a local OGG file from a icecast mount point with ogg data. I make the connection with URL, get the InputStream and capture this in a AudioInpustStream that support OGG format through vorbisspi, i can play this in the dataline and i can write data on a ogg file but i cant play this file on vlc player, i try with this code and i dont have errors in the compilation. Click here to data line example CODE. public class AppSave { private URL url; private URLConnection urlconection; private InputStream inputStream; private AudioInputStream aisin; private File file; public AppSave() { url = null; urlconection = null; inputStream = null; aisin = null; } public static void main(String[] args) throws LineUnavailableException, IOException { final AppSave player = new AppSave(); player.save("http://192.168.0.21/virtual.ogg");//Mount point } public void save(String mountpoint) throws LineUnavailableException, IOException { try { url = new URL(mountpoint); //URL icecast mount point } catch (MalformedURLException ex) { System.err.println("URL Malformed " + mountpoint); } try { urlconection = url.openConnection();//open connexion with URL } catch (IOException ex) { System.err.println("Connexion unrealized"); } try { inputStream = urlconection.getInputStream();//get raw data } catch (IOException ex) { System.err.println("InputStream without data"); } try { try { aisin = getAudioInputStream(inputStream);//prepare data for playback } catch (IOException ex) { System.err.println("Unsupported format"); } final AudioFormat outFormat = getOutFormat(aisin.getFormat());//obtain format String pathfile = "/home/stream/myfile.ogg";//output file path File file = createfile(pathfile); savestream(getAudioInputStream(outFormat, aisin), file); } catch (UnsupportedAudioFileException e) { System.err.println("Error: "+e.getMessage()); } } private AudioFormat getOutFormat(AudioFormat inFormat) {//obtain format final int ch = inFormat.getChannels(); final float rate = inFormat.getSampleR…
tagged with: ogg
has comment: http://stackoverflow.com/comment/38773533
answer count: 0
has comment: http://stackoverflow.com/comment/38774274
type: UnansweredQuestion
has title: Write a OGG file from a InputStream

http://stackoverflow.com/a/24981888
answers question: http://stackoverflow.com/q/24981777
type: Answer
has body: Other users have run into this issue as well with Cloud 9. See the following thread on the Cloud 9 site. One of the users wrote up a little snippet on there which should work for you. enter link description here
score: 0

http://stackoverflow.com/comment/38805658
has text: I think I found the solution: windowClosed(). Documentation says: Invoked when a window has been closed as the result of calling dispose on the window.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24965518

http://stackoverflow.com/q/25066553
answer count: 0
tagged with: java
tagged with: multithreading
has title: Android MainActivity thread in a for loop
type: Question
has comment: http://stackoverflow.com/comment/38996196
score: 0
has comment: http://stackoverflow.com/comment/38996136
tagged with: handler
has body: I just started android dev literally 1 day ago. In the code below, i simply want the For loop to sleep for 5 seconds after every iteration. However, it only runs and prints once. I'm not sure what I'm doing wrong. Log cat: 07-31 17:49:58.656: I/System.out(511): 07-31 17:49:58.665: I/System.out(511): START 07-31 17:49:58.676: I/System.out(511): NAMECHECK: NOTAVALIBLE 07-31 17:49:58.676: I/System.out(511): SUGGESTIONS: 07-31 17:49:58.676: I/System.out(511): END protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); TextView tv = new TextView(this); int count; try { String contents = ""; u = new URL("http://rscript.org/lookup.php?type=namecheck&amp;name=itachi"); final HttpURLConnection con = (HttpURLConnection) u.openConnection(); br = new BufferedReader(new InputStreamReader(con.getInputStream())); for (count = 0; count &lt; 5; count++) { while ((contents = br.readLine()) != null) { System.out.println(contents); if (contents.contains(" AVALIBLE")) { tv.setText("Available, sent mail " + count); break; } tv.setText("Not Available " + count); } final Handler handler = new Handler(); handler.postDelayed(new Runnable() { @Override public void run() { try { u = new URL("http://rscript.org/lookup.php?type=namecheck&amp;name=itachi"); br = new BufferedReader(new InputStreamReader(con.getInputStream())); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }, 5000); } setContentView(tv); con.disconnect(); br.close(); } catch (IOException | InterruptedException e) { e.printStackTrace(); } }
has comment: http://stackoverflow.com/comment/38996099
has comment: http://stackoverflow.com/comment/38996081
type: UnansweredQuestion
tagged with: android

http://stackoverflow.com/comment/38846667
type: QuestionComment
comment on: http://stackoverflow.com/q/24970707
has text: @beginer yes, that's it.
score: 0
type: Comment

http://stackoverflow.com/a/24973584
answers question: http://stackoverflow.com/q/24973560
has comment: http://stackoverflow.com/comment/38820717
upvote count: 7
downvote count: 1
has body: It looks like you meant to write: private void a1_Click(object sender, EventArgs e) { Button b = (Button)sender; if (turn) { b.Text = "X"; } else { b.Text = "O"; } turn = !turn; } As was said, the if(true) block will always be evaluated, leaving the else block unreachable. Note: Just a note here, this would be where I would use the ternary operator (As long as the conventions you're following allow you to. [The usage of the operator should be consistent]). You would get b.Text = turn ? "X" : "O" instead of the if/else block. You can also declare "X" and "O" as constants in static final variables to allow improve readability and make modifications easier.
has comment: http://stackoverflow.com/comment/38820691
score: 6
has comment: http://stackoverflow.com/comment/38820713
type: Answer

http://stackoverflow.com/q/24953007
downvote count: 0
has comment: http://stackoverflow.com/comment/38782919
favorite count: 0
has comment: http://stackoverflow.com/comment/38785126
tagged with: cdata
has comment: http://stackoverflow.com/comment/38784034
has answer: http://stackoverflow.com/a/24957049
type: AnsweredQuestion
score: 1
has comment: http://stackoverflow.com/comment/38786740
tagged with: java
accepted answer: http://stackoverflow.com/a/24957049
upvote count: 1
type: Question
tagged with: jsoup
tagged with: tags
has title: Automatic way for parsing tags inside CDATA with Jsoup without replace
has body: I'm reading information from a RSS that store on description tag HTML code, it isn't text plain. I need to extract some information like the first image would appear but I can't do it because all tags that are inside description aren't parsed by Jsoup I suppose by the behaviour of CDATA element. On my question I referer to "Automatic way" because I saw on other question published here that I would use .replace() to remove CDATA but it does not seem me an effective solution as I think it would serve to specific cases, not for universal purpose. So my question is if there is a way to Jsoup make that parse without replacing text by me? Is this the only way that exists? I should use other library? For example, when I parsed the RSS document, the node description has this: &amp;lt;table width='100%' border='0' cellspacing='0' cellpadding='4'&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td align='left' width='10'&amp;gt;&amp;lt; a href='http://www.3djuegos.com/noticia/145062/0/bioware-nuevo-juego-ip/video-gamescom/trailer/'&amp;gt;&amp;lt;img src='http://i11c.3djuegos.com/juegos/7332/dragon_age_iii/fotos/noticias/dragon_age_iii-2583054.jpg' border='0' width='70' height='52' /&amp;gt; &amp;lt;/a&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td align='left' valign='top'&amp;gt;Parece ser una nueva licencia creativa, seg&amp;uacute;n lo visto en un enigm&amp;aacu All special chars "&lt;>" are scaped because CDATA works so. The rest of document is well parsed only happens with CDATA content. The code that I use to access: doc = Jsoup.connect("http://www.3djuegos.com/universo/rss/rss.php?plats=1-2-3-4-5-6-7-34&amp;tipos=noticia-analisis-avance-video-imagenes-demo&amp;fotos=peques&amp;limit=20").get(); System.out.println(doc.html()); // Shows the document well parsed. Elements nodes = doc.getElementsByTag("item"); // Access to news for(int i = 0; i &lt; nodes.size(); i++){ // Loop all news // Description node Element decriptionNode = nodes.get(i).getElementsByTag("description").get(0); // Shows conten…
answer count: 1

http://stackoverflow.com/comment/38826812
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24976657
has text: Read the duplicate, it will show you the answer.

http://stackoverflow.com/q/25038488
has title: Validate hibernate mapping file against database for ALL differences
score: 1
tagged with: java
tagged with: hibernate
upvote count: 1
has body: I need to validate my hibernate mapping file against some databases. We have quite a complicated schema, and for various reasons we have different branches of the schema on various different databases. So I want to be able to compare my hibernate mapping files with a database. I have tried the hbm2ddl=validate flag, but this throws an error on the first difference it finds and stops. Is there any way to carry on and print ALL differences? Or some plugin for hibernate or some other free tool I can use that will do this? I have looked at something like Liquibase, and will go down this route if it's the best option, but it seems like since I already have hibernate set up, some config I can change or a plugin that I can just drop in would be easiest.
type: Question
has answer: http://stackoverflow.com/a/25038895
answer count: 1
downvote count: 0
favorite count: 0
type: UnansweredQuestion
tagged with: hibernate-mapping

http://stackoverflow.com/q/24946834
has answer: http://stackoverflow.com/a/24946866
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/38771106
upvote count: 0
has answer: http://stackoverflow.com/a/24946906
favorite count: 0
tagged with: android
has title: PrintStream Println behaves differently on diff machines?
has comment: http://stackoverflow.com/comment/38770895
score: -1
has comment: http://stackoverflow.com/comment/38771071
type: UnansweredQuestion
downvote count: 1
has body: I have a simple server and client software. The server running on mac and have my custom code written in C to emulate a readline from socket. Client written in java for android and windows machine. I am observing strange behaviour from Println call. the code looks like this PrintStream ps = new PrintStream(clientSocket.getOutputStream()); JSONObject json = new JSONObject(responseMap); String buffer = json.toString(); ps.println(buffer); ps.flush(); The println when run on windows, sends /r/n after the buffer string. The println when run on android, sends /n after the buffer string. Should the behaviour of println not be consistent accross diff OS/machines ?
has comment: http://stackoverflow.com/comment/38770755
tagged with: java

http://stackoverflow.com/comment/38847641
comment on: http://stackoverflow.com/q/24987587
type: Comment
type: QuestionComment
score: 1
has text: Well part of it is that you are checking one object, v, for null, but you are calling getId() on newColonyHut. It may be the case that v is not null, but newColonyHut is, so maybe you mean to save the id from v, or check if newColonyHut is null? At any rate, your ImageButton is not being initialized correctly, and I don't know why

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

graphics
tag name: graphics
tags question: http://stackoverflow.com/q/24966185
tags question: http://stackoverflow.com/q/25007946
type: Tag
tags question: http://stackoverflow.com/q/24971180
tags question: http://stackoverflow.com/q/25002281
tags question: http://stackoverflow.com/q/24957752
tags question: http://stackoverflow.com/q/24983411
tags question: http://stackoverflow.com/q/24925714
tags question: http://stackoverflow.com/q/24971437
tags question: http://stackoverflow.com/q/24925379

http://stackoverflow.com/q/24985768
downvote count: 0
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24985820
has body: We have a separate Java project completely dedicated to functional testing of our web application with TestNG and Selenium (we refer to it as the Test Suite). It is pretty sophisticated and uses Spring for dependency injection extensively. The entry point, where Application context is initialized and the beans used to initialize other beans are defined, is the AbstractTest class, which is a base class for all test classes in the suite, and is declared like this: @ContextConfiguration("classpath*:applicationContext*.xml") public class AbstractTest extends AbstractTestNGSpringContextTests { ... Now I need to add two listeners: public class CustomSuiteListener implements ISuiteListener — to perform some actions before our tests run (e.g. log in to the web application and set it up via Web UI), and public class CustomTestMethodInterceptor implements IMethodInterceptor — to filter away those methods that should not run this time based on external decision mechanism (e.g. known open bugs). Both these listeners require to load the application context because all settings (web application URL, credentials, database etc) are declared there; also bean autowiring would be of much help there. For now, in both listeners I have to explicitly create a new application context in this fashion: public class CustomSuiteListener implements ISuiteListener { @Override public void onStart(ISuite suite) { ApplicationContext applicationContext = new ClassPathXmlApplicationContext("classpath*:applicationContext*.xml"); WebDriverProvider provider = (WebDriverProvider) applicationContext.getBean("webDriverProvider"); ObjectInitializer objectInitializer = (ObjectInitializer) applicationContext.getBean("objectInitializer"); // other beans... The problem is that, in addition to application context init in AbstractTest, every such call results in application context being loaded again and again; given that the suite is already big and is promising to grow fast, this results in a huge time waste. T…
tagged with: spring
tagged with: testng
score: 2
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/24986085
has title: How to use a single Spring ApplicationContext across the whole TestNG suite?
upvote count: 2
answer count: 2

http://stackoverflow.com/q/25032331
has answer: http://stackoverflow.com/a/25032408
has answer: http://stackoverflow.com/a/25033106
answer count: 4
score: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25032430
downvote count: 0
tagged with: java
tagged with: struts-1
has body: I have written a web-application in Struts 1 framework. Everything works fine but on form submission, when user is forwarded to the next page, the URL, which is shown, is actionname.do. I don't want this Struts 1 default suffix on URL. Instead of it I would like to see page's name in URL. How to do it? Note : I have tried editing servlet mapping in web.xml. Have replaced *.do with / . But In that case even my index page doesn't open.
type: Question
possible better answer: http://stackoverflow.com/a/25032438
tagged with: struts
has answer: http://stackoverflow.com/a/25032438
upvote count: 2
tagged with: url
accepted answer: http://stackoverflow.com/a/25032408
has title: How to remove '.do' extention from action URL in Struts 1?
favorite count: 0

http://stackoverflow.com/comment/38745587
has text: For each class, there is just constructor being implemented. Is it awkward ?
comment on: http://stackoverflow.com/a/24933615
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/25006314
has comment: http://stackoverflow.com/comment/38882420
type: UnansweredQuestion
tagged with: space-complexity
has answer: http://stackoverflow.com/a/25006810
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/38882270
type: Question
has comment: http://stackoverflow.com/comment/38882242
has comment: http://stackoverflow.com/comment/38882201
tagged with: data-structures
has comment: http://stackoverflow.com/comment/38882220
has body: So I'm working on a presentation where I'm trying to show how much more effective a certain program would be if we were to use primitive types instead of wrapper classes, and I'm trying to find the space complexity of different wrappers and how many bytes are being used for which tasks. Can someone help me figure out how many bytes are being used for what in an Integer or a Double? Thanks!
answer count: 1
has comment: http://stackoverflow.com/comment/38882990
has title: space complexity of wrapper classes
linked to: http://stackoverflow.com/q/8419860
linked to: http://stackoverflow.com/q/52353

http://stackoverflow.com/comment/38939586
score: 0
comment on: http://stackoverflow.com/a/25020344
type: Comment
type: AnswerComment
has text: Sadly no better ideas. Hopefully this activity will lure in an expert? Good luck.

http://stackoverflow.com/q/24953980
downvote count: 0
score: 1
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/24956462
tagged with: database
tagged with: caching
type: Question
tagged with: second-level-cache
upvote count: 1
has body: I was wondering about the default concurrency strategy for the Query level caching in Hibernate if we do not provide it explicitly. I have gone through the link https://docs.jboss.org/hibernate/orm/4.0/manual/en-US/html/performance.html#performance-cache but unable to find the exact solution. Any help? Thanks.
answer count: 1
favorite count: 0
type: UnansweredQuestion
has title: Default Concurrency strategy for Query Cache in Hibernate using ECache

http://stackoverflow.com/comment/44128498
score: 0
type: AnswerComment
type: Comment
has text: Boy would that have been nice a few months ago!! :)
comment on: http://stackoverflow.com/a/27853391

http://stackoverflow.com/q/24925046
score: 1
favorite count: 0
type: Question
tagged with: java
tagged with: hibernate
upvote count: 1
answer count: 0
type: UnansweredQuestion
has body: I'm really new to Hibernate and currently upgrading Hibernate from 4.1.9 to 4.3.5. Here is the list of existing hibernate jars: antlr-2.7.7.jar,hibenate-commons-annotations-4.0.1.Final.jar ,hibernate-core-4.1.9.Final.jar ,hibernate-jpa-2.0-api-1.0.1.Final.jar ,javassist-3.17.1-GA.jar ,jboss-logging-3.1.0.GA.jar,jboss-transaction-api_1.1_spec-1.0.0.Final.jar I've replaced these jars with the latest Hibernate jars. Here is the list: antlr-2.7.7.jar,hibernate-commons-annotations-4.0.4.Final.jar,hibernate-core-4.3.5.Final.jar,hibernate-jpa-2.1-api-1.0.0.Final.jar,javassist-3.18.1-GA.jar,jboss-logging-3.1.3.GA.jar,jboss-transaction-api_1.2_spec-1.0.0.Final.jar After replacing the jars I get a compilation error, and I've changed the below code to fix the issue: /* Existing code */ ServiceRegistry serviceRegistry = new ServiceRegistryBuilder() .applySettings(config.getProperties()) .buildServiceRegistry(); /* Modified code */ ServiceRegistry serviceRegistry = new ServiceRegistryBuilder() .applySettings(config.getProperties()) .build(); Issue: As I run my application one of the operations is getting an empty HashSet, whereas with the earlier version of the Hibernate jars it was getting a PersistentSet. I'm checking if the object is empty or not. With the PersistentSet it clears the check, but with the HashSet it fails the check for the same data. Is there anything else I need to do this upgrade? Is there anything which I need to change to handle this kind of situation while doing this upgrade? The application is using Hibernate mapping. Here is the mapping for the set I was talking about above: &lt;set name="Code" cascade="all-delete-orphan" inverse="true" where="created_date=(select max(c.created_date) from dma_step_code c where c.step_id=step_id)"&gt; &lt;key column="step_id"/&gt; &lt;one-to-many class="com.hp.dma.data.action.SOPActionCode" /&gt; &lt;/set&gt;
has title: Issue with Hibernate 4.3.5 upgrade
downvote count: 0

http://stackoverflow.com/q/25011061
favorite count: 0
score: 28
has answer: http://stackoverflow.com/a/25011208
accepted answer: http://stackoverflow.com/a/25011208
linked to: http://stackoverflow.com/q/41311361
has answer: http://stackoverflow.com/a/25011218
has title: Why can enum implementations not access private fields in the enum class
answer count: 4
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38891233
downvote count: 0
has comment: http://stackoverflow.com/comment/38891265
tagged with: java
upvote count: 28
type: Question
has answer: http://stackoverflow.com/a/25011219
tagged with: enums
linked to: http://stackoverflow.com/q/25010763
has answer: http://stackoverflow.com/a/42172034
has body: I just answered this question by saying how to solve the compilation problem: How to use fields in java enum by overriding the method? But what I don't understand is why the error is happening in the first place. Here is the example written as an enum: public enum MyEnum { FIRST { @Override public String doIt() { return "1: " + someField; //error } }, SECOND { @Override public String doIt() { return "2: " + super.someField; //no error } }; private String someField; public abstract String doIt(); } Here is the exact same thing as abstract classes abstract class MyClass { class FIRST extends MyClass { @Override public String doIt() { return "1: " + someField; //no error } }; class SECOND extends MyClass { @Override public String doIt() { return "2: " + super.someField; //no error } }; private String someField; public abstract String doIt(); } In the case of FIRST within the enum implementation it cannot access someField. However in the abstract class case it can. Additionally adding super fixes the problem, as does removing the private modifier on the field. Does anyone know why this slight quirk in the behaviour is happening?
has comment: http://stackoverflow.com/comment/38891461
possible better answer: http://stackoverflow.com/a/25011218

http://stackoverflow.com/q/24922461
duplicate of: http://stackoverflow.com/q/7352493
upvote count: 2
has answer: http://stackoverflow.com/a/24922523
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38724989
downvote count: 1
score: 1
tagged with: java
tagged with: eclipse
type: Question
has comment: http://stackoverflow.com/comment/38725043
has body: I really need to re-install it since I can't open it all of a sudden. How do I do this without deleting any work that I've done? The problem is that eclipse "failed to lodd JNI shard library" etc etc.
answer count: 1
has comment: http://stackoverflow.com/comment/38725006
favorite count: 0
has comment: http://stackoverflow.com/comment/38726566
linked to: http://stackoverflow.com/q/7352493
has comment: http://stackoverflow.com/comment/38725098
has comment: http://stackoverflow.com/comment/38727227
has comment: http://stackoverflow.com/comment/38727248
has title: I want to reinstall eclipse due to complications, how do I do this, will it keep my work safe?

http://stackoverflow.com/q/25018356
has comment: http://stackoverflow.com/comment/38911407
tagged with: java
type: Question
tagged with: hadoop
tagged with: intellij-idea
answer count: 1
has body: I have a Map-only Job configured to run in distributive mode. When I run it throw CLI, Job runs successfully. Launch string looks like: hadoop jar FileHandy.jar com.company.MainRun arg1 arg2 But if I run it via IDE (Intellij IDEA), it fails with error (could not find Mapper class): 14/07/30 01:07:34 WARN mapred.JobClient: Use GenericOptionsParser for parsing the arguments. Applications should implement Tool for the same. 14/07/30 01:07:34 WARN mapred.JobClient: No job jar file set. User classes may not be found. See JobConf(Class) or JobConf#setJar(String). 14/07/30 01:07:35 INFO input.FileInputFormat: Total input paths to process : 1 14/07/30 01:07:36 INFO mapred.JobClient: Running job: job_201407300013_0001 14/07/30 01:07:37 INFO mapred.JobClient: map 0% reduce 0% 14/07/30 01:07:55 INFO mapred.JobClient: Task Id : attempt_201407300013_0001_m_000000_0, Status : FAILED java.lang.RuntimeException: java.lang.ClassNotFoundException: Class com.expedia.eww.FileMapper not found at org.apache.hadoop.conf.Configuration.getClass(Configuration.java:1617) at org.apache.hadoop.mapreduce.task.JobContextImpl.getMapperClass(JobContextImpl.java:191) at org.apache.hadoop.mapred.MapTask.runNewMapper(MapTask.java:631) at org.apache.hadoop.mapred.MapTask.run(MapTask.java:330) 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:1408) at org.apache.hadoop.mapred.Child.main(Child.java:262) Caused by: java.lang.ClassNotFoundException: Class com.expedia.eww.FileMapper not found at org.apache.hadoop.conf.Configuration.getClassByName(Configuration.java:1523) at org.apache.hadoop.conf.Configuration.getClass(Configuration.java:1615) ... 8 more I've setup IDE and use maven pom.xml with dependencies only (I using jar file generated by Build process by IDEA instead of maven jar, but if using maven j…
accepted answer: http://stackoverflow.com/a/25032967
score: 0
has title: Run Hadoop MR Job via Intellij IDEA
has answer: http://stackoverflow.com/a/25032967
has comment: http://stackoverflow.com/comment/38929696
type: AnsweredQuestion

http://stackoverflow.com/comment/53318244
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24963084
has text: @JanZyka and yet, after 1 year they still don't publish it to maven central
score: 0

http://stackoverflow.com/comment/38956217
has text: If you're pasting into a terminal, the terminal might treat the first newline as the end of input and try to interpret the rest as commands. Depending on the shell, you'd have to use something like a "here document" to pass the whole input to the Java program.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25026476
score: 1

http://stackoverflow.com/a/25046472
answers question: http://stackoverflow.com/q/25046392
type: Answer
has comment: http://stackoverflow.com/comment/38958351
score: 0
has comment: http://stackoverflow.com/comment/38958248
has body: SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS"); format.format(now);

http://stackoverflow.com/comment/38797452
comment on: http://stackoverflow.com/q/24961134
type: Comment
type: QuestionComment
score: 0
has text: Please see my answer here: http://stackoverflow.com/a/24916387/3827276

http://stackoverflow.com/comment/38989919
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25063447
has text: Yes dataDir(folder) is just the folder where the file is stored. It works fine when the test is run in intelij but on maven it doesnt? I think it has something to do with the path

http://stackoverflow.com/comment/38749743
type: QuestionComment
has text: you are right, I used log4j-jcl version 2.0 which is new from July 14 which use common logging version 1.2 while my spring core use common loggin version 1.1.1. so I change the the version of log4j-jcl to be 2.0-beta8 and it solved the conflict. 10x!
score: 0
type: Comment
comment on: http://stackoverflow.com/q/24932926

http://stackoverflow.com/q/25037486
downvote count: 0
favorite count: 0
tagged with: android
tagged with: opengl-es
type: UnansweredQuestion
score: 1
has title: Andengine getLastChild() error
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/25089643
tagged with: java
tagged with: eclipse
tagged with: andengine
has body: I get the following error while i run the andengine activity java: cannot find symbol symbol: method getLastChild() location: variable scene of type org.anddev.andengine.entity.scene.Scene i have included all the andengine jar files and added it as a refernced library.Please help. Is this method redundant now? If so are there any alternatives for that? Or is it because i develop my games on a computer which doesnt have graphics. I have developed many apps for android. But i am having problems with this andengine game development.Please help. Here is the code block that has the error. public Scene onLoadScene() { this.mEngine.registerUpdateHandler(new FPSLogger()); final Scene scene = new Scene(1); final int centerX = (CAMERA_WIDTH - this.mSplashTextureRegion.getWidth()) / 2; final int centerY = (CAMERA_HEIGHT - this.mSplashTextureRegion.getHeight()) / 2; final Sprite splash = new Sprite(centerX, centerY, this.mSplashTextureRegion); scene.getLastChild().attachChild(splash); return scene; }
answer count: 1

http://stackoverflow.com/a/24983714
upvote count: 2
answers question: http://stackoverflow.com/q/24983606
has body: Generated bytecode: BIPUSH 20 ISTORE 1 ILOAD 1 ICONST_5 DUP ISTORE 1 IADD ISTORE 1 RETURN LOCALVARIABLE a I First, you assign 20 to the first variable (a): BIPUSH 20 ISTORE 1 Then, you load the contents of the first variable to stack (20 is put on stack): ILOAD 1 Then, you push the constant '5' to the stack twice (20 5 5): ICONST_5 DUP Then, you store the top of the stack to the first variable (a): ISTORE 1 a is now 5, stack is now (20 5). We add both operands and put their sum to the first variable (a): IADD ISTORE 1 As a consequence, a is now 20 + 5 = 25. We end: RETURN
score: 2
downvote count: 0
type: Answer

http://stackoverflow.com/comment/38940463
type: Comment
has text: Sorry, once again, do you know how to add table header programmatically?
comment on: http://stackoverflow.com/a/25036654
type: AnswerComment
score: 0

http://stackoverflow.com/q/25059114
tagged with: web-services
has comment: http://stackoverflow.com/comment/38981816
has body: Hi I am new to android development. I have created a soap webservices and created a android application to get username and password as shown below: Firstscreen.xml: <?xml version="1.0" encoding="utf-8"?> <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:hint="@string/hint" android:text="@string/username" /> <EditText android:id="@+id/enterusername" android:layout_width="fill_parent" android:layout_height="wrap_content" android:inputType="text" /> <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:hint="@string/hint" android:text="@string/password" /> <EditText android:id="@+id/entertextpassword" android:layout_width="fill_parent" android:layout_height="wrap_content" android:inputType="textPassword" /> So, I will get two fields(username and password) from user. I want to post or send the data to a SOAP webservice which has url: "http://localhost:8100/ws/hello?wsdl" and Qname: "http://Common.Hospital/", "HelloWorldImplService". Can anybody help me to get resolved my problem. Thanks in advance.
has answer: http://stackoverflow.com/a/25059284
type: Question
has title: How to send data to SOAP Webservice from an android application?
has answer: http://stackoverflow.com/a/25077336
linked to: http://stackoverflow.com/q/297586
tagged with: java
score: 0
answer count: 2
accepted answer: http://stackoverflow.com/a/25077336
tagged with: android
tagged with: soap
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/25059284

http://stackoverflow.com/a/24922143
type: Answer
upvote count: 1
has body: The difference between Dalvik and ART can be really simplified to point that. Dalvik is JIT (Just-in-Time) and ART is AOT (Ahead-of-Time). This refer too the generation of executable code. So all guides that ware valid for dalvik are also valid for ART. In your case with ArrayList, a better solution in term of memory allocation is the counted loop as you do not create additional instance for iterator. But in term of code maintenance the enhanced for is easier. The guides that are currently used for Android developers ware wrote few year ago. The are updated but in case you write on device that support android K, this kind of optimization may be classified as premature.
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/24921687

http://stackoverflow.com/q/25060178
type: Question
score: 3
has comment: http://stackoverflow.com/comment/38985728
has comment: http://stackoverflow.com/comment/38984830
has comment: http://stackoverflow.com/comment/38985229
tagged with: weka
tagged with: libsvm
answer count: 1
downvote count: 0
tagged with: jar
has answer: http://stackoverflow.com/a/25061581
has body: If I use Weka Explorer to run some training data against testing data using SVM with a linear kernel, everything is fine. But I need to do this programmatically in my own Java and my current code looks like this: Instances train = new Instances (...); train.setClassIndex(train.numAttributes() - 1); Instances test = new Instances (...) + ClassificationType classificationType = ClassificationTypeDAO.get(6); LibSVM libsvm = new LibSVM(); String options = (classificationType.getParameters()); String[] optionsArray = options.split(" "); libsvm.setOptions(optionsArray); String[] pars = libsvm.getOptions(); Evaluation eval = new Evaluation(train); libsvm.buildClassifier(train); eval.evaluateModel(libsvm, test); System.out.println(eval.toSummaryString("\nResults\n======\n", false)); However, an exception is being thrown at line: eval.evaluateModel(libsvm, test); And despite numerous attempts at try...catch blocks around this code, the exception occurring is simply reported as null (which is really helpful) as per full stack trace below. I don't believe this issue is due to my own code because other classifiers have run successfully with it. I am working on the theory that the cause of the problem is environmental. But where and what? I am running my application through NetBeans 8 using Tomcat and have recent versions of weka.jar and LibSVM.jar in the application's .lib folder. But do I need libsvm.jar as provided by the download from: http://www.csie.ntu.edu.tw/~cjlin/libsvm/ If the latter is the case, how can I resolve naming conflicts in Windows where LibSVM.jar and libsvm.jar are treated as the same file? This has been really confusing me for the last few hours. I have tried adding both LibSVM.jar and libsvm.jar files into the .lib folder, renaming them both, putting them into a newly defined CLASSPATH, but nothing works. The full stack trace for the Java exception is: null weka.classifiers.functions.LibSVM.distributionForInstance(LibSVM.java:1489) weka.classifiers.Evalu…
favorite count: 0
has comment: http://stackoverflow.com/comment/38984967
accepted answer: http://stackoverflow.com/a/25061581
has comment: http://stackoverflow.com/comment/38985482
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38985794
has title: Which Weka and LibSVM .jar files to use in Java code for SVM classification
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/38985349

regex
tags question: http://stackoverflow.com/q/24997406
tags question: http://stackoverflow.com/q/24936572
tags question: http://stackoverflow.com/q/24913072
tags question: http://stackoverflow.com/q/24967089
tags question: http://stackoverflow.com/q/24936169
tags question: http://stackoverflow.com/q/24974816
tags question: http://stackoverflow.com/q/24921706
tags question: http://stackoverflow.com/q/24981528
tags question: http://stackoverflow.com/q/24924072
tags question: http://stackoverflow.com/q/24955886
tags question: http://stackoverflow.com/q/24999873
tags question: http://stackoverflow.com/q/24943239
tag name: regex
tags question: http://stackoverflow.com/q/25004834
tags question: http://stackoverflow.com/q/25010175
tags question: http://stackoverflow.com/q/25054588
tags question: http://stackoverflow.com/q/24987421
tags question: http://stackoverflow.com/q/24924321
tags question: http://stackoverflow.com/q/25040609
tags question: http://stackoverflow.com/q/25007932
tags question: http://stackoverflow.com/q/24920110
tags question: http://stackoverflow.com/q/25003973
tags question: http://stackoverflow.com/q/24918293
tags question: http://stackoverflow.com/q/24931201
tags question: http://stackoverflow.com/q/25022120
tags question: http://stackoverflow.com/q/24990853
tags question: http://stackoverflow.com/q/24985385
tags question: http://stackoverflow.com/q/25030857
tags question: http://stackoverflow.com/q/25048177
tags question: http://stackoverflow.com/q/24925119
tags question: http://stackoverflow.com/q/25067815
tags question: http://stackoverflow.com/q/25047301
tags question: http://stackoverflow.com/q/25004320
tags question: http://stackoverflow.com/q/25052628
tags question: http://stackoverflow.com/q/25005302
tags question: http://stackoverflow.com/q/24988720
tags question: http://stackoverflow.com/q/24943739
tags question: http://stackoverflow.com/q/24937313
tags question: http://stackoverflow.com/q/25029925
tags question: http://stackoverflow.com/q/25051436
tags question: http://stackoverflow.com/q/25066097
tags question: http://stackoverflow.com/q/24978790
tags question: http://stackoverflow.com/q/25044584
tags question: http://stackoverflow.com/q/25056107
tags question: http://stackoverflow.com/q/24997309
tags question: http://stackoverflow.com/q/25042531
tags question: http://stackoverflow.com/q/25018308
tags question: http://stackoverflow.com/q/24937955
tags question: http://stackoverflow.com/q/25020093
tags question: http://stackoverflow.com/q/25037393
tags question: http://stackoverflow.com/q/24995685
tags question: http://stackoverflow.com/q/24979066
tags question: http://stackoverflow.com/q/24983091
tags question: http://stackoverflow.com/q/24910262
tags question: http://stackoverflow.com/q/24917753
tags question: http://stackoverflow.com/q/25056914
tags question: http://stackoverflow.com/q/24983363
tags question: http://stackoverflow.com/q/25058152
tags question: http://stackoverflow.com/q/25028381
tags question: http://stackoverflow.com/q/25013342
tags question: http://stackoverflow.com/q/24954152
tags question: http://stackoverflow.com/q/25035211
tags question: http://stackoverflow.com/q/24916882
tags question: http://stackoverflow.com/q/24953477
tags question: http://stackoverflow.com/q/25034367
tags question: http://stackoverflow.com/q/25055797
tags question: http://stackoverflow.com/q/24949506
tags question: http://stackoverflow.com/q/25057141
tags question: http://stackoverflow.com/q/24910120
tags question: http://stackoverflow.com/q/25064207
tags question: http://stackoverflow.com/q/24935437
tags question: http://stackoverflow.com/q/24995881
type: Tag
tags question: http://stackoverflow.com/q/24946708
tags question: http://stackoverflow.com/q/25043508
tags question: http://stackoverflow.com/q/25024086
tags question: http://stackoverflow.com/q/24919559

http://stackoverflow.com/comment/38789009
comment on: http://stackoverflow.com/q/24956883
has text: You *might* be able to get something to work that way using reflection, but it would be way, way easier to just add the text boxes to a Collection (or an array) and then iterate over each element.
type: Comment
type: QuestionComment
score: 5

http://stackoverflow.com/comment/38735966
comment on: http://stackoverflow.com/a/24928025
type: AnswerComment
score: 0
type: Comment
has text: Thanks, I tried it this way, but still got the same result: ` httpPostJson.setHeader("Content-type", "application/x-www-form-urlencoded; charset=utf-8"); StringEntity se = new StringEntity( json.toString()); se.setContentType(new BasicHeader(HTTP.CONTENT_TYPE, "application/x-www-form-urlencoded; charset=utf-8")); se.setContentEncoding(new BasicHeader(HTTP.CONTENT_TYPE,"application/x-www-form-urlencoded; charset=utf-8")); httpPostJson.setEntity(se);`

http://stackoverflow.com/comment/38861122
comment on: http://stackoverflow.com/q/24995235
type: QuestionComment
type: Comment
has text: Duplicate of http://stackoverflow.com/questions/1197634/java-error-implicit-super-constructor-is-undefined-for-default-constructor
score: 1

http://stackoverflow.com/a/24979254
has body: ok, as for readability it remains unclear and depends on personal feeling Peter Lawrey and 11684 answers let me find solution, which was right before my eyes. I was creating removable using for to add by ascii code all characters that I want to dispose, but as it was pointed out, small regex would be thousand times better. for start I only want to remove digits, but I'll move on later to sanitizing whole input if needed. String[] operators=in.replaceAll("[0-9]", "").split(""); this way, because I needed it as String array, but of course it's can also go as `List' if I may want to(gonna try tomorrow): List&lt;String&gt; op=new ArrayList&lt;String&gt;(Arrays.asList(in.replaceAll("[0-9]", "").split(""))); and it's one liner. but well, I think it's not easy to read for anyone but author.
score: 0
answers question: http://stackoverflow.com/q/24976350
type: Answer

http://stackoverflow.com/q/25012680
upvote count: 1
tagged with: hive
tagged with: hadoop
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/10705140
answer count: 0
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/38894953
favorite count: 0
linked to: http://stackoverflow.com/q/8613112
has title: hdfs get blocked - Cannot lock storage /home/hduser/app/hadoop/tmp/dfs/name. The directory is already locked
has body: ERROR namenode.NameNode: java.io.IOException: Cannot lock storage /home/hduser/app/hadoop/tmp/dfs/name. The directory is already locked. Why did this come up ? /dev/mapper/fedora-root 96G 9.4G 82G 11% / devtmpfs 3.6G 0 3.6G 0% /dev tmpfs 3.6G 666M 3.0G 19% /dev/shm tmpfs 3.6G 1.4M 3.6G 1% /run tmpfs 3.6G 0 3.6G 0% /sys/fs/cgroup tmpfs 3.6G 42M 3.6G 2% /tmp /dev/sda1 976M 96M 813M 11% /boot /dev/mapper/fedora-var 48G 3.3G 43G 8% /var /dev/mapper/fedora-home 145G 15G 123G 11% /hom 1) I have enough space for datanode. 2) I know once I format namenode that will start working , but why to format I will lose my data. 3) How to solve this problem without formatting namenode.
type: Question
has comment: http://stackoverflow.com/comment/38894363
has comment: http://stackoverflow.com/comment/38894998
has comment: http://stackoverflow.com/comment/38897504
tagged with: java

http://stackoverflow.com/q/25067045
favorite count: 0
score: 0
has title: The local variable "variable" may not have been initialized- Java
type: UnansweredQuestion
upvote count: 1
downvote count: 1
has answer: http://stackoverflow.com/a/25067211
tagged with: java
has body: I got this error. Exception in thread "main" java.lang.Error: Unresolved compilation problems: rgb2 cannot be resolved to a variable its always the rgb2 array that caused the error. How to solve this problem? BufferedImage img1 = ImageIO.read(file1); BufferedImage img2 = ImageIO.read(file2); int w = img1.getWidth(); int h = img1.getHeight(); long diff = 0; for (int y = 0; y &lt; h; y++) { for (int x = 0; x &lt; w; x++) { int rgb1[] = img1.getRGB(x, y, w, h, rgb1, 0, w); int rgb2[]= img2.getRGB(x, y, w, h, rgb2, 0, w); int index = y * w + x; int r1 = (rgb1[index] &gt;&gt; 16) &amp; 0xff; int g1 = (rgb1[index] &gt;&gt; 8) &amp; 0xff; int b1 = (rgb1[index] ) &amp; 0xff; int r2 = (rgb2[index] &gt;&gt; 16) &amp; 0xff; int g2 = (rgb2[index]&gt;&gt; 8) &amp; 0xff; int b2 = (rgb2[index] ) &amp; 0xff; r2 += Math.abs(r2 - r1); g2 += Math.abs(g2 - g1); b2 += Math.abs(b2 - b1); rgb2[index] = (((r2 &amp; 0xff) &lt;&lt; 16) + ((g2 &amp; 0xff) &lt;&lt; 8) +(b2 &amp; 0xff)); rgb2[index] = (rgb2[index]*17); } } int i = 0; for (int y = 0; y &lt; h; y++) { int red = (y * 255) / (h - 1); for (int x = 0; x &lt; w; x++) { int green = (x * 255) / (w - 1); int blue = 128; rgb2[i++] = (red &lt;&lt; 16) | (green &lt;&lt; 8) | blue;//the problem is at this line } } BufferedImage image = new BufferedImage(w, h, BufferedImage.TYPE_INT_RGB); image.setRGB(0, 0, w, h, rgb2, 0, w); Graphics g = image.createGraphics(); g.drawImage(image, 0, 0, null); g.dispose(); File imageFile = new File("saved.jpeg"); ImageIO.write(image, "jpg", imageFile); } I got this error after declare outside the loop. Exception in thread "main" java.lang.Error: Unresolved compilation problems: The local variable rgb1 may not have been initialized int w = img1.getWidth(); int h = img1.getHeight(); int scale = w * h * 3; int rgb1[] = img1.getRGB(0, 0, w, h, rgb1, 0, w); int rgb2[] = img2.getRGB(0, 0, w, h, rgb2, 0, w);
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/25067167
tagged with: arrays

http://stackoverflow.com/q/25041089
answer count: 1
has answer: http://stackoverflow.com/a/29139531
type: UnansweredQuestion
tagged with: oracle-database
tagged with: web-services
has title: NullPointerException in Web Services Client (eclipse)
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/38947577
has body: I am fairly new java web services and I trying to use it to access an oracle database. What my project is trying to do is take the input of a zip code and return the information from the database. I got a web services client working for an animal type using this tutorial and I am trying to take what I learned from that for my project: http://javapapers.com/web-service/java-web-service-using-eclipse/ Here is my the code for the main class I am using: package com.zipws.test; import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; //import javax.jws.WebService; //import javax.jws.soap.SOAPBinding; //import javax.jws.soap.SOAPBinding.Style; public class ZipWebServiceImpl { public String cityFinder(String zip) { Connection con = null; String str = ""; try{ String user = "IVRDEVUSR"; String pass = "voice001"; String url = "jdbc:oracle:thin:@UIQ-UAT-ORA-02:1521/IVRST01"; Class.forName("oracle.jdbc.driver.OracleDriver"); con = DriverManager.getConnection(url, user, pass); Statement stmt = con.createStatement(); ResultSet rsZip = stmt.executeQuery("SELECT *FROM ZIPLOC WHERE ZIP = " + zip); while(rsZip.next()){ if(zip.equals(rsZip.getString("ZIP"))){ str = rsZip.getString("CITY"); } else{ str = "Zip code for city not found!"; } } rsZip.close(); stmt.close(); } catch(SQLException e){ //System.out.println("Connection Failed."); str = "connection failed"; } catch(ClassNotFoundException cnfe){ //System.out.println("Unable to load driver."); str = "Unable to load driver"; } finally{ try{ con.close(); } catch(SQLException e){ //System.out.println("Failed to close connection."); str = "Failed to close connection."; } } return str; } } The web services client classes were generated by Eclipse which I learned to do from the tutorial earlier. When I run the client and enter a zipcode to try to invoke the above class, it returns a NullPointerException and I do not know why. Can anyone possibly explain…
tagged with: eclipse
score: 0

http://stackoverflow.com/comment/38714691
type: Comment
type: QuestionComment
has text: Can you open the temp directory in explorer to see if the file is there?
comment on: http://stackoverflow.com/q/24916866
score: 0

http://stackoverflow.com/a/34591085
type: Answer
answers question: http://stackoverflow.com/q/25007638
upvote count: 1
score: 1
downvote count: 0
has body: (This would be a comment, but I am below 50pt) Is the function from the reply you refering to return null or does the object not react? If an object is returned, you may try to activate it: btCollisionObject body = BulletUtil.rayTest(collisionWorld, pickRay); if (body != null) { body.activate(); //activate because it may sleep //... then do whatever you want with this body now return true; } In the other post (you reply to), there were also two lines which didn't work for me (see my comment in the other post).

http://stackoverflow.com/q/24944844
accepted answer: http://stackoverflow.com/a/24945140
possible better answer: http://stackoverflow.com/a/26177449
has body: I am basically dealing with the following problem where i am trying to alter the insert sort so that it can also delete duplicates it counters. The following is the insert sort. public void insertSort() { for (int i = 1; i &lt; nElems; i++) { int temp = a[i]; int j = i; while (j &gt; 0 &amp;&amp; temp &lt;= a[j - 1]) { a[j] = a[j - 1]; j--; } a[j] = temp; } } I am not quire sure if i have understood the approach correctly. IF i am understanding this correctly(please tell me if i am wrong or not) the approach suggests that i should iterate through the entire array before the inner while loop begins and label any duplicate with a arbitrary number such as -1. And then when the inner while loop starts it will sort out the array and all the duplicates will be stacked up at the beginning together. If this is the case then i can simply compare every element in the array with each other right before the insert sort begins and label any duplicates - 1 and then the insert sort will take care of the sorting part. After which i can reduce arraySize. However i feel i have not understood it correctly so can someone please make any suggestions regarding this?
has comment: http://stackoverflow.com/comment/38767467
has answer: http://stackoverflow.com/a/26177449
has comment: http://stackoverflow.com/comment/38767611
has comment: http://stackoverflow.com/comment/38767423
tagged with: sorting
score: 2
type: AnsweredQuestion
downvote count: 0
has comment: http://stackoverflow.com/comment/38767906
has answer: http://stackoverflow.com/a/24945140
favorite count: 0
type: Question
has title: Removing Duplicates Inside Insertion Sort
has comment: http://stackoverflow.com/comment/38767395
has comment: http://stackoverflow.com/comment/38768198
has comment: http://stackoverflow.com/comment/38767535
upvote count: 2
tagged with: java
answer count: 2
tagged with: insertion-sort

http://stackoverflow.com/comment/56486604
type: Comment
has text: I don't agree this answer. The code with sizeOf is misleading for datetime. An example with several instance number would be more relevant. Not only java server applications use dates. Desktop and Mobile applications use them too. Second, you don't need several millions of date instances to encounter sensitive consumption of memory. Just one million of java.util.Date cost 24 MB. It's not free. Third, the asker refers about CPU load. So, if TimeZone is not needed, using a primitive long is the less expensive solution because you have the lightest data construction since they are not objects.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24937895

http://stackoverflow.com/q/24995677
has answer: http://stackoverflow.com/a/28249015
favorite count: 0
has body: I want to know How many users are connected to my application in real time. I got the idea to loop on number of session that are open but I can't find how to do that. If you have another way to do it your suggestions are welcome.
possible better answer: http://stackoverflow.com/a/28249015
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24998574
tagged with: session
tagged with: java
tagged with: vaadin
type: Question
score: 12
answer count: 2
upvote count: 12
downvote count: 0
has title: How to get all sessions in Vaadin
accepted answer: http://stackoverflow.com/a/24998574
linked to: http://stackoverflow.com/q/10770535

http://stackoverflow.com/q/25049171
has comment: http://stackoverflow.com/comment/38963513
has comment: http://stackoverflow.com/comment/38968769
has comment: http://stackoverflow.com/comment/38963278
has comment: http://stackoverflow.com/comment/38965007
favorite count: 0
has comment: http://stackoverflow.com/comment/38963351
score: 0
has comment: http://stackoverflow.com/comment/38963302
has comment: http://stackoverflow.com/comment/38963402
has comment: http://stackoverflow.com/comment/38963248
has comment: http://stackoverflow.com/comment/38963538
type: UnansweredQuestion
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/38963444
type: Question
has title: code keeps throwing me an Exception
has comment: http://stackoverflow.com/comment/38963411
tagged with: java
has comment: http://stackoverflow.com/comment/38963272
has answer: http://stackoverflow.com/a/25050052
has comment: http://stackoverflow.com/comment/38963326
has comment: http://stackoverflow.com/comment/38965050
answer count: 1
has body: I have the next code which has to open a File given by the user. The adress in which the file is located is correct, but the problem is that it keeps throwing the exception FileNotFoundException and i can´t figure out what the problem is. import java.util.Scanner; import java.io.File; import java.io.FileNotFoundException; import java.io.RandomAccessFile; public class OpenFile{ public static void main(String[] args) { String fileName,name,r = "C:/Users/MyName/workspace/Proyect/"; Scanner t = new Scanner(System.in); System.out.print("Give me the name of the file: "); name = t.nextLine(); t.close(); fileName = r+name; try { File f = new File(fileName); RandomAccessFile ra = new RandomAccessFile(f,"r"); } catch(FileNotFoundException ex) { System.out.println("cannot open file"); } } }

http://stackoverflow.com/q/24975599
upvote count: 1
type: Question
tagged with: hibernate-search
has body: I was reading about Hibernate search engine with Lucene and I was able to set it up as follow on an Article class that holds an article via mysql db. my goal is to display to the user the tittle of the Article and snippet of the text that they are searching on the browser. This is what I have implemented so far: @Entity @Indexed @Analyzer(impl = StandardAnalyzer.class) @Table(name = "ARTICLE", catalog = "kefet3") public class Article implements java.io.Serializable { private static final long serialVersionUID = 1L; // Fields private Integer id; private Articlelanguage articlelanguage; private Users users; private Articlecategory articlecategory; @Analyzer(impl = StandardAnalyzer.class) @Field(index = Index.YES, analyze = Analyze.YES, store = Store.NO) private String artTitle; @Field(index = Index.YES, analyze = Analyze.YES, store = Store.NO) private String artContent; for the above code there are get and set and all the annotation for the db. below is the method that searches. @Override @SuppressWarnings("unchecked") public List<Article> search(String word) { analyzer = new StandardAnalyzer(Version.LUCENE_36); FullTextSession fullTextSession = Search.getFullTextSession(getCurrentSession()); // get a query builder QueryBuilder queryBuilder = fullTextSession.getSearchFactory() .buildQueryBuilder().forEntity(Article.class).get(); // build the query org.apache.lucene.search.Query query = queryBuilder.keyword(). onFields("artTitle","artContent") .matching(word).createQuery(); FullTextQuery fullTextQuery = fullTextSession.createFullTextQuery(query, Article.class); // wrap Lucene query in a javax.persistence.Query // org.hibernate.Query fullTextQuery = fullTextSession.createFullTextQuery(query, Article.class); List<Article> searchResultList = fullTextQuery.list(); for (int i=0; i<searchResultList.size(); i++){ System.out.println("searchResultList###################"+searchResultList.get(i).getArtTitle()); } Highlighter highlighter = new Highlighter( new QueryScorer( query …
tagged with: lucene
answer count: 1
downvote count: 0
favorite count: 0
type: UnansweredQuestion
has title: how to get Snippets of text via Hibernate Search Engine with Lucene with Highlighter and StandardAnalyzer
score: 1
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/31393718

http://stackoverflow.com/comment/38877058
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25002387
has text: Ya i have built peer to peer calling app using this code and it works..the sound is played in small speaker near to ear..
type: AnswerComment

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

http://stackoverflow.com/comment/38743896
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/24932131
type: Comment
has text: Check these links : http://stackoverflow.com/questions/4993132/getting-java-lang-illegalargumentexception-illegal-pattern-character-o-while & http://stackoverflow.com/questions/24861976/exception-android-view-inflateexception-binary-xml-file-line-20-error-infla

http://stackoverflow.com/comment/38852137
score: 1
comment on: http://stackoverflow.com/a/24990326
type: AnswerComment
type: Comment
has text: public static void main(String[] args) { String test = ",,,"; String[] spl = test.split(",", -1); System.out.println(spl.length); }

http://stackoverflow.com/comment/40738655
comment on: http://stackoverflow.com/a/25113632
type: AnswerComment
score: 0
type: Comment
has text: Hi @FireFly3000 can you please accept the answer if this has helped you?

http://stackoverflow.com/a/25018203
answers question: http://stackoverflow.com/q/25017712
type: AcceptedAnswer
type: Answer
has body: SELECT dtl.id, dtl.city_id, dtl.hotel_name, dtl.country_code, min(dsc.desc_type) KEEP (DENSE_RANK FIRST ORDER BY CASE dsc.desc_type WHEN 'general' THEN 1 WHEN 'location' THEN 2 WHEN 'rooms' THEN 3 WHEN 'lobby' THEN 4 ELSE 5 END) desc_type, min(dsc.description) KEEP (DENSE_RANK FIRST ORDER BY CASE dsc.desc_type WHEN 'general' THEN 1 WHEN 'location' THEN 2 WHEN 'rooms' THEN 3 WHEN 'lobby' THEN 4 ELSE 5 END) description FROM (SELECT htl.id, htl.city_id, htl.hotel_name, cty.country_code FROM hotel htl LEFT OUTER JOIN city cty ON (htl.city_id = cty.city_id)) dtl LEFT OUTER JOIN dsc ON ( dtl.id = dsc.id AND dtl.city_id = dsc.city_id) GROUP BY dtl.id, dtl.city_id, dtl.hotel_name, dtl.country_code,
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/25017712
upvote count: 1

http://stackoverflow.com/comment/38800956
type: Comment
comment on: http://stackoverflow.com/a/24962603
has text: That is unusual, I did a <crtl>1 and created the getter and setter at the end of the line and it worked as I would expect it to. So the source/create Getters & setters works a bit differently from the <ctrl>1 at the end of the private String xPageName; line. Interesting.
type: AnswerComment
score: 0

http://stackoverflow.com/q/24975486
type: UnansweredQuestion
tagged with: maven
score: 3
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/38824421
has body: I have a situation like on picture. ProjB has dependency on ProjA. In ProjA in src/test/java I have some Util class for test purpose. I want to use this Util also in tests in ProjB. public class TestB { @Test public void sth(){ Util u = new Util(); } } public class Util { public void util(){ System.out.println("do something"); } } ProjA/pom.xml has dependency on junit 4.11, ProjB/pom.xml has dependency on ProjA. When I run TestB, there is excepiton java.lang.ClassNotFoundException: aaaa.Util. So can I use classes from tests in another project?
type: Question
tagged with: testing
has title: Using test class in another maven project
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/25024553

http://stackoverflow.com/q/25040344
has answer: http://stackoverflow.com/a/25040502
favorite count: 0
upvote count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38946136
score: 2
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/38946393
has title: I'm looking for a data extraction tool for db2
downvote count: 0
tagged with: db2
has body: I am looking for a data extraction platform that works with JDBC and DB2 9.7. I need this to extract data and create a vendor specific formatted flat file out of it. Is there a utility written in the existing DB2 driver or JDBC that will assist in flat file creation and format?
tagged with: oracle-database
tagged with: sql
answer count: 1
tagged with: jdbc

http://stackoverflow.com/comment/119049388
type: AnswerComment
comment on: http://stackoverflow.com/a/24925020
type: Comment
score: 1
has text: @fuat you need to have the application plugin

http://stackoverflow.com/a/25013072
answers question: http://stackoverflow.com/q/25010390
type: Answer
score: 24
upvote count: 24
has body: Well, the right way to do this would be: import org.mockito.AdditionalAnswers; String[] logEntry = // Some initialization code List&lt;String&gt; logEntryList = Arrays.asList(logEntry); when(tuple.getString(1)).thenAnswer(AdditionalAnswers.returnsElementsOf(logEntryList)); On each invocation, successive elements of logEntry array are returned. Thus, ith invocation of tuple.getString(1) returns ith element of logEntry array. P.S: The example in documentation of returnsElementsOf (as of this writing) is not updated (it still uses ReturnsElementsOf example): http://docs.mockito.googlecode.com/hg/1.9.5/org/mockito/AdditionalAnswers.html#returnsElementsOf(java.util.Collection)it
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25010390

http://stackoverflow.com/a/24966156
answers question: http://stackoverflow.com/q/24966143
downvote count: 0
type: Answer
score: 2
upvote count: 2
has body: ArrayList&lt;Integer&gt; integerArgs[]; This declares an array of ArrayList objects. Is this really what you want?

http://stackoverflow.com/q/24999873
answer count: 1
has answer: http://stackoverflow.com/a/24999908
favorite count: 0
duplicate of: http://stackoverflow.com/q/406230
has title: java regex to not get string not ending with dot
tagged with: regex
accepted answer: http://stackoverflow.com/a/24999908
upvote count: 3
score: 1
downvote count: 2
has body: I m trying regex to get the strings starting with @ and not ending with a dot(.) For that i tried the java code(link here) but this does not show any results - @(\\w+)*(?&lt;!.(.))*$ The string i m trying is - This is a test\nAnother @pradyut@test ht@html.com\ntest\n#art\n@cool#paintings#collections This should return pradyut test cool The result html ending with a .com should not return. Regards
type: AnsweredQuestion
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/406230

http://stackoverflow.com/comment/38962572
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25048769
score: 0
has text: @Takendarkk Return statements return, if that case is triggered. Do return statements automatically act as break statements? If not, I still need them to keep the switch statement functional (since the compiler looks for that to end the case and move on to the next).

aop
tags question: http://stackoverflow.com/q/25054588
tags question: http://stackoverflow.com/q/24992232
tag name: aop
tags question: http://stackoverflow.com/q/25052778
type: Tag
tags question: http://stackoverflow.com/q/24917853

http://stackoverflow.com/comment/85492305
type: Comment
comment on: http://stackoverflow.com/a/25048599
type: AnswerComment
score: 0
has text: Just saying, you can call it by `curl 127.0.0.1:<port>/example`

http://stackoverflow.com/a/25027920
upvote count: 0
type: Answer
has body: The jdbc driver need to be load to your JVM by Class.forName(drivername) method, try to call this method before you get connection.
downvote count: 2
has comment: http://stackoverflow.com/comment/38928026
has comment: http://stackoverflow.com/comment/38923405
score: -2
answers question: http://stackoverflow.com/q/25027739

http://stackoverflow.com/a/24924446
has comment: http://stackoverflow.com/comment/38728842
has comment: http://stackoverflow.com/comment/60300657
downvote count: 0
has comment: http://stackoverflow.com/comment/38728380
has comment: http://stackoverflow.com/comment/38728532
upvote count: 6
has comment: http://stackoverflow.com/comment/38728514
answers question: http://stackoverflow.com/q/24923842
type: Answer
score: 6
has body: Instead of trying to make a query like this every time you need access to the most recent Bill/Receipt of each of your consumers, what if your Consumer POJO became the following: public class Consumer { private Integer consumerId; private String consumerName; private String address; // join data into these variables private Set&lt;Bill&gt; bills = new Set&lt;Bill&gt;(0); private Set&lt;Receipt&gt; recipts = new Set&lt;Receipt&gt;(0); // add constructor and getter/setter methods here } Then, in your ConsumerDAO, your find methods could have the following logic: public class ConsumerDAO { /* * Find a consumer without any transaction data JOINed in */ public Consumer find(Integer consumerId){ // create a new Consumer object // run SQL query to populate consumerId, consumerName, and address fields of new Consumer object // return new Consumer object } /* * Find a consumer with all transaction data JOINed in */ public Consumer findWithTransactionData(Integer consumerId){ // create new consumer object // run a query to get the the basic fields of the Consumer POJO, that also uses // JOINs to get all of the consumer's Bills and Receipts; store all of the latter // in the Consumer object's Sets // return consumer object } /*** Note that the following two methods could even go in the Consumer class at this point ***/ public Bill getMostRecentBill(Consumer consumer){ // iterate through the consumer's bills, and return the most recent one } public Receipt getMostRecentReceipt(Consumer consumer){ // iterate through the consumer's receipts, and return the most recent one } } Is this what you're trying to do? I think it would make the most sense to put the "find most recent" methods in the Consumer class itself, because you then wouldn't have to pass anything to the method as a parameter; you could just call getMostRecentBill() on the Consumer object that you get from findWithTransactionData(Integer) if you wanted to. This is generally considered to be a poor practice, though, be…

http://stackoverflow.com/q/24986914
tagged with: hashmap
has title: Tracking indices with arrays?
tagged with: arrays
has body: For tracking indices this achieves a syntax closer to python's dictionaries. byte item0 = 0; byte item1 = 1; byte item2 = 2; byte[] anArray; anArray = new byte[3]; anArray[item1] = 5; anArray[item2] = 5; anArray[item3] = 5; Would this be faster/better than using a hashmap? How/why? Thanks
has answer: http://stackoverflow.com/a/24986926
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38845842
has comment: http://stackoverflow.com/comment/38845834
tagged with: python
answer count: 1
has comment: http://stackoverflow.com/comment/38846807
accepted answer: http://stackoverflow.com/a/24986926
score: 0
tagged with: java

http://stackoverflow.com/comment/38777587
type: Comment
type: QuestionComment
has text: delete .m2 and mvn install. sometimes works.
comment on: http://stackoverflow.com/q/24949600
score: 1

http://stackoverflow.com/q/25058112
has body: We have used Spring security to secure our rest endpoints. Every rest resource is annotated with a @PreAuthorize annotation. When the caller doesn't have access to the resource that he requests for Spring security throws a org.springframework.security.access.AccessDeniedException exception. We have an exception mapper which returns this message with appropriate error code 403 to the clients. public class AccessDeniedExceptionMapper implements ExceptionMapper&lt;AccessDeniedException&gt; { private static final Logger LOGGER = LoggerFactory.getLogger(AccessDeniedExceptionMapper.class); /* (non-Javadoc) * @see javax.ws.rs.ext.ExceptionMapper#toResponse(java.lang.Throwable) */ @Override public Response toResponse(AccessDeniedException exception) { LOGGER.debug("Access is denied: {}",exception.getMessage()); ResponseBuilder bldr = Response.status(Status.FORBIDDEN); bldr.entity("Access is denied").type(MediaType.TEXT_PLAIN_TYPE); return bldr.build(); } } Now, is it possible to get the information about the method [someMethod in this case] which actually throws this exception? The idea is to throw custom exceptions to the clients based on the resource they access. @PreAuthorize("hasRole('ACTN_START_STOP_DB') and hasPermission(#databaseId, {'ACTN_START_STOP_DB'})") @Path("/db") public DatabaseOperation someMethod(){ }
has title: Information about the method which throws Access Denied exception when using @PreAuthorize
tagged with: java
upvote count: 2
has comment: http://stackoverflow.com/comment/38983646
answer count: 1
tagged with: spring-security
favorite count: 0
tagged with: rest
score: 2
downvote count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25067412
tagged with: spring
type: Question

http://stackoverflow.com/a/24912599
type: Answer
upvote count: 1
score: 1
downvote count: 0
has body: On driver.switchTo().alert(), a org.openqa.selenium.NoAlertPresentException can be thrown, which is an unchecked (i.e. RuntimeException). You could catch it and possibly do this in a loop.
answers question: http://stackoverflow.com/q/24911681

http://stackoverflow.com/q/24988969
favorite count: 0
has body: OK, so what I want to do is create 2 classes. One is main class and the second class is to make a loop sentinel control and then return the total of it till the user enters 0. I couldn't get it to work. I don't know how to call the other class because I'm very new to Java. Here's what I have. Class 1: import java.util.*; public class HW3 { public static void main(String[] args) { OrderDetails object = new OrderDetails(); int n; n = object.OrderDetails(0); System.out.println(n); Class 2: import java.util.*; public class OrderDetails { Scanner input = new Scanner(System.in); int total=0; int n1; public int OrderDetails(int n1){ while (n1 != 0){ System.out.println("Enter your number"); n1 = input.nextInt(); total += n1; } // End while loop return total; } // End method
has answer: http://stackoverflow.com/a/24989137
has answer: http://stackoverflow.com/a/24989120
has comment: http://stackoverflow.com/comment/38849825
score: -4
downvote count: 4
type: AnsweredQuestion
upvote count: 0
tagged with: java
tagged with: loops
tagged with: sentinel
has title: Calling another class in Java
type: Question
has comment: http://stackoverflow.com/comment/38849835
answer count: 2
possible better answer: http://stackoverflow.com/a/24989137
accepted answer: http://stackoverflow.com/a/24989120
has comment: http://stackoverflow.com/comment/38849898

http://stackoverflow.com/comment/38765411
comment on: http://stackoverflow.com/a/24939583
has text: Added comments. Those are not really part of the answer to the question you asked, just keeps the disable state of the buttons correct. It's quite a bit uglier without lambdas, streams, and method references, but the translation is easy enough.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/38774350
score: 0
comment on: http://stackoverflow.com/q/24948435
type: QuestionComment
type: Comment
has text: You could also look at SwingLabs `JXTable` which provides a nice row highlighting API, for [example](http://stackoverflow.com/questions/9791719/swingx-jxtable-use-colorhighlighter-to-color-rows-based-on-a-row-object)

http://stackoverflow.com/comment/38906391
type: Comment
type: QuestionComment
score: 0
has text: no windows unfortunately
comment on: http://stackoverflow.com/q/25000506

http://stackoverflow.com/a/24950802
has comment: http://stackoverflow.com/comment/38778512
accepted answer of: http://stackoverflow.com/q/24950670
has comment: http://stackoverflow.com/comment/38778949
score: 2
answers question: http://stackoverflow.com/q/24950670
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/38778451
has comment: http://stackoverflow.com/comment/38782777
has body: Fundamentally, you're modifying a list in one thread while iterating over it in another, and the list implementation you're using does not support that. The ArrayList iterator implementation appears to only detect invalid modicifications on the call to next(), not on the call to hasNext(). So if you get into the last iteration of the loop before the remove() call, then you won't get an exception - hasNext() will just return false. On the other hand, if the remove() happens before the last call to next() (and if this is noticed on the other thread - the memory model comes into play here) then you'll get the exception. So for example, if you change your in-loop sleep to Thread.sleep(2500) then you'll get the exception at the start of the second iteration, because the remove() call will occur before it. If you want to use a list in multiple threads and at least one of them is modifying it, you should use an implementation which supports that, such as CopyOnWriteArrayList.
type: Answer
has comment: http://stackoverflow.com/comment/38779574
upvote count: 2
has comment: http://stackoverflow.com/comment/38783089
has comment: http://stackoverflow.com/comment/38779075
has comment: http://stackoverflow.com/comment/38782855
has comment: http://stackoverflow.com/comment/38778182

http://stackoverflow.com/q/25067808
has body: I am to convert a double value to a String. double d=12345678.999; String str = String.valueOf(d); or, just plain String str = ""+d; Does it, however in the exponent form-- returning the String value: 1.2345678999E7 I need the value as is in the String: 12345678.999 Is there a way to do this? I can parse the string for the value of exponent-- the portion after 'E' and go from there, but there must be an easier way of doing this. //=========================== EDIT: the length of the decimal part in the input isn't known, it can be any number of digits: 12345678.999 or 12345678.9999999 Imposing a format for the decimal part would fix the number of decimal digits(?)
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/38998382
type: Question
linked to: http://stackoverflow.com/q/12806278
possible better answer: http://stackoverflow.com/a/25067851
has answer: http://stackoverflow.com/a/25067851
has title: Convert double to String in Java
has answer: http://stackoverflow.com/a/25067878
answer count: 2
tagged with: types
downvote count: 0
linked to: http://stackoverflow.com/q/2722122
tagged with: string
accepted answer: http://stackoverflow.com/a/25067878
favorite count: 0
has comment: http://stackoverflow.com/comment/38998451
has comment: http://stackoverflow.com/comment/38998478
tagged with: double
duplicate of: http://stackoverflow.com/q/12806278
upvote count: 1
type: AnsweredQuestion

http://stackoverflow.com/comment/38781191
type: Comment
has text: try this http://pastebin.com/WY7XB4dG, is it what you want?
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/24951311

http://stackoverflow.com/comment/38757003
comment on: http://stackoverflow.com/q/24925175
has text: No, I don't have the option of adding `package *` statements at the top of the external classes. It's required to stay in the unnamed default package by my superior. Also this fact is unrelated to this technical question.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25001101
score: 1
answers question: http://stackoverflow.com/q/25001011
has body: Arrays.asList expects an array of objects (T... obj) as its arguments. The only object you have here is the byte[], hence you get List&lt;byte[]&gt;. Try Byte[] primitiveBytes = new Byte[]{...}; To complete, this wrappedBytes = new ArrayList&lt;&gt;(Arrays.asList(primitiveBytes)); would fail when compiled with a byte[] and has no warning when compiled with Byte[].
upvote count: 1
type: Answer
downvote count: 0

http://stackoverflow.com/a/25055262
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25055182
type: Answer
downvote count: 0
score: 1
has body: If you're using the default AOP method, Spring Proxy AOP, the advice is implemented by wrapping the annotated class with a proxy object that intercepts and advises the calls. When you use self-calls like this, you're bypassing the proxy, and the advice doesn't get applied. If you really do need to have advice applied on self-calls, you need to use AspectJ AOP, which actually modifies the class in question instead of decorating it.
upvote count: 1
accepted answer of: http://stackoverflow.com/q/25055182

http://stackoverflow.com/comment/77005608
type: AnswerComment
comment on: http://stackoverflow.com/a/24911158
type: Comment
has text: This is a better answer. Fewer errors and no chance of sql injection
score: 0

http://stackoverflow.com/comment/38977552
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25055896
has text: You don't seem to understand what's wrong with your question. I was just trying to point that your question was inappropriate to get any helpful answer.

http://stackoverflow.com/a/43328224
answers question: http://stackoverflow.com/q/25066183
score: 6
type: Answer
downvote count: 0
upvote count: 6
has body: In OpenSAML3 you have to first make sure to include the opensaml-saml-impl artifact in your dependencies, since all the marshallers and unmarshallers are implemented there. Then, as @Goblins and @Pegerto pointed out, you have to call InitializationService.initialize(). I have found this link to be useful for doing a correct initialization when using Dependency Injection https://github.com/apereo/cas/blob/master/support/cas-server-support-saml-core-api/src/main/java/org/apereo/cas/support/saml/OpenSamlConfigBean.java

http://stackoverflow.com/q/24946467
type: Question
has comment: http://stackoverflow.com/comment/38771469
has comment: http://stackoverflow.com/comment/38770298
tagged with: mouseevent
has title: auto click once in JFrame
answer count: 2
downvote count: 4
tagged with: awtrobot
has comment: http://stackoverflow.com/comment/38770606
has comment: http://stackoverflow.com/comment/38772648
favorite count: 0
has body: How can I make my program automatically do mouse click just only once each time after running a method on my JFrame? can it be achieved by using robot class?
tagged with: jframe
type: UnansweredQuestion
score: -4
tagged with: swing
has answer: http://stackoverflow.com/a/24946502
upvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/25029116

http://stackoverflow.com/comment/38798686
has text: Please do a show create for each table in the query as well as a explain extended output for your query and add it to your question. What version of MySQL are you running
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24943378

http://stackoverflow.com/comment/38917224
score: 8
type: Comment
comment on: http://stackoverflow.com/q/25024635
has text: Please expand on "does not work", so that we can better understand your code and your problem.
type: QuestionComment

http://stackoverflow.com/q/25015391
favorite count: 0
has title: Get items count
upvote count: 2
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/25015481
downvote count: 3
score: -1
type: Question
has comment: http://stackoverflow.com/comment/38899198
answer count: 1
has answer: http://stackoverflow.com/a/25015481
has body: i need to get the count of the items elements in each item of the list. For example i have one group list in this list are 5 elements, and on each elements there are also some other items. I need to get these count of the items on each elements list to show them nearby elements name in brackets like: element1 (5) element2 (7) ... I have a list of the group, then i add elements with the name and id to this list, like: for(Group p: list) { l.add(p.getName(),p.getId());} how can i get the count of each item elements that contains in p? Any suggestions I have one list of Group Group -Group1 -Group2 -Group3 -Group4 -... each group item has its own elements Group -Group1 -el1 -el2 -el3 -el4 -... -Group2 -el1 -el2 -el3 -el4 -Group3 -Group4 -... i want to get the count of the last tree elements to show on the Group1 (4) for example i have two methods in one of them i call the number=r.entrySet().size and get the number of elements that i want but on console, if i call this variable in the second method is it null, for(Group p: list) { l.add(p.getName()+ "("+number+")",p.getId());} how to call it in the second method, i defined it as static private static int number;

http://stackoverflow.com/q/24910417
has comment: http://stackoverflow.com/comment/38701424
answer count: 0
score: 1
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/38732274
has body: I have a question concerning Maven3. I want to create a JAR File with the name myJarFile_1.0.0-SNAPSHOT_200140723.jar. But Maven only create the follwoing name (I used the command "mvn clean install"): myJarFile_1.0.0-SNAPSHOT_200140723-jar-with-dependencies.jar Here is my finalName declaration: ${project.artifactId}_${project.version}_${timestamp} Here is the configuration of my Maven-asembly-plugin: org.apache.maven.plugins maven-assembly-plugin jar-with-dependencies false 1.6 1.6 true lib/ myMainClass assembly-jar-Id package single How can i solve this problem? I can only work with the JAR File, which includes the text "jar-with dependencies". But i must rename this file, because of my bash sell script, which execute this File. The second JAR file, which was created by maven, can not be used, since i get this error message: no main manifest attribute, in myJarFile.jar Many thanks !
has comment: http://stackoverflow.com/comment/38701524
has comment: http://stackoverflow.com/comment/38724342
linked to: http://stackoverflow.com/q/4238944
downvote count: 0
has title: How to format the name of a JAR File, which will be created with Maven3?
favorite count: 0
has comment: http://stackoverflow.com/comment/38701644
type: UnansweredQuestion
tagged with: maven
upvote count: 1

http://stackoverflow.com/comment/38738649
score: 0
type: Comment
type: QuestionComment
has text: @RuchiraGayanRanaweera this sort of question and answer is allowed and welcome by the system. It is not a reason to close the question.
comment on: http://stackoverflow.com/q/24927599

http://stackoverflow.com/q/24939596
accepted answer: http://stackoverflow.com/a/24943210
downvote count: 0
has body: I have the following issue with my glassfish server: I have deployed a simple application to the server. The server correctly receives the application as in a web archive. When i open the according website in my browser, the HTML and CSS is displayed properly, but the content's of the expression language are just empty. Furthermore it seems like the java code is not even executed, since i can't see an output of system.out's. The application itself works perfectly fine on a local glassfish server. Attached is the source and the web.xml. Controller class: import java.io.Serializable; import javax.enterprise.context.SessionScoped; import javax.inject.Named; @Named @SessionScoped public class CarController implements Serializable { String test = "hallo"; public String getTest() { return test; } } index.xhtml: <?xml version='1.0' encoding='UTF-8' ?> <h:head> Facelet Title </h:head> <h:body> #{carController.test} </h:body> web.xml: <?xml version="1.0" encoding="UTF-8"?> javax.faces.PROJECT_STAGE Development Faces Servlet javax.faces.webapp.FacesServlet 1 Faces Servlet /faces/* 30 faces/index.xhtml Glassfish version: 4 Java version: "1.7.0_65" (java installation works with any non glassfish applications) Ubuntu version: 14.04.
tagged with: ubuntu
tagged with: glassfish
answer count: 1
favorite count: 0
has title: Glassfish does not process java
upvote count: 1
type: AnsweredQuestion
score: 1
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/24943210

http://stackoverflow.com/a/24971823
upvote count: 3
answers question: http://stackoverflow.com/q/24971708
type: AcceptedAnswer
downvote count: 0
has body: Put this line inside the for loop: ImageView imageView = new ImageView(getActivity());
type: Answer
has comment: http://stackoverflow.com/comment/38817437
score: 3
accepted answer of: http://stackoverflow.com/q/24971708

http://stackoverflow.com/q/25068890
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/25069114
tagged with: dictionary
has body: My coworker tells me that it's lazy to use Maps, and that oftentimes the programmer's purpose would be better served by an actual object. But I don't know the best way to do so. This is further complicated (to me) by the fact that the key is an Enum type. Say I have a Hashmap&lt;MyEnum, MyObj&gt; which is expected to have four hashmap keys (one for each value in MyEnum). The MyObj hashmap value is the latest of several MyObjs in a database which have the given enum value. My best guess involves an object with four fields, or maybe two arrays containing the keys and values in order. Not sure if this is clear or not (It's 5PM on Thursday = I'm brain-dead), so please ask for clarification if necessary.
upvote count: 3
has title: How to encapsulate a Map into a custom object
has comment: http://stackoverflow.com/comment/39000623
type: AnsweredQuestion
score: 3
tagged with: enums
tagged with: oop
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/39000552
accepted answer: http://stackoverflow.com/a/25069114
answer count: 1

http://stackoverflow.com/q/24917757
score: 3
tagged with: css
has answer: http://stackoverflow.com/a/24918163
favorite count: 0
has title: Style ChoiceBox in JavaFX
type: Question
answer count: 1
upvote count: 3
tagged with: java
tagged with: javafx
accepted answer: http://stackoverflow.com/a/24918163
has body: How can you style a ChoiceBox in JavaFX with CSS? The only things I have found out is how to change the background and the text color. // Background Color .cb { -fx-background-color: #HEX; } // Text Color .cb .label { -fx-text-fill } What I am still missing is the highlighting color when hovering the items and the background color of the dropdown list. Also the little arrow. Unfortunately I have found no documentation or anything that helps. EDIT: @James_D gave a great link to find out stylings: Modena.css That way I figured out how to color the white background black. .cb .context-menu { -fx-background-color: black; }
downvote count: 0
type: AnsweredQuestion

http://stackoverflow.com/comment/42431425
has text: WHat if new keyword is not used?
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25055542
type: AnswerComment

http://stackoverflow.com/a/25032482
answers question: http://stackoverflow.com/q/25028381
score: 0
type: Answer
has body: Try this, It replaces the characters other than letters or words, word = resultString.replaceAll("[^\\w]", " "); and output will be Hello World 1234

http://stackoverflow.com/comment/41620680
type: AnswerComment
type: Comment
has text: The difference with my solution is that you still go through the list of ports sequentially, whereas Future.traverse can do it in parallel (if execution context is configured accordingly, of course).
comment on: http://stackoverflow.com/a/26313077
score: 0

http://stackoverflow.com/comment/38996542
type: Comment
comment on: http://stackoverflow.com/a/25066733
score: 0
type: AnswerComment
has text: @user2864740 Spring also has that ability, but only when no constructors are annotated. But these are conventions. They may not always apply. In that case, you annotate a single constructor.

http://stackoverflow.com/q/25028171
linked to: http://stackoverflow.com/q/16294505
has comment: http://stackoverflow.com/comment/38923833
answer count: 1
has comment: http://stackoverflow.com/comment/38924456
favorite count: 0
accepted answer: http://stackoverflow.com/a/25028286
upvote count: 1
has comment: http://stackoverflow.com/comment/38924480
has title: JSP Class Explanation
tagged with: spring-mvc
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38923897
score: 1
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/38924698
has answer: http://stackoverflow.com/a/25028286
downvote count: 0
tagged with: jsp
has body: So recently I have run into an error that I have never encountered. The code of method _jspService(HttpServletRequest, HttpServletResponse) is exceeding the 65535 bytes limit I set the model attribute in the controller, granted the object is fairly large I wouldn't expect for it to throw an error. I started by limiting the code to figure out what was causing the issue. I have read here to remove the &lt;jsp:include and use &lt;%@ include. Next step I took was to break up the JSP. I realize now that I am building out my Colors and Fonts individually like this &lt;form:select path="bottom.backgroundColor" class="form-control"&gt; &lt;form:option value="#000000"&gt;Black&lt;/form:option&gt; &lt;form:option value="#FFFFFF"&gt;White&lt;/form:option&gt; &lt;form:option value="#FF0000"&gt;Red&lt;/form:option&gt; &lt;form:option value="#00FF00"&gt;Green&lt;/form:option&gt; &lt;form:option value="#0000FF"&gt;Blue&lt;/form:option&gt; &lt;form:option value="#F0F000"&gt;Yellow&lt;/form:option&gt; &lt;form:option value="#FF7000"&gt;Orange&lt;/form:option&gt; &lt;form:option value="#600060"&gt;Purple&lt;/form:option&gt; &lt;form:option value="#905030"&gt;Brown&lt;/form:option&gt; &lt;/form:select&gt; Removing these items has fixed my issues. QUESTION: Why? My understanding is that a JSP builds out its own class however it doesn't seem like it took much to break it. Is the problem the size of the modelAttribute that was passed in? It sounds like others have solved issues with loops and such. Can anyone point me to a resource or explain this better? I can supply more code if necessary.

http://stackoverflow.com/comment/38854827
type: Comment
type: QuestionComment
has text: How try with *#1* `date.getTime()` as it is `Long`, and another way is to try with native sql query in JPA?
score: 0
comment on: http://stackoverflow.com/q/24991581

http://stackoverflow.com/comment/38997823
comment on: http://stackoverflow.com/a/25066887
score: 1
has text: As you say, CF does ship with an older version of BC. If you are positive the machines are running the exact same version, then it is not a discrepancy. One machine must still have the newer version of the BC jar *in the class path*. The other does not. That is why you can access the newer class on one machine, but not the other.
type: AnswerComment
type: Comment

http://stackoverflow.com/q/25032784
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/25032899
tagged with: coordinates
has comment: http://stackoverflow.com/comment/38932222
type: Question
upvote count: 1
tagged with: imageview
answer count: 1
favorite count: 0
tagged with: android
has title: Placing an ImageView at the specific coordinates of another ImageView
accepted answer: http://stackoverflow.com/a/25032899
tagged with: android-imageview
has body: Hello I'm looking for a solution to a problem I'm having, in Android Is there any way of placing one ImageView at specified coordinates on another ImageView? For example, get specific coordinates of ImageView A (lets say dead center), then place ImageView B on the coordinates of ImageView A. Causing ImageView B to be placed dead center in the middle of ImageView B. Then allowing me to change around the coords to move ImageView B around within ImageView A. Apologies if i've written this in a confusing way
has comment: http://stackoverflow.com/comment/38932214

http://stackoverflow.com/comment/38748830
has text: You are still using an `Integer` to look up a value where all the keys are `String`. This means you will never get a value. Sadly the map interface defines `get()` as taking an `Object` instead of an instance of the key type.
type: Comment
comment on: http://stackoverflow.com/a/24935283
score: 1
type: AnswerComment

http://stackoverflow.com/comment/38741823
comment on: http://stackoverflow.com/q/24931677
score: 0
type: Comment
type: QuestionComment
has text: Hmm.I initialized t but next time there is an error like this: private List t =new List(); Exception in thread "main" java.lang.StackOverflowError at List.<init>(List.java:5) at List.<init>(List.java:5) at List.<init>(List.java:5)

http://stackoverflow.com/comment/38902806
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25014727
has text: Fine, thanks for the confirmation. Though totals should be kept accurate.
score: 0

http://stackoverflow.com/q/24955696
tagged with: performance
tagged with: command-pattern
tagged with: java
type: Question
has title: Perform a collection of commands as fast as possible in Java
answer count: 2
downvote count: 2
has answer: http://stackoverflow.com/a/24955788
has body: in my project I want to load a large amount of functions from a script into a collection to hold them and perform them later (probably many times) without reading the script again. I need the Access to the functions to be as fast as possible and thought about two ways of doing so: Command Pattern: My first idea was to store the script commands as objects (command pattern) inside of a collection and perform all of them within a for-each-loop when I need to perform the script. Although the Code will be easier to read I think it will cost a lot of performance and memory to access all the different commands through objects. for (Command command : commandList) { command.execute(); Collection of chars and Switch Case: My second Idea was to store primitive variables like char or int into a collection and put a switch-case construct inside a for-each-loop. I would use primitives because I think its faster then i.e. String objects. Therefore I would use a library like Trove. I think this way it could be faster than the command pattern because no command object has to be accessed. Moreover, less memory will be occupied. On the other hand i think it could be slower because the command pattern can access the right function directly while the switch-case construct has to check many times if the char is a,b,c,d and so on. for (char command : commandList) { switch(command){ case 'a': doA(); break; case 'b': doB(); break; case 'c': ... } } Do you think one way is better? Do you know another way? Which type of collection would you recommend?
score: -2
favorite count: 0
has answer: http://stackoverflow.com/a/24955922
has comment: http://stackoverflow.com/comment/38786752
has comment: http://stackoverflow.com/comment/38787346
tagged with: trove4j
has comment: http://stackoverflow.com/comment/38786816
has comment: http://stackoverflow.com/comment/38786674
upvote count: 0
type: UnansweredQuestion
tagged with: collections
has comment: http://stackoverflow.com/comment/38786981
has comment: http://stackoverflow.com/comment/38786678

http://stackoverflow.com/comment/38868620
comment on: http://stackoverflow.com/q/24998592
has text: as ur log states, u need to change the application theme on android configuration file.
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/a/24936571
score: 1
has body: You can make method to find table name for passed column name. By using SessionFactory.getClassMetaData() you can get all the information about that class. Once you have ClassMetaData then you can get all the property names. An demo method is shown below: public String findTableName(String columnName) { boolean found=false; Map&lt;String, ClassMetadata&gt; classMetaData = sessionFactory.getAllClassMetadata(); for (Entry&lt;String, ClassMetadata&gt; metaData : classMetaData.entrySet()) { String[] propertyNames = metaData.getValue().getPropertyNames(); for (String property : propertyNames) { if(property == columnName) { return metaData.getKey() + "." + property; found=true; break; } } if(found) break; } }
upvote count: 1
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/24933832
accepted answer of: http://stackoverflow.com/q/24933832
has comment: http://stackoverflow.com/comment/39004228
type: Answer

http://stackoverflow.com/a/25036372
answers question: http://stackoverflow.com/q/25036292
type: Answer
score: 2
upvote count: 2
has body: An iterator might throw ConcurrentModificationException if an element is removed from the underlying collection in another way than the iterator's own remove() method. So if you need to remove elements while iterating over a collection, you're allowed to do that with Iterator.remove() but you can't do that with Collection.remove() without risking to get an exception.
downvote count: 0

http://stackoverflow.com/a/33163940
score: 0
has body: Click on the gear icon on the top right of your site page. Goto Site Settings ->Manage site features under 'Site Actions' . In this 'CMIS producer' must be active .
type: Answer
answers question: http://stackoverflow.com/q/24954600

http://stackoverflow.com/q/25047226
has answer: http://stackoverflow.com/a/41780458
has answer: http://stackoverflow.com/a/25052275
type: UnansweredQuestion
upvote count: 13
tagged with: java
tagged with: hibernate
type: Question
has body: I have a table with a simple int id column with Identity auto increment in SQL Server. The entity's Id is annotated with @Id and @GeneratedValue @Id @GeneratedValue(strategy = GenerationType.AUTO) @Column(name = "id", length = 4, precision = 10, nullable = false) private Integer id; In SQL Server the column is properly set as Identity with Seed and Increment equals to 1. When I try to persist an instance of this entity, Hibernate tries to query the hibernate_sequence table to obtain the ID value. Since I haven't created that table in my schema I'm getting an error: could not read a hi value: com.microsoft.sqlserver.jdbc.SQLServerException: Invalid object name 'MySchema.hibernate_sequence' If I change the generation type to IDENTITY everything works as expected @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "id", length = 4, precision = 10, nullable = false) private Integer id; I cannot change it this way, since my App will run both on MS SQL and ORACLE, and the latter does not support auto incremented columns. As far as I know the AUTO type should use the auto increment behaviour if the underlying database has support to it, so I don't know why is not working. UPDATE: It took me some time but I was able to understand exactly what is going on. I am working with legacy databases with the following behaviours: MSSQL: id generation uses table IDENTITY ORACLE: id generation uses a trigger. The trigger queries and updates a custom table where all the "next ids" are stored. This table is called SEQ. Here is the outcome of using some id generation strategies: AUTO: does not work in MSSQL, as explained above IDENTITY: works in MSSQL but is not supported by Oracle "native": works in MSSQL but fails in ORACLE. It fails because Hibernate activates its default sequence strategy, which uses hibernate_sequences.nextval. Since this is a legacy application the values from the SEQ table (mentioned above) and the hibernate_sequences are not synchronized (SEQ's …
tagged with: database
score: 13
tagged with: sql-server
answer count: 3
has title: JPA GenerationType.AUTO not considering column with auto increment
tagged with: jpa
downvote count: 0
has answer: http://stackoverflow.com/a/36182288
favorite count: 0

http://stackoverflow.com/comment/38903798
score: 0
type: Comment
has text: I'm afraid that I haven't found it to be simple. My bookmarks are as posted.
type: AnswerComment
comment on: http://stackoverflow.com/a/25006106

http://stackoverflow.com/comment/38803858
type: AnswerComment
type: Comment
has text: Yep, could have added the suffix (though it might require minor JVM changes). And I suppose if you use `L` then you'd need a cast to keep the compiler from objecting.
comment on: http://stackoverflow.com/a/24964350
score: 0

http://stackoverflow.com/comment/38902908
type: Comment
type: QuestionComment
has text: I'm lost with what you are asking you need to improve your question some more
comment on: http://stackoverflow.com/q/25016930
score: 0

http://stackoverflow.com/a/24970350
upvote count: 1
answers question: http://stackoverflow.com/q/24970120
type: Answer
has body: //change to final CardLayout cardLayout = new CardLayout(); final JPanel cards = new JPanel(cardPanel); cards.setLayout(cardLayout); You have to declare the variables final so you can refer to them from an anonymus inner class new ActionListener() {} Also use the naming convention of java for naming classes => start with capital letter i.e InsuranceMain, LoginPanel
downvote count: 0
score: 1

http://stackoverflow.com/comment/38924438
type: Comment
comment on: http://stackoverflow.com/q/24987649
score: 0
type: QuestionComment
has text: I took some time and got to the bottom of these issues (Maximize issue was pack which happened too early, and the dialog issue was resolved by changing a BoxLayout rigidArea to horizontalGlue).

http://stackoverflow.com/comment/38833460
type: QuestionComment
score: 2
has text: Do some research on MVC Pattern (simple [example from trashgod](http://stackoverflow.com/q/3066590/2587435)). Also Do some research on the Observer pattern. They are similar in ways. Choose the one best fitting, once you grasp both concepts
type: Comment
comment on: http://stackoverflow.com/q/24980539

http://stackoverflow.com/a/24927903
has comment: http://stackoverflow.com/comment/38735390
type: Answer
has comment: http://stackoverflow.com/comment/38734747
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/38744458
has comment: http://stackoverflow.com/comment/38735225
has body: Th 8k limit probably just an outdated heuristic. Back in the days [TM], JITing was somewhat costly (especially when viewed from a responsiveness point-of-view). In fact, most interesting optimizations (think constant-folding, good register-allocation etc.) are super-linear. Hence you want to be extra careful not to stop the whole process for half a second to run an optimization task that might only yield a fraction of that time as performance gain. Nevertheless, I guess with the grown experience, faster processors and better JIT-techniques, the limit could be somewhat lifted (probably even by an order of magnitude), but the core problem of super-linear performance remains and so will the limit.
upvote count: 1
answers question: http://stackoverflow.com/q/24927813
has comment: http://stackoverflow.com/comment/38740974

http://stackoverflow.com/comment/38753679
comment on: http://stackoverflow.com/q/24937901
has text: This doesn't sound like multiple inheritance.
type: Comment
type: QuestionComment
score: 2

http://stackoverflow.com/q/24928124
tagged with: java
has comment: http://stackoverflow.com/comment/38735209
upvote count: 1
type: Question
tagged with: comparison
has answer: http://stackoverflow.com/a/24928169
has title: Parse String into Comparator Type in Java
tagged with: comparator
answer count: 1
downvote count: 0
tagged with: string
tagged with: parsing
favorite count: 0
has comment: http://stackoverflow.com/comment/38735051
has comment: http://stackoverflow.com/comment/38735308
has body: Given the Strings String str1 = "=="; String str2 = "&lt;="; String str3 = "!="; ... Is there a way to parse those Strings into their corresponding comparator types to use them directly in a comparison (like "comparator.parseComparator(str1)")? Or do i need to find a different way?
accepted answer: http://stackoverflow.com/a/24928169
type: AnsweredQuestion
score: 1

http://stackoverflow.com/a/24949096
type: Answer
downvote count: 0
upvote count: 8
has body: According to Spring Security documentation the main purpose of /** is to catch-all wildcards: In practice we recommend that you use method security at your service layer, to control access to your application, and do not rely entirely on the use of security constraints defined at the web-application level. URLs change and it is difficult to take account of all the possible URLs that an application might support and how requests might be manipulated. You should try and restrict yourself to using a few simple ant paths which are simple to understand. Always try to use a “deny-by-default” approach where you have a catch-all wildcard (/** or **) defined last and denying access. We also should not forget that Patterns are always evaluated in the order they are defined. Thus it is important that more specific patterns are defined higher in the list than less specific patterns. Thus we can have something like this: &lt;security:http pattern="/rest-service/**" authentication-manager-ref="authenticationManager" auto-config="false" access-decision-manager-ref="accessDecisionManager"&gt; &lt;security:intercept-url pattern="/rest-service/report/export/xml" access="AUTH_REPORT_EXPORTXML" /&gt; &lt;security:intercept-url pattern="/**" access="AUTH_SYSTEM_LOGIN" /&gt; &lt;security:http-basic /&gt; &lt;/security:http&gt; which means that for all requests we will need AUTH_SYSTEM_LOGIN authority, but specifically for /rest-service/report/export/xml the user will need AUTH_REPORT_EXPORTXML authority as well because it is defined above. As they also say it is better not rely only on this security constrains which means that it is good also to duplicate those in service methods with secured annotation like this: @Secured("AUTH_REPORT_EXPORTXML") In general as I understand there is no difference between /* and /** except that the last one catches all the wildcards.
answers question: http://stackoverflow.com/q/24948651
score: 8

http://stackoverflow.com/q/24972123
tagged with: jaxb2-basics
score: 0
tagged with: xjc
has answer: http://stackoverflow.com/a/24972629
has body: We extend JAXBEqualsStrategy via pom: -Xequals-equalsStrategyClass=com.acme.foo.CustomEqualsStrategy The CustomEqualsStrategy extends JAXBEqualsStrategy. After running MAVEN clean install generate-source in Eclipse (Keplar) our model classes have equals method like this: public boolean equals(Object object) { final EqualsStrategy strategy = new CustomEqualsStrategy(); return equals(null, null, object, strategy); } Whereas if we do not extend JAXBEqualsStrategy, our model classes have equals method like this: public boolean equals(Object object) { final EqualsStrategy strategy = JAXBEqualsStrategy.INSTANCE; return equals(null, null, object, strategy); } JAXBEqualsStrategy has public static EqualsStrategy INSTANCE = new JAXBEqualsStrategy(); We expected to get final EqualsStrategy strategy = CustomEqualsStrategy.INSTANCE; in the generated equals method and are struggling to accomplish it.
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25079192
has title: When extending JAXBEqualsStrategy, generated equals is different than when not extending
tagged with: maven
tagged with: java
type: Question
answer count: 2

http://stackoverflow.com/comment/38927162
has text: @geoand its custom request parameter `CRequestParam` for which we have `CRequestparamResolver` resolver.
comment on: http://stackoverflow.com/q/25030008
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25024635
possible better answer: http://stackoverflow.com/a/25024687
answer count: 2
has body: I am trying to create a toString method which return the name, address and phone number of a person. The output format that I want as following: Anna Brown 1234 Sweet Road Los Angeles, CA 99999 Phone: 888.8888.888 The address is 1234 Sweet Road Los Angeles, CA 99999 but I want the city is in a new line. I tried this but it does not work. can someone help me out please? public String toString() { return String.format( "%-25s\n %-14s\n\n\n%-25s", name,address, phone ); }
has answer: http://stackoverflow.com/a/25024729
accepted answer: http://stackoverflow.com/a/25024729
has comment: http://stackoverflow.com/comment/38917224
upvote count: 1
has title: new line using toString in Java
linked to: http://stackoverflow.com/q/1883345
favorite count: 0
has answer: http://stackoverflow.com/a/25024687
downvote count: 2
has comment: http://stackoverflow.com/comment/38919658
has comment: http://stackoverflow.com/comment/38917423
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/38917685
score: -1
has comment: http://stackoverflow.com/comment/38917266
type: Question
has comment: http://stackoverflow.com/comment/38917699
has comment: http://stackoverflow.com/comment/38917349

http://stackoverflow.com/a/24986890
upvote count: 4
has comment: http://stackoverflow.com/comment/38845789
downvote count: 0
has body: You can't have a statement after the return statement, or to be more exact - a statement imediatelly after a return statement (such as your println) can never be executed, and is therefore an error. The println should be before the return statement. public static int max3(int a, int b, int c) { int max = a; if (b &gt; max) max = b; if (c &gt; max) max = c; System.out.println(max); return max; }
answers question: http://stackoverflow.com/q/24986875
score: 4
type: Answer

http://stackoverflow.com/q/25014132
tagged with: android
score: 2
has body: I have an custom view that has a circular shape. the circle has a touch listener, which will shows an animation when it is touched. (i will use a red spot for reference.) but the problem is, when I touch ouside the circle, the animation is shown, which is useless. so, my question is, can I make this view touchable inside the circle?
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/38897138
type: Question
tagged with: android-view
has answer: http://stackoverflow.com/a/53839793
has title: Android - Make custom view's transparent area not clickable
possible better answer: http://stackoverflow.com/a/53839793
answer count: 3
has answer: http://stackoverflow.com/a/25014399
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/25014399
has answer: http://stackoverflow.com/a/25014989
upvote count: 2
has comment: http://stackoverflow.com/comment/38897418
has comment: http://stackoverflow.com/comment/38897844

http://stackoverflow.com/a/24987798
answers question: http://stackoverflow.com/q/24987533
has body: You need to use FragmentActivity (or ActionBarActivity if you want a backward compatible Action Bar) and getSupportFragmentManager() if you want to use android.support.v4.app.Fragment The other option, of course, is to use the non-support v4 versions of Fragment and LoaderManager.
has comment: http://stackoverflow.com/comment/38848107
type: Answer
has comment: http://stackoverflow.com/comment/38848346
has comment: http://stackoverflow.com/comment/38848167
has comment: http://stackoverflow.com/comment/38849217
score: 0
has comment: http://stackoverflow.com/comment/38848079
has comment: http://stackoverflow.com/comment/38848175

http://stackoverflow.com/comment/38917333
type: QuestionComment
comment on: http://stackoverflow.com/q/25024500
score: 0
has text: With this code, the problem was solved. Thanks.
type: Comment

http://stackoverflow.com/comment/39000049
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25068470
has text: @RJadhav what do you mean?
score: 0

http://stackoverflow.com/q/24918884
has answer: http://stackoverflow.com/a/24918996
tagged with: jtable
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/56505844
favorite count: 0
type: UnansweredQuestion
has title: Dynamically updating jTable
score: 2
upvote count: 2
tagged with: java
tagged with: swing
type: Question
has body: My table will change the entire dataset during runtime. My current code looks like below, public class gui_test_form extends JFrame{ private JPanel rootpanel; private JTable testTable; private JScrollPane testScrollPane; private JButton testButton; private String[] columnNames = {"Name", "Color"}; private Object[][] data = { {"John", "Blue"}, {"Oliver", "Green"}, {"Paul", "Red"} }; public gui_test_form() { super("GUI TEST"); setContentPane(rootpanel); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); pack(); setVisible(true); testButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { // Button Clicked //Get new values data[0][0] = "New Value"; //Update table testTable.setModel(new DefaultTableModel(data, columnNames)); } }); } } The code works as I expected. But I don't think making a new DefaultTableModel everytime is the best way to go. What should I be doing? I looked briefly into fireTableChanged() method for AbstractTableModel, but couldn't make it work. I expected it would work since DefaultTableModel is inherited from AbstractTableModel. Any help is appreciated. -------Edit------- Forgive me if I wasn't clearer before, but the problem is that I want to update the whole dataset. Even the Column names and the number of columns and rows are going to change. For example, in the above code I could do this, and it would still work as you'd expect. //Get new values columnNames = new String[]{"Country", "Location", "Latitudes"}; data = new Object[][]{ {"John", "Blue", "1"}, {"Oliver", "Green", "4"}}; //Update table

http://stackoverflow.com/comment/38732837
type: AnswerComment
type: Comment
score: 0
comment on: http://stackoverflow.com/a/24926541
has text: so use an Alarm Manager to do his : `Calendar cal = Calendar.getInstance();cal.add(Calendar.HOUR, heure); Intent intent = new Intent(this, MyBroadcastReceiver.class); PendingIntent sender = PendingIntent.getBroadcast(this, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT); AlarmManager am = (AlarmManager) this .getSystemService(Context.ALARM_SERVICE); am.setRepeating(AlarmManager.RTC_WAKEUP, cal.getTimeInMillis(), heure*3600*1000, sender);`

http://stackoverflow.com/q/24981278
score: 5
has comment: http://stackoverflow.com/comment/38835319
has comment: http://stackoverflow.com/comment/38834978
upvote count: 5
has comment: http://stackoverflow.com/comment/38835382
has comment: http://stackoverflow.com/comment/38912404
has title: Design patterns for type-safe integers?
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/38835299
has comment: http://stackoverflow.com/comment/38835178
has comment: http://stackoverflow.com/comment/38834801
has comment: http://stackoverflow.com/comment/38836260
favorite count: 0
has comment: http://stackoverflow.com/comment/38834922
has answer: http://stackoverflow.com/a/24981580
has body: I have an application that works with a entities that all have an integer ___ID primary key (e.g. StudentID, CourseID...etc) I want to add a bit of type safety to the program, so for example a function that takes as input a StudentID, cannot be accidentally passed a CourseID. First idea that came to my mind is to create simple empty classes like this: public class StudentID extends java.util.Integer {} public class CourseID extends java.util.Integer {} This doesn't work since java.util.Integer is final and can't be extended. Second idea is to have a data class that only holds an integer: public class StudentID { private final int id; public int get() { return id; } } Though it would be a lot of boilerplate code. Third idea is like second idea but to save on boilerplate code by having one base class that defines the get method and empty classes that inherit from it: public abstract class AbstractID { private final int id; public int get() { return id; } } public class StudentID extends AbstractID{}; public class CourseID extends AbstractID{}; Are there any other/better known patterns for this problem?
has comment: http://stackoverflow.com/comment/38835145
tagged with: design-patterns
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38835034
tagged with: java
tagged with: type-safety
type: Question
accepted answer: http://stackoverflow.com/a/24981580

http://stackoverflow.com/q/24974825
has comment: http://stackoverflow.com/comment/38823162
has body: I currently have an app that essentially let's the user enter text in an editText. And when the user clicks the button "create", it creates a textView with the text of what was in the editText(the user can make as many as he or she wants). Simultaneously, I have a sharedPreference that will save the String entered by the user when a textView is made. My app then allows the user to go onto another activities page that has them doing something else with each piece of text they entered on the previous page. So, I need my app to retain the textViews that were created. This is why I have the sharedPreference saving the text of each textView. My question is, how can I take each String saved into my sharedPreference, and then put each onto a textView that will be created when the activity starts. I won't know the names of the key for each value, because it will be whatever the user typed in, and I won't know how many pieces of text the user will make, because there isn't a limit or minimum to how many he or she can make.
has answer: http://stackoverflow.com/a/24974853
has comment: http://stackoverflow.com/comment/38822978
has title: How to receive and show all key/value pairs in android?
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/38823222
has comment: http://stackoverflow.com/comment/38823284
tagged with: java
tagged with: sharedpreferences
type: Question
has comment: http://stackoverflow.com/comment/38823143
has answer: http://stackoverflow.com/a/24975008
score: 0
answer count: 2

http://stackoverflow.com/comment/38746449
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/24931547
has text: What do you mean by "it is unable to view the log file in multiple pages"?
type: Comment

http://stackoverflow.com/q/24938301
has answer: http://stackoverflow.com/a/25063254
type: Question
has answer: http://stackoverflow.com/a/24938479
has comment: http://stackoverflow.com/comment/38754409
tagged with: ant
tagged with: compilation
score: 0
answer count: 2
linked to: http://stackoverflow.com/q/423938
tagged with: compiler-errors
type: UnansweredQuestion
has title: Editing a .java file and recompiling
has body: Newbie java question, I am sure this has been answered but cannot find a solution anywhere :( I want to use this java program contained here http://sourceforge.net/projects/ant-tibco/files/ wich consists of a ant-tibco.jar file and many .java files contained here .\ant-tibco\src\org\apache\tools\ant\taskdefs\optional\tibco I want to edit a line in one of these .java files, but after that I am not sure how to compile to commit these changes, I have tried javac but keep getting "cannot find symbol" exceptions. What do I need to commit and compile changes made in these .java files to the ant-tibco.jar file? Any help is greatly appreciatted! Thank you!
tagged with: java

http://stackoverflow.com/a/25043764
has comment: http://stackoverflow.com/comment/38953039
has body: ( | )+ is a pretty basic example of possible catastrophic backtracking. In this case, it's probably better called catastrophic branching, as no backtracking is involved. It appears as if Java may implement branching using recursion, although I'm not sure if 10000 levels deep is deep enough to trigger an overflow. It's also possible that it's trying to go 2^10000 levels deep, but as I know nothing about the internals, this is pure speculation. Update: You said that 1000 wasn't enough to overflow, so it definitely looks linear and not exponential. Why don't you try shortening your string, and see exactly how long it has to be before you get the overflow? Also, try something like (apple|banana)+, and see if it suffers from the same problem. Update: The problem appears to occur for any branching scenario. It's definitely a weakness in the Java regex engine, though I couldn't tell you exactly why. In addition to Python, I can confirm it works fine in .NET and JavaScript (my browser, anyway). I don't see this being a problem in an NFA-driven engine. I'm assuming that Java uses another approach, but I couldn't find anywhere that this is documented.
score: 5
answers question: http://stackoverflow.com/q/25043508
has comment: http://stackoverflow.com/comment/38953121
has comment: http://stackoverflow.com/comment/38953162
upvote count: 5
has comment: http://stackoverflow.com/comment/38952925
type: Answer
has comment: http://stackoverflow.com/comment/38952823
downvote count: 0
has comment: http://stackoverflow.com/comment/38952904

http://stackoverflow.com/q/25014585
accepted answer: http://stackoverflow.com/a/25014796
linked to: http://stackoverflow.com/q/6833319
favorite count: 0
linked to: http://stackoverflow.com/q/75794935
has comment: http://stackoverflow.com/comment/133781481
score: 6
tagged with: maven
upvote count: 6
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38898015
tagged with: java
has answer: http://stackoverflow.com/a/25014796
type: Question
has title: How to check that all Maven dependencies are compiled for Java 6
has body: I am looking for a Maven-Plugin (or an other maven way) to enforce that all dependencies of a Maven project are compiled for the right java major version class file format. Background: I am downgrading an existing project from Java 7 to Java 6, and I need to check that the libs are compiled for Java 6 (major version 50) (Using jdk6 and hope that every library is used in at least one test, is not the solution I am looking for.)
answer count: 1
has comment: http://stackoverflow.com/comment/38897894
downvote count: 0

http://stackoverflow.com/comment/38844086
type: Comment
has text: @uglycat5 Can you point to any reference to back that statement? I've worked on a product that shipped with Rhinojs embedded and `load` worked fine for us.
comment on: http://stackoverflow.com/a/24965702
score: 0
type: AnswerComment

http://stackoverflow.com/comment/38776876
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24949972
score: 1
has text: [Runtime Polymorphism](http://en.wikipedia.org/wiki/Polymorphism_(computer_science)) also allows Interfaces, not just Subtyping/Overriding. (I try to *avoid* inheritance Polymorphism in general, but encourage the usage of interfaces.)

http://stackoverflow.com/comment/38909819
comment on: http://stackoverflow.com/a/25020889
score: 0
type: Comment
type: AnswerComment
has text: I think OP's confusion stems from the fact that `SourceConfig` itself is generic, and has a wildcard too.

http://stackoverflow.com/a/24909399
accepted answer of: http://stackoverflow.com/q/24909275
has comment: http://stackoverflow.com/comment/38699442
upvote count: 2
has body: The string containing the datetime should be within apostrophes, like '2014-07-23 12:00:00' And not only 2014-07-23 12:00:00 Is this the case?
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/24909275
score: 2
downvote count: 0

http://stackoverflow.com/q/24941004
has title: Eclipse turn off 'alert when export has warnings' feature?
downvote count: 1
type: AnsweredQuestion
tagged with: java
score: -1
tagged with: eclipse
type: Question
has answer: http://stackoverflow.com/a/24941075
upvote count: 0
answer count: 1
tagged with: jar
favorite count: 0
has body: I am working on a Java project in eclipse that has to be exported into a jar each time I need to test it. There are plenty of warnings throughout the code, cannot be avoided. When I export the jar I get this alert: I do not need/want this alert, it's just a minor inconvenience to my workflow. How can I turn it off? Thanks
has comment: http://stackoverflow.com/comment/38759602
accepted answer: http://stackoverflow.com/a/24941075

udp
tags question: http://stackoverflow.com/q/25032018
tags question: http://stackoverflow.com/q/25037550
tags question: http://stackoverflow.com/q/24935038
tag name: udp
type: Tag
tags question: http://stackoverflow.com/q/25020660

http://stackoverflow.com/comment/38828911
comment on: http://stackoverflow.com/q/24977933
type: Comment
type: QuestionComment
has text: If you initialize your array with the `row` and `colmn` variables then you can't loop over it as long `i` or `v` are smaller or *equal* than these values. So change `for(int i=0;i<=row;i++)` to `for(int i=0;i<row;i++)` and `for(int v=0;v<=colmn;v++)` to `for(int v=0;v<colmn;v++)`. Explanation: If `row` is 4 the array indices are from 0 to 3. If you loop until `i` is larger than `row` you will receive an ArrayIndexOutOfBoundsException if `i` hits the 4.
score: 0

netsuite
tags question: http://stackoverflow.com/q/25053506
tag name: netsuite
type: Tag

http://stackoverflow.com/comment/38711363
type: QuestionComment
comment on: http://stackoverflow.com/q/24915336
has text: Furthermore, a singleton is a programming pattern, not a language construct.
score: 0
type: Comment

http://stackoverflow.com/a/25053764
score: 1
answers question: http://stackoverflow.com/q/25053124
has comment: http://stackoverflow.com/comment/39005826
downvote count: 0
has body: My understanding is this exception typically comes from the native code ZIP library; e.g. when your code attempts to open a ZIP file. (At least, that's the case for the examples that Google showed me.) It could be a file (or directory) permission issue, but I think that ought to throw an IOException (or a subclass). IMO, it is more likely that either the ZIP (or JAR / WAR / EAR / etc) file that the code is trying to open is corrupted / truncated, or (maybe) it is some variant that your JVM doesn't understand, or ... it is not a ZIP file at all. Assuming that you know the pathname for the file, try reading it with your system's (non-Java) zip file utility. That should give you some clues.
type: Answer
has comment: http://stackoverflow.com/comment/39082129
upvote count: 1
has comment: http://stackoverflow.com/comment/39007610

http://stackoverflow.com/a/24956005
has comment: http://stackoverflow.com/comment/38788131
answers question: http://stackoverflow.com/q/24955855
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/38787150
has body: EDIT: Tried again with creating nio_data.txt file The first one (correct path) printed 'one' the only thing in the file. However I still got FNFE for the second two. Perhaps it's something with your exceptions.

http://stackoverflow.com/a/24910921
has comment: http://stackoverflow.com/comment/38704351
type: AcceptedAnswer
type: Answer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24910684
answers question: http://stackoverflow.com/q/24910684
score: 1
has body: You cannot work this way, with a global Statement field stat. Connections, statements and result sets should be closed. Look at examples, preferably with PreparedStatement, and try-with-resources. Also user and password may be given as separate paramters. try (PreparedStatemen stat = connection.prepareStatement( "SELECT 1 FROM tokens WHERE name=? LIMIT 1")) { stat.setString(1, name); try (ResultSet rs = stat.executeQuery()) { if (!rs.next()) { return "Not found"; } } } Above stat and rs are closed, even despite the return. Prepared statements do not need the single quote put in the SQL string, and escape single quote, backslash etc. Also SQL injection, malicious input is prevented.
upvote count: 1

http://stackoverflow.com/q/24913721
has answer: http://stackoverflow.com/a/24914329
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24914329
upvote count: 1
type: Question
has title: Counter Occurrences of User Specified String in a Text File
score: 1
tagged with: java
has body: Count keeps coming up zero. I'm just trying to read the text file and look for the word, and display the count back to the user. I'm not sure where it's falling apart. The If statement I think, but not sure where the syntax is going wrong. Thanks for any help! import java.io.File; import java.io.FileNotFoundException; import java.util.*; import javax.swing.*; public class TextSearchFromFile { public static void main(String[] args) throws FileNotFoundException { boolean run = true; int count = 0; //greet user JOptionPane.showMessageDialog(null, "Hello, today you will be searching through a text file on the harddrive. \n" + "The Text File is a 300 page fantasy manuscript written by: Adam\n" + "This exercise was intended to have the user enter the file, but since \n" + "you, the user, don't know which file the text to search is that is a \n" + "bit difficult.\n\n" + "On the next window you will be prompted to enter a string of characters.\n" + "Feel free to enter that string and see if it is somewhere in 300 pages\n" + "and 102,133 words. Have fun.", "Text Search", JOptionPane.PLAIN_MESSAGE); while (run) { try { //open the file Scanner scanner = new Scanner(new File("An Everthrone Tale 1.txt")); //prompt user for word CharSequence findWord = JOptionPane.showInputDialog(null, "Enter the word to search for:", "Text Search", JOptionPane.PLAIN_MESSAGE); count = 0; while (scanner.hasNext()) { if ((scanner.next()).contains(findWord)) { count++; } } //end search loop //output results to user JOptionPane.showMessageDialog(null, "The results of your search are as follows: \n" + "Your String: " + findWord + "\n" + "Was found: " + count + " times.\n" + "Within the file: An Ever Throne Tale 1.txt", "Text Search", JOptionPane.PLAIN_MESSAGE); } //end try catch (NullPointerException e) { JOptionPane.showMessageDialog(null, "Thank you for using the Text Search.", "Text Search", JOptionPane.ERROR_MESSAGE); System.exit(0); } } //end run loop } // end main } // end class EDIT: Need help …
downvote count: 0
answer count: 1
tagged with: string
tagged with: full-text-search
favorite count: 0

http://stackoverflow.com/q/24964204
upvote count: 0
downvote count: 5
has comment: http://stackoverflow.com/comment/38803347
has comment: http://stackoverflow.com/comment/38803304
has comment: http://stackoverflow.com/comment/38804241
answer count: 1
has comment: http://stackoverflow.com/comment/38803287
has answer: http://stackoverflow.com/a/24964225
favorite count: 0
has comment: http://stackoverflow.com/comment/38803322
has comment: http://stackoverflow.com/comment/38803476
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38803384
has comment: http://stackoverflow.com/comment/38803251
has title: Java Integer changing back the second after it changes
has comment: http://stackoverflow.com/comment/38803274
score: -5
has comment: http://stackoverflow.com/comment/38803548
tagged with: java
has body: My code, int selection = 0; if(checkKey(Keyboard.KEY_Z)){ selection++; System.out.println(selection); } if(checkKey(Keyboard.KEY_B)){ selection--; System.out.println(selection); } Does not appear to be functioning correctly. The integer selection seems to be changing back to 0 almost immediately after it is changed by the key function. Heres the code surrounding it which is relevant int selection = 0; if(checkKey(Keyboard.KEY_Z)){ selection++; System.out.println(selection); } else if(checkKey(Keyboard.KEY_B)){ selection--; System.out.println(selection); } if(selection &lt; 14){ selection = 1; } if(selection == -1){ selection = 14; } if(Toggles.clickMenu){ if(selection == 1){ var8.drawStringWithShadow(Strings.textsymbol + "b&lt;", 62, 34, 0000); if(this.mc.gameSettings.Enter.isPressed()){ Toggles.fly = !Toggles.fly; } }else if(selection == 2.0){ var8.drawStringWithShadow(Strings.textsymbol + "b&lt;", 62, 46, 0000); if(this.mc.gameSettings.Enter.isPressed()){ Toggles.sprint = !Toggles.sprint; } }else if(selection == 3){ var8.drawStringWithShadow(Strings.textsymbol + "b&lt;", 62, 58, 0000); if(this.mc.gameSettings.Enter.isPressed()){ Toggles.autojump = !Toggles.autojump; } } } Here is even further out code: if(Toggles.clickMenu2){ Gui.drawRect(85, 200, 161, 0, 0xaa000000); var8.drawStringWithShadow("Menu2", 90, 4, 0x00ff00); if(Toggles.off == true){ var8.drawStringWithShadow(Strings.textsymbol + "bSpeedMeUp", 87, 16, 0000); }else{ var8.drawStringWithShadow(Strings.textsymbol + "bSpeedMeUp", 87, 16, 0000); } // if(Toggles.off == true){ // var8.drawStringWithShadow(Strings.textsymbol + "b[=]", 144, 16, 0000); // }else{ // var8.drawStringWithShadow(Strings.textsymbol + "b[=]", 144, 16, 0000); // } if(Toggles.mute == true){ var8.drawStringWithShadow(Strings.textsymbol + "bGoFancy", 87, 28, 0000); }else{ var8.drawStringWithShadow(Strings.textsymbol + "bGoFancy", 87, 28, 0000); } // if(Toggles.mute == true){ // var8.drawStringWithShadow(Strings.textsymbol + "b[-]", 144, 28, …
type: Question
has comment: http://stackoverflow.com/comment/38803280

http://stackoverflow.com/a/71096250
has body: If you really just want any element of a set, this will work fine. String s = set.iterator().next(); If you are unsure whether there is an element in the set, use: String s; Iterator&lt;String&gt; it = set.iterator(); if (it.hasNext()) { s = it.next(); } else { // set was empty }
score: 0
type: Answer
answers question: http://stackoverflow.com/q/24923787

http://stackoverflow.com/a/43097504
type: Answer
answers question: http://stackoverflow.com/q/24977783
score: 0
has body: One more for Java 8: count = str.chars() .filter(c -&gt; c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u' ) .count();

http://stackoverflow.com/comment/38832739
comment on: http://stackoverflow.com/q/24979926
score: 0
type: Comment
type: QuestionComment
has text: You may have some corrupted/invisible character somewhere in your string, try with successively more and more characters to see where it fails.

http://stackoverflow.com/comment/38866193
comment on: http://stackoverflow.com/a/24997396
type: AnswerComment
score: 0
type: Comment
has text: Also, the first thing you should come across when you google "java keylistener" is a [tutorial](http://docs.oracle.com/javase/tutorial/uiswing/events/keylistener.html) that is pretty detailed.

http://stackoverflow.com/comment/38719795
comment on: http://stackoverflow.com/q/24919559
has text: "([^\\(]\\S*|\\(.+?\\))\\s*" - ouch. But a single split is not sufficient, you need to compile it and use a matcher.
score: 0
type: Comment
type: QuestionComment

jpa
tags question: http://stackoverflow.com/q/25014649
tags question: http://stackoverflow.com/q/24933492
tags question: http://stackoverflow.com/q/24990215
tags question: http://stackoverflow.com/q/24937678
tags question: http://stackoverflow.com/q/25006932
tags question: http://stackoverflow.com/q/24923054
tags question: http://stackoverflow.com/q/25014623
tags question: http://stackoverflow.com/q/24957438
tags question: http://stackoverflow.com/q/24997851
tags question: http://stackoverflow.com/q/24909904
tags question: http://stackoverflow.com/q/24919663
tags question: http://stackoverflow.com/q/24938559
tags question: http://stackoverflow.com/q/24978844
tags question: http://stackoverflow.com/q/25062368
tags question: http://stackoverflow.com/q/24916810
tags question: http://stackoverflow.com/q/25006284
tags question: http://stackoverflow.com/q/25060871
tags question: http://stackoverflow.com/q/25069380
tags question: http://stackoverflow.com/q/24923915
tags question: http://stackoverflow.com/q/25029906
tags question: http://stackoverflow.com/q/25014572
tags question: http://stackoverflow.com/q/25011552
tags question: http://stackoverflow.com/q/24991581
tags question: http://stackoverflow.com/q/24912722
tags question: http://stackoverflow.com/q/24943436
tags question: http://stackoverflow.com/q/24989710
tags question: http://stackoverflow.com/q/25015638
tags question: http://stackoverflow.com/q/25022326
tags question: http://stackoverflow.com/q/25067844
tags question: http://stackoverflow.com/q/24935372
tags question: http://stackoverflow.com/q/25006764
tags question: http://stackoverflow.com/q/25051831
tags question: http://stackoverflow.com/q/25033896
tags question: http://stackoverflow.com/q/24995881
tags question: http://stackoverflow.com/q/25032280
tags question: http://stackoverflow.com/q/24926438
tags question: http://stackoverflow.com/q/24976701
tags question: http://stackoverflow.com/q/24914370
tags question: http://stackoverflow.com/q/25039632
tags question: http://stackoverflow.com/q/24955817
type: Tag
tags question: http://stackoverflow.com/q/25037380
tags question: http://stackoverflow.com/q/24958897
tags question: http://stackoverflow.com/q/25020393
tags question: http://stackoverflow.com/q/25067428
tags question: http://stackoverflow.com/q/24994216
tags question: http://stackoverflow.com/q/24909533
tags question: http://stackoverflow.com/q/25048199
tags question: http://stackoverflow.com/q/24970060
tags question: http://stackoverflow.com/q/25008082
tags question: http://stackoverflow.com/q/24975813
tags question: http://stackoverflow.com/q/25033898
tags question: http://stackoverflow.com/q/24987298
tags question: http://stackoverflow.com/q/24951425
tags question: http://stackoverflow.com/q/25003365
tags question: http://stackoverflow.com/q/24959879
tags question: http://stackoverflow.com/q/25053792
tags question: http://stackoverflow.com/q/24914788
tags question: http://stackoverflow.com/q/25005315
tags question: http://stackoverflow.com/q/25008359
tags question: http://stackoverflow.com/q/25036961
tags question: http://stackoverflow.com/q/24918525
tags question: http://stackoverflow.com/q/25033556
tags question: http://stackoverflow.com/q/25020119
tags question: http://stackoverflow.com/q/24992105
tags question: http://stackoverflow.com/q/25003138
tags question: http://stackoverflow.com/q/25034352
tags question: http://stackoverflow.com/q/24945415
tags question: http://stackoverflow.com/q/25067298
tags question: http://stackoverflow.com/q/24942563
tags question: http://stackoverflow.com/q/25057752
tag name: jpa
tags question: http://stackoverflow.com/q/24958142
tags question: http://stackoverflow.com/q/24917105
tags question: http://stackoverflow.com/q/24939621
tags question: http://stackoverflow.com/q/24989604
tags question: http://stackoverflow.com/q/24971854
tags question: http://stackoverflow.com/q/25047226
tags question: http://stackoverflow.com/q/25017967
tags question: http://stackoverflow.com/q/25041000

http://stackoverflow.com/q/25049170
tagged with: string
has answer: http://stackoverflow.com/a/25050257
favorite count: 0
type: UnansweredQuestion
tagged with: android
upvote count: 0
has comment: http://stackoverflow.com/comment/38963310
tagged with: java
score: -4
type: Question
downvote count: 4
has body: Im using eclipse and making an android app and need to make a string appear for 10 seconds and then dissapear.
has comment: http://stackoverflow.com/comment/38963276
has comment: http://stackoverflow.com/comment/38963227
has title: How do i make a string temporarily appear for 10 seconds then dissapear
answer count: 1

http://stackoverflow.com/comment/38778638
comment on: http://stackoverflow.com/q/24934465
score: 0
type: Comment
type: QuestionComment
has text: Yes, thank you all for your help. I will share everything. The input file I use to parse is generated in the talend workflow. Link is at the bottom of my question. Im open for any suggestion how to solve this problem in one workflow! I Don't feel I'm doing it the easy way :)

http://stackoverflow.com/q/24978300
has body: I'm trying to set up a small Android application which extracts content from a web page using the Goose library. Since the library is written in Scala, I'm using the .jar I found here. The problem is, when I try to extract content from a page, it returns nothing. I successfully create an Article object using the URL I need, but the values of the object (title, domain, topImage etc.) are all null. I tried using different urls, to see if the problem was isolated to a single website, but it doesn't appear to be so. The code I use to set up the Goose instance is this: gooseDir = context.getCacheDir(); Configuration config = new Configuration(); config.setLocalStoragePath(gooseDir.getAbsolutePath()); Goose goose = new Goose(config); And then I just create the Article instance like so: Article article = goose.extractContent(url); Any advice?
has answer: http://stackoverflow.com/a/39327465
answer count: 1
downvote count: 0
favorite count: 0
tagged with: scala
type: UnansweredQuestion
tagged with: android
has title: Java Goose not extracting content on Android
score: 1
tagged with: java
upvote count: 1
type: Question
tagged with: goose

http://stackoverflow.com/q/24940827
tagged with: swing
type: Question
tagged with: key-bindings
tagged with: jtextarea
tagged with: keylistener
score: 0
answer count: 1
type: UnansweredQuestion
has body: Guys weird problem im facing Basically i have 2 textAreas... (diplaybox and textbox) while typing in textbox, the moment "Enter" is pressed i want all the text entered in textbox to go to displaybox... and textbox should be empty... it all works fine, except... after the text is transfered the cursor position of the textbox isnt on the topmost left side... it is somehow blinking on one line below that!(possibly because "ENTER" still got excecuted)... please see code any ideas? thanks in advance... just need the cursor to go back to the topmost left like how it is when we start typing ... without having to use KeyReleased event... something isnt feeling right... im sure this isnt he way it is actually done.. what say? public void keyPressed(KeyEvent e) { if(e.getKeyCode() == KeyEvent.VK_ENTER)// | (e.getKeyCode() == KeyEvent.VK_B)) { //Toolkit.getDefaultToolkit().beep(); displaybox.append(textbox.getText() + "\n"); //textbox.setCaretPosition(0); //textbox.setText(""); System.out.println(textbox.getCaretPosition()); } } public void keyTyped(KeyEvent e) {} public void keyReleased(KeyEvent e) { if(e.getKeyCode() == KeyEvent.VK_ENTER) {textbox.setCaretPosition(0); textbox.setText(""); System.out.println(textbox.getCaretPosition()); } }
has answer: http://stackoverflow.com/a/24941196
has title: JtextArea cursor position after keypress of ENTER
tagged with: java

http://stackoverflow.com/comment/38721206
comment on: http://stackoverflow.com/q/24920392
type: Comment
type: QuestionComment
has text: I don't believe so. I think I've optimized the comparisons as much as possible and it still needs all the data at once. If I have 5 lists it needs to compare 1-2,1-3,1-4,1-5,2-3,2-4,2-5,3-4,3-5,4-5. I do know the basics of lamnda and streams.
score: 0

http://stackoverflow.com/q/25050919
tagged with: observablelist
tagged with: sortedlist
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25051038
has body: I have an ObservableList filled with Objectives. I don't care what the order of the original list is. I am using a sorted list to handle the sorting. For this particular list, I am letting the comparator sort according to the Objectives' magnitude level. In the first case, Objective one &lt; two. Now, if I change the magnitude via the original list or via the Objectives directly, the sortedlist will not sort itself. If I use the set() method from the sorted list, however, it will sort itself. Is there no other way to set fields and have the sorted list sort itself out? I want to make changes to the original list and have the sorted list realize this. ObservableList&lt;Objective&gt; list = FXCollections.observableArrayList(); Objective one = new Objective(), two = new Objective(); one.setMagnitude(10); two.setMagnitude(5); list.addAll(one, two); SortedList&lt;Objective&gt; sorted = new SortedList&lt;Objective&gt;(list, (Comparator&lt;? super Objective&gt;) (Objective x, Objective y) -&gt; { int first = x.getMagnitude(); int second = y.getMagnitude(); if (first &gt; second) return 1; else if (second &gt; first) return -1; else return 0; }); System.out.println("SortedList:" + sorted.toString()); list.get(0).setMagnitude(1); list.get(1).setMagnitude(50); System.out.println("SortedList:" + sorted.toString()); System.out.println("Source List:" + list.toString()); SortedList:[5, 10] SortedList:[50, 1] Source List:[1, 50]
has comment: http://stackoverflow.com/comment/38966574
tagged with: java
tagged with: javafx
type: Question
has comment: http://stackoverflow.com/comment/38966615
has title: SortedList does not stay sorted after I change a field
score: 0
has comment: http://stackoverflow.com/comment/38969737
answer count: 1

http://stackoverflow.com/a/70410388
has body: mvn eclipse:eclipse But don't forget to change the directory to your maven project first (command cd) Then reboot Eclipse Than go to Eclipse Explorer - right click on your file with import errors - Source - organize imports (or Ctrl-Shift-O)
answers question: http://stackoverflow.com/q/24951746
score: 0
type: Answer

http://stackoverflow.com/q/24910066
has answer: http://stackoverflow.com/a/24949707
accepted answer: http://stackoverflow.com/a/24949707
answer count: 2
has comment: http://stackoverflow.com/comment/38775646
score: 0
has comment: http://stackoverflow.com/comment/38738635
tagged with: jpa-2.0
has title: GAE + JPA + Spring - not able to insert data into database (Mysql)
possible better answer: http://stackoverflow.com/a/24949556
tagged with: google-app-engine
has answer: http://stackoverflow.com/a/24949556
tagged with: spring-mvc
type: AnsweredQuestion
tagged with: java
has body: Hello friends it would be great if some can help me out with this. I am trying to build a web application on google app engine. I am not able to write data into database using jpa and there is no exception. I tried using flush bt it gives me exception as given below: javax.persistence.TransactionRequiredException: no transaction is in progress at org.hibernate.ejb.AbstractEntityManagerImpl.flush(AbstractEntityManagerImpl.java:301) 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 com.google.appengine.tools.development.agent.runtime.Runtime.invoke(Runtime.java:115) at org.springframework.orm.jpa.ExtendedEntityManagerCreator$ExtendedEntityManagerInvocationHandler.invoke(ExtendedEntityManagerCreator.java:365) at com.sun.proxy.$Proxy31.flush(Unknown Source) 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 com.google.appengine.tools.development.agent.runtime.Runtime.invoke(Runtime.java:115) at org.springframework.orm.jpa.SharedEntityManagerCreator$SharedEntityManagerInvocationHandler.invoke(SharedEntityManagerCreator.java:240) at com.sun.proxy.$Proxy31.flush(Unknown Source) at com.bullbeardevice.dao.impl.BaseDAOImpl.save(BaseDAOImpl.java:52) at com.bullbeardevice.service.impl.LoginServiceImpl.authenthicateUserLogin(LoginServiceImpl.java:70) at com.bullbeardevice.controller.common.LoginController.authenticateUserLogin(LoginController.java:35) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.Deleg…
type: Question
tagged with: spring-transactions

http://stackoverflow.com/q/24967154
answer count: 1
has answer: http://stackoverflow.com/a/24967166
favorite count: 0
score: -3
has title: I need this to write to a file named derp.txt but it creates or replaces the file, then writes to it
has body: Here is the code for the writing to file part: BufferedWriter write = new BufferedWriter(new FileWriter("derp.txt")); write.write("Tries: "+tries+" - Max: "+max); write.newLine(); write.flush();
accepted answer: http://stackoverflow.com/a/24967166
type: AnsweredQuestion
tagged with: java
downvote count: 3
type: Question
upvote count: 0

http://stackoverflow.com/comment/38709253
type: AnswerComment
type: Comment
has text: actually all the if statements are wrong too
comment on: http://stackoverflow.com/a/24914362
score: 1

http://stackoverflow.com/comment/38873866
comment on: http://stackoverflow.com/q/25001860
score: 0
type: Comment
type: QuestionComment
has text: The height of the tree is 5.

http://stackoverflow.com/comment/38955291
has text: It's in [source code](http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/6-b14/java/util/ArrayList.java#ArrayList.remove%28int%29)
type: Comment
comment on: http://stackoverflow.com/a/25044871
type: AnswerComment
score: 0

http://stackoverflow.com/comment/38845318
has text: Where's `pathto` defined? Is it static?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24985415

http://stackoverflow.com/a/24937360
answers question: http://stackoverflow.com/q/24920179
accepted answer of: http://stackoverflow.com/q/24920179
has body: Ill just map out what I did. First I downloaded eclipse and opened it with two workspaces (workspace1 and workspace2). Then, I opened eclipse with on of these two and went into preferences and changes Web Browser to the default editor for .html files. Then I opened a comparative program (something that opens up two folders/files and shows the side by side highlighting differences, I used Araxis Merge) and viewed the workspaces and saw that under workspace2\.metadata\.plugins\org.eclipse.core.runtime\.settings a new file had been made. (workspace.prefs) I opened the unedited and edited workspace.prefs file in the same comparative program and found a like was inserted. This line was: &lt;defaultEditor id\="org.eclipse.ui.browser.editorSupport"/&gt;\r\n. So having found that line, and where to insert it in the .prefs you can write code that will find the location where that line needs to be inserted. and insert it. It is honestly a painstacking process, but my father (I was doing this ask for him at work) wanted to write a piece of code that clients could simply run and have it edit their prefs. :) Hope this helps.
downvote count: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/139947847
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/40924209
score: 2

http://stackoverflow.com/q/24949600
linked to: http://stackoverflow.com/q/16190880
has comment: http://stackoverflow.com/comment/38777587
has comment: http://stackoverflow.com/comment/38776169
has answer: http://stackoverflow.com/a/24950027
has comment: http://stackoverflow.com/comment/38805464
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38776059
tagged with: maven
has title: Maven: error required library
has body: I am trying to reactivate a maven project but, when I am executing a JUnit test I am getting this error: Description Resource Path Location Type Archive for required library: 'C:/....m2/repository/org/eclipse/ui/workbench/3.3.0-I20070608-1100/workbench-3.3.0-I20070608-1100.jar' in project 'project-test' cannot be read or is not a valid ZIP file Build path Build Path Problem When I am checking the library I am finding the .jar file, just in case I re-downloaded it again but still I have the same error. I am a really beginner in Maven and this is my first try on it. First, I created an example with maven-archetype-quickstar , but I am receiving this error when I am trying to build the test Hello World example. My error is like this one described here but I can't remove it: Failed to load class "org.slf4j.impl.StaticLoggerBinder" error in java project? anyway, I can run alone the test .java class and it is executed successfully. So, now I am trying to use an existing project (that one that I mentioned here in the beginning) and first it is saying that I am missing the artifact org.eclipse.xtend, I created the dependency for it but I have located it's .jar file in a Reference Library but where should I locate it in order to be found (because still I have that error): > ArtifactTransferException: Failure to transfer org.eclipse.xtend:org.eclipse.xtend.standalone:jar:2.4.3 from 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. Original error: Could not transfer artifact org.eclipse.xtend:org.eclipse.xtend.standalone:jar:2.4.3 from/to central (http://repo.maven.apache.org/maven2): No response received after 60000 Fine, when I use the tag <path> it can find it but after that I am getting that Build Path error that I mentioned in the beginning :(
tagged with: java
tagged with: eclipse
type: Question
answer count: 1
score: 0

http://stackoverflow.com/a/25027975
accepted answer of: http://stackoverflow.com/q/25027911
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38949067
type: Answer
has body: Just looking over your code it doesn't seem like your open and close braces match up everywhere. I would step through all of them individually and make sure that the open braces match up with the correct close bracket. For example. At the end of the line you speak about: onStopTrackingTouch(SeekBar seekBar) { // TODO Auto-generated method stub } }); }} you haven't closed your onclicklistener for your "save" button with a corresponding }); and you also have }}, that is also bad formatting. Depending on your IDE (I know Android Studio and Eclipse do this) if you click on one brace it will show you where the corresponding close brace is. Other than that, nothing seems wrong with your code. EDIT: See below for the fixed version of your code: public class ProfileCreation extends Activity { private static final int RESULT_LOAD_IMAGE = 1; FrameLayout layout; Button save; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_profile_creation); save = (Button) findViewById(R.id.btnConfirm); String picturePath = PreferenceManager.getDefaultSharedPreferences(this).getString("picturePath", ""); if (!picturePath.equals("")) { ImageView imageView = (ImageView) findViewById(R.id.profilePicturePreview); imageView.setImageBitmap(BitmapFactory.decodeFile(picturePath)); } Button buttonLoadImage = (Button) findViewById(R.id.btnPictureSelect); buttonLoadImage.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View arg0) { Intent i = new Intent( Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI); startActivityForResult(i, RESULT_LOAD_IMAGE); } }); save.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View arg0) { // Locate the image in res &gt; Bitmap bitmap = BitmapFactory.decodeFile("picturePath"); // Convert it to byte ByteArrayOutputStream stream = new ByteArrayOutputStream(); // Compress image to lower quality scale 1 - 10…
answers question: http://stackoverflow.com/q/25027911
score: 0
has comment: http://stackoverflow.com/comment/38923572

http://stackoverflow.com/a/42567051
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/133388909
has body: Here is a Jackson Multi Date Format Serializer. import com.fasterxml.jackson.core.JsonParseException; import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.DeserializationContext; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.deser.std.StdDeserializer; import java.io.IOException; import java.text.ParseException; import java.text.SimpleDateFormat; import java.time.Instant; import java.util.Arrays; import java.util.stream.Collectors; /** * https://stackoverflow.com/a/42567051/11152683 */ public class MultiDateDeserializer extends StdDeserializer<Date> { private static final long serialVersionUID = 1L; private static final SimpleDateFormat[] DATE_FORMATTERS = new SimpleDateFormat[]{ new SimpleDateFormat("yyyy-MM-dd HH:mm:ss Z"), new SimpleDateFormat("yyyy-MM-dd HH:mm' UTC'") }; public MultiDateDeserializer() { this(null); } public MultiDateDeserializer(Class<?> vc) { super(vc); } @Override public Date deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException { JsonNode node = jp.getCodec().readTree(jp); final String date = node.textValue(); for (SimpleDateFormat formatter : DATE_FORMATTERS) { try { return formatter.parse(date); //.toInstant(); } catch (ParseException e) { } } throw new JsonParseException(jp, "Unparseable date: \"" + date + "\". Supported formats: " + Arrays.stream(DATE_FORMATTERS).map(SimpleDateFormat::toPattern).collect(Collectors.joining("; "))); } } You can use this simply by annotating a field as follows: @JsonProperty("date") @JsonDeserialize(using = MultiDateDeserializer.class) final Date date,
answers question: http://stackoverflow.com/q/24912992
has comment: http://stackoverflow.com/comment/130885971
has comment: http://stackoverflow.com/comment/129478618
score: 36
upvote count: 36

http://stackoverflow.com/a/25003581
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38878291
has comment: http://stackoverflow.com/comment/38878335
has comment: http://stackoverflow.com/comment/38877158
type: Answer
has comment: http://stackoverflow.com/comment/38877108
score: 2
has body: Nothing fancy. Just loop, and ignore exceptions: List&lt;Integer&gt; list = new ArrayList&lt;&gt;(); for (String num : "1 23 35 5d 8 0 f".split(" ")) { try { list.add(Integer.parseInt(num)); } catch (NumberFormatException e) {} } *Edit*: If invalid integers are common, you will get better performance using a manual check of the digits of each part: List&lt;Integer&gt; list = new ArrayList&lt;&gt;(); outer: for (String num : "1 23 35 5d 8 0 f".split(" ")) { for (int i = 0; i &lt; num.length(); i++) { char c = num.charAt(i); if (!((c &gt;= '0' &amp;&amp; c &lt;= '9') || c == '-' || c == '+')) continue outer; } try { list.add(Integer.parseInt(num)); } catch (NumberFormatException e) {} } This still has the try-catch in order to reject out of range integers or any that have minus/plus signs in inappropriate places, but you can remove that if you know those don't occur in your data, or if you'd prefer to throw the exception for those cases.
answers question: http://stackoverflow.com/q/25003550
upvote count: 3
downvote count: 1
accepted answer of: http://stackoverflow.com/q/25003550

barcode
tags question: http://stackoverflow.com/q/24948065
type: Tag
tag name: barcode

sockets
tags question: http://stackoverflow.com/q/24952043
tags question: http://stackoverflow.com/q/24943241
tags question: http://stackoverflow.com/q/25020351
tags question: http://stackoverflow.com/q/24963190
tags question: http://stackoverflow.com/q/24976181
tags question: http://stackoverflow.com/q/24953739
tags question: http://stackoverflow.com/q/24935038
tags question: http://stackoverflow.com/q/24994659
tags question: http://stackoverflow.com/q/24983596
tags question: http://stackoverflow.com/q/25046596
tags question: http://stackoverflow.com/q/24935243
tags question: http://stackoverflow.com/q/24992501
tags question: http://stackoverflow.com/q/24972005
tags question: http://stackoverflow.com/q/24979826
type: Tag
tags question: http://stackoverflow.com/q/24970208
tags question: http://stackoverflow.com/q/24982286
tags question: http://stackoverflow.com/q/24998849
tags question: http://stackoverflow.com/q/25031157
tags question: http://stackoverflow.com/q/24974537
tags question: http://stackoverflow.com/q/25014535
tags question: http://stackoverflow.com/q/25020660
tags question: http://stackoverflow.com/q/24950086
tags question: http://stackoverflow.com/q/24918977
tags question: http://stackoverflow.com/q/24918842
tags question: http://stackoverflow.com/q/25030128
tags question: http://stackoverflow.com/q/24982392
tags question: http://stackoverflow.com/q/25053642
tag name: sockets
tags question: http://stackoverflow.com/q/24973714
tags question: http://stackoverflow.com/q/25032926
tags question: http://stackoverflow.com/q/24926840
tags question: http://stackoverflow.com/q/24939969
tags question: http://stackoverflow.com/q/24965275
tags question: http://stackoverflow.com/q/24954234
tags question: http://stackoverflow.com/q/24985231
tags question: http://stackoverflow.com/q/24944171
tags question: http://stackoverflow.com/q/25032827
tags question: http://stackoverflow.com/q/24989609
tags question: http://stackoverflow.com/q/24979610
tags question: http://stackoverflow.com/q/24987944
tags question: http://stackoverflow.com/q/24981684

http://stackoverflow.com/a/25044096
type: Answer
score: 0
has body: The main reason for multi-level, single root hierarchy is --> while doing garbage collection, everything is treated as an object, so they are handled in a common way. The same applies when inserting / removing on some collections or synchronizing on threads. Object has just the basic methods and fields like wait(), notify(), hashCode(). Other classes, though they implicitly extend Object, provide their own set of methods and properties. So, you have to import them.
answers question: http://stackoverflow.com/q/25043947

http://stackoverflow.com/q/24917053
has answer: http://stackoverflow.com/a/31456627
has comment: http://stackoverflow.com/comment/38715014
upvote count: 51
accepted answer: http://stackoverflow.com/a/24917599
favorite count: 0
has comment: http://stackoverflow.com/comment/38714566
score: 51
has body: I want to be able to convert a List to a HashMap where the key is the elementName and the values is a list of something random (in this case its the Element Name). So in short I want (A-&gt;List(A), B-&gt;List(B), C-&gt; List(C)). I tried using toMap() and passing it the keyMapper and ValueMapper but I get a compilation error. I would really appreciate if someone can help me out. Thanks! public static void main(String[] args) { // TODO Auto-generated method stub List&lt;String&gt; list = Arrays.asList("A","B","C","D"); Map&lt;String, List&lt;String&gt;&gt; map = list.stream().map((element)-&gt;{ Map&lt;String, List&lt;String&gt;&gt; map = new HashMap&lt;&gt;(); map.put(element, Arrays.asList(element)); return map; }).collect(??); } Function&lt;Map&lt;String, String&gt;, String&gt; key = (map) -&gt; { return map.keySet().stream().findFirst().get(); }; Function&lt;Map&lt;String, String&gt;, String&gt; value = (map) -&gt; { return map.values().stream().findFirst().get(); }; === This worked for me Thanks for all the help guys! @izstas "they should operate on the elements" helped a lot :). Actually this is what I was looking for to be exact public static void test2 (){ Function&lt;Entry&lt;String, List&lt;String&gt;&gt;, String&gt; key = (entry) -&gt; { return entry.getKey(); }; Function&lt;Entry&lt;String, List&lt;String&gt;&gt;, List&lt;String&gt;&gt; value = (entry) -&gt; { return new ArrayList&lt;String&gt;(entry.getValue()); }; BinaryOperator&lt;List&lt;String&gt;&gt; merge = (old, latest)-&gt;{ old.addAll(latest); return old; }; Map&lt;String, List&lt;String&gt;&gt; map1 = new HashMap&lt;&gt;(); map1.put("A", Arrays.asList("A1", "A2")); map1.put("B", Arrays.asList("B1")); map1.put("D", Arrays.asList("D1")); Map&lt;String, List&lt;String&gt;&gt; map2 = new HashMap&lt;&gt;(); map2.put("C", Arrays.asList("C1","C2")); map2.put("D", Arrays.asList("D2")); Stream&lt;Map&lt;String, List&lt;String&gt;&gt;&gt; stream =Stream.of(map1, map2); System.out.println(stream.flatMap(…
has answer: http://stackoverflow.com/a/77858517
tagged with: java-8
answer count: 4
type: AnsweredQuestion
tagged with: list
tagged with: collectors
has answer: http://stackoverflow.com/a/24935686
tagged with: java
has comment: http://stackoverflow.com/comment/38715352
type: Question
tagged with: hashmap
downvote count: 0
possible better answer: http://stackoverflow.com/a/31456627
has title: collecting HashMap<String, List<String>> java 8
has answer: http://stackoverflow.com/a/24917599

http://stackoverflow.com/a/25008011
has body: You can use this regex for substitution: (-CD)?-[0-9]{4}-([a-zA-Z0-9]+)$ - http://regex101.com/r/vN2uH2/1 Considering all strings are ended with "-YEAR-NAME", which YEAR takes 4 numbers and NAME takes any one or more characters including numbers and may be prepended by "-CD". Here is something else that you could try: ^[^-]+(-[a-zA-Z]{1,3})?-[^-]+ - http://regex101.com/r/eL6jW2/1
has comment: http://stackoverflow.com/comment/38885338
downvote count: 2
type: Answer
answers question: http://stackoverflow.com/q/25007932
has comment: http://stackoverflow.com/comment/38885402
has comment: http://stackoverflow.com/comment/38885377
has comment: http://stackoverflow.com/comment/38885423
upvote count: 0
score: -2

http://stackoverflow.com/q/25064372
has title: How to get the absolute path of eclipse project to use in .bat file?
tagged with: project
tagged with: java
score: 0
tagged with: batch-file
has body: I want to get the absolute path of eclipse project to use in .bat file, but I have no idea. THis is my .bat file: @echo off D: cd **"D:\Workspaces4j\1st\web-parent\java-web"** mvn tomcat:redeploy pause Please help me...thanks very much.
answer count: 1
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25064645
tagged with: path
type: Question

http://stackoverflow.com/q/24944576
tagged with: java
tagged with: lwjgl
has body: What I want to do Picking an object. Requirements / Conditions My mouse is always in the center of the screen. Pick only the first / nearest object What I want to know How can I convert my mouse coordinates (actually 0,0 since the mouse is locked to the mid) to world coordinates? How do I get the actual view direction? What I think I have to do pseudo code int mx,my = convert(Mouse.getX()), convert(Mouse.getY()) int mz = ?? int dx, dy, dz = ?? # direction of view drawRay(mx, my, mz, dx, dy, dz + 10) # 10 shall be the range to pick # later check for intersections
tagged with: mouse-picking
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/38768595
tagged with: ray-picking
has title: How to convert mouse coordinates into world coordinates
favorite count: 0
type: UnansweredQuestion
answer count: 0
has comment: http://stackoverflow.com/comment/38772430
upvote count: 2
tagged with: opengl
score: 1

http://stackoverflow.com/comment/38859943
type: QuestionComment
comment on: http://stackoverflow.com/q/24991123
has text: I had duplicated context component-scan in the root-context file. Now it's working. Stupid mistake, thanks for help everyone.
score: 0
type: Comment

http://stackoverflow.com/comment/38784516
type: QuestionComment
score: 0
has text: Since it's a String hence you have to use `<form:option value="${status.value}"></form:option>` as per your exception. **I can't it as answer** due to some **Dwonvoter**.
comment on: http://stackoverflow.com/q/24954345
type: Comment

http://stackoverflow.com/comment/38956913
type: Comment
type: QuestionComment
has text: http://docs.jboss.org/hibernate/orm/3.5/reference/en-US/html/inheritance.html check this, as per the document you need to have 3 tables . see section 9.1.5
score: 0
comment on: http://stackoverflow.com/q/25044983

http://stackoverflow.com/q/25006216
type: Question
tagged with: libgdx
tagged with: java
has title: What does the values on Vector3 means?
downvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/25006555
has body: This chunk of code rotates a font 180 degrees: Matrix4 mx4Font = new Matrix4(); BitmapFont font; SpriteBatch spriteFont; font = new BitmapFont(Gdx.files.internal("data/font/agencyFB.fnt"); Gdx.files.internal("data/font/agencyFB.png"), true); //must be set true to be flipped mx4Font.setToRotation(new Vector3(200, 200, 0), 180); &lt;--------------------- spriteFont.setTransformMatrix(mx4Font); spriteFont.begin(); font.setColor(1.0f, 1.0f, 1.0f, 1.0f); font.draw(spriteFont, "The quick brown fox jumped over the lazy dog", 100, 110); spriteFont.end();` I know that is used to identify the axes, but if was just that we could use 0 or 1...
favorite count: 0
type: UnansweredQuestion
score: 1
upvote count: 1

http://stackoverflow.com/comment/38910289
has text: Chnge this line: Boolean myValue = SharedP.getBoolean("banner_pref", true); to this Boolean myValue = SharedP.getBoolean("isItFirstTime", true);
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25021116

http://stackoverflow.com/comment/38843919
score: 0
type: Comment
has text: @BWalsh Don't forget to accept the answer to remove the question off the unanswered list
comment on: http://stackoverflow.com/a/24985919
type: AnswerComment

wcf
tags question: http://stackoverflow.com/q/24913908
type: Tag
tag name: wcf
tags question: http://stackoverflow.com/q/24918974
tags question: http://stackoverflow.com/q/24969501

http://stackoverflow.com/comment/62045191
has text: I have the same problem. It seems data frames are returned as RExpGenericVectors, and that class doesn't have a string representation. The same happens with lists. list1 <- list(c(2,5,3),21.3,sin)
score: 0
comment on: http://stackoverflow.com/q/24926348
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38741909
type: Comment
comment on: http://stackoverflow.com/a/24931849
score: 0
type: AnswerComment
has text: By giving us full List Class, i guess he uses the std ctor

http://stackoverflow.com/q/25032018
type: Question
tagged with: endianness
has answer: http://stackoverflow.com/a/25032160
accepted answer: http://stackoverflow.com/a/25032160
tagged with: udp
upvote count: 1
answer count: 1
favorite count: 0
has title: What endianness has received packet in Java?
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
has body: I am working on a little UDP Java Server, which receives UDP Datagram Packets from a device that sends some kind of status messages. All multibyte numbers (e.g. field LEN: 3 bytes) are sent in little-endian. Since Java only works on big-endian, my question is the following: Are these numbers automatically converted to big-endian upon receival?

http://stackoverflow.com/q/25064959
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25065110
upvote count: 1
has body: In Java, is there a way to query what the current platform's dynamic library filename extension(s) are using only the JDK or javax libraries? For example, a defined system property? As a secondary alternative, is there a third-party Java library out there that does this? As a tertiary alternative, is the problem so trivial I can easily roll my own (eg .dll on Windows, .so everywhere else)?
has title: Get native dynamic library filename extension from Java
has comment: http://stackoverflow.com/comment/101722275
score: 1
tagged with: java
tagged with: cross-platform
type: Question
answer count: 2
tagged with: dll
downvote count: 0
tagged with: shared-libraries
tagged with: native-code
favorite count: 0
has answer: http://stackoverflow.com/a/30400008
has comment: http://stackoverflow.com/comment/38992837

http://stackoverflow.com/a/24990843
downvote count: 0
has comment: http://stackoverflow.com/comment/38853586
answers question: http://stackoverflow.com/q/24990778
has body: Geoid geo = new Geoid(); you should never use the new operator to instantiate an Activity, because the Activity follows its own life cycle and, getResources is available after the Activity's onStart is called, and onStart is called if you actually started your Activity through an Intent. If you need an Activity just for the sake of getResources add an additional parameter to the method's signature. A Context object, for instance
type: Answer
has comment: http://stackoverflow.com/comment/38853109
has comment: http://stackoverflow.com/comment/38853474
has comment: http://stackoverflow.com/comment/38853327
upvote count: 2
score: 2
accepted answer of: http://stackoverflow.com/q/24990778
has comment: http://stackoverflow.com/comment/38853156
has comment: http://stackoverflow.com/comment/38853282
type: AcceptedAnswer

http://stackoverflow.com/q/25029285
has comment: http://stackoverflow.com/comment/39002847
tagged with: eclipse
possible better answer: http://stackoverflow.com/a/25029717
answer count: 2
has comment: http://stackoverflow.com/comment/38925764
upvote count: 0
favorite count: 0
tagged with: android
has answer: http://stackoverflow.com/a/25070134
accepted answer: http://stackoverflow.com/a/25070134
has comment: http://stackoverflow.com/comment/38925847
has answer: http://stackoverflow.com/a/25029717
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38925650
downvote count: 2
has body: The mentor has asked that we create a simple app that allows user to enter amount of tickets and click to compute cost at a set rate of $18 for the two locations. We have been asked to outsource and research to complete the app MODIFICATION; so that tickets to (1)Cape Marie cost $20 and tickets to (2)Star Island cost $30. My code is below; public class MainActivity extends Activity { double costPerTicket=18.00; int numberOfTickets; double totalCost; String groupChoice; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); final EditText tickets=(EditText)findViewById(R.id.txtTickets); final Spinner group=(Spinner)findViewById(R.id.txtGroup); Button cost = (Button)findViewById(R.id.btnCost); cost.setOnClickListener(new OnClickListener() { final TextView result=((TextView)findViewById(R.id.txtResult)); @Override public void onClick(View v) { // TODO Auto-generated method stub numberOfTickets=Integer.parseInt(tickets.getText().toString()); totalCost=costPerTicket * numberOfTickets; DecimalFormat currency=new DecimalFormat("$###,###.##"); groupChoice=group.getSelectedItem().toString(); result.setText("Total cost for "+groupChoice +" is " +currency.format(totalCost)); } }); }
type: Question
score: -2
tagged with: java
has title: Eclipse Android Boot Camp- How to modify the Ferry app?

http://stackoverflow.com/a/24982903
accepted answer of: http://stackoverflow.com/q/24981623
type: Answer
has body: I was able to do it. Downloaded the source and added the following code. Bit rustic, but gets the work done. import com.google.zxing.NotFoundException; import com.google.zxing.ChecksumException; import com.google.zxing.FormatException; import com.google.zxing.BarcodeFormat; import com.google.zxing.DecodeHintType; import com.google.zxing.Reader; import com.google.zxing.BinaryBitmap; import com.google.zxing.Result; import com.google.zxing.LuminanceSource; import com.google.zxing.client.j2se.BufferedImageLuminanceSource; import com.google.zxing.common.HybridBinarizer; import java.awt.image.BufferedImage; import javax.imageio.ImageIO; import java.io.File; import java.io.IOException; import java.util.*; import com.google.zxing.qrcode.QRCodeReader; class qr { public static void main(String args[]) { Reader xReader = new QRCodeReader(); BufferedImage dest = null; try { dest = ImageIO.read(new File(args[0])); } catch(IOException e) { System.out.println("Cannot load input image"); } LuminanceSource source = new BufferedImageLuminanceSource(dest); BinaryBitmap bitmap = new BinaryBitmap(new HybridBinarizer(source)); Vector&lt;BarcodeFormat&gt; barcodeFormats = new Vector&lt;BarcodeFormat&gt;(); barcodeFormats.add(BarcodeFormat.QR_CODE); HashMap&lt;DecodeHintType, Object&gt; decodeHints = new HashMap&lt;DecodeHintType, Object&gt;(3); decodeHints.put(DecodeHintType.POSSIBLE_FORMATS, barcodeFormats); decodeHints.put(DecodeHintType.TRY_HARDER, Boolean.TRUE); Result result = null; try { result = xReader.decode(bitmap, decodeHints); System.out.println("Code Decoded"); String text = result.getText(); System.out.println(text); } catch(NotFoundException e) { System.out.println("Decoding Failed"); } catch(ChecksumException e) { System.out.println("Checksum error"); } catch(FormatException e) { System.out.println("Wrong format"); } } }
score: 1
upvote count: 1
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/24981623

http://stackoverflow.com/a/24949002
type: Answer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24948937
has comment: http://stackoverflow.com/comment/38775537
answers question: http://stackoverflow.com/q/24948937
score: 2
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38775490
has body: Because of this line you are getting error calculatorText.setText(res); change it into calculatorText.setText(""+res); You are setting Integer value..so View taken it as a Resouce ID.
upvote count: 2

http://stackoverflow.com/comment/38833626
has text: I have posted the method from my service class which is responsible for merging objects. Apart from this, it does persist, remove, find objects without any issues.
comment on: http://stackoverflow.com/a/24973976
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/38926999
has text: FYI: Added explanation. :)
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25030041

http://stackoverflow.com/comment/97573895
score: 5
type: AnswerComment
has text: This should be the correct answer because all the related `.proto` files need to run with the same command in order for the directories to be correct, if there are sub-directories of `.proto` files.
comment on: http://stackoverflow.com/a/54719678
type: Comment

http://stackoverflow.com/a/25031831
answers question: http://stackoverflow.com/q/25031746
score: -4
type: Answer
has body: This gives you the current logged in Username from your local Windows System System.getProperty("user.name");
downvote count: 4
upvote count: 0
has comment: http://stackoverflow.com/comment/38930167

http://stackoverflow.com/comment/46513804
has text: I've tried using both the default system User Agent as well as the custom user agent and I still receive the error message (system.err). I understand what it is, now I'm trying to make it go away... This doesn't solve the issue yet.
score: 0
comment on: http://stackoverflow.com/a/29143328
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/38707849
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24913554
has text: Where is that written in the question? I see no indication of it. The `main` method? As far as I can see, it's empty, so it's not a good clue.
type: AnswerComment

http://stackoverflow.com/a/24954469
upvote count: 2
type: Answer
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/38786784
has comment: http://stackoverflow.com/comment/38786539
has comment: http://stackoverflow.com/comment/38785209
has body: Adding to @peter's comment , "${status.value}" used inside the items attribute returns String . while items attribute inside option tag expects list . its is very clear from your exception . Check whether you are adding the items into the list in a proper manner. i guess you are overriding the same instance every time
answers question: http://stackoverflow.com/q/24954345

http://stackoverflow.com/comment/38772916
has text: You simply replace <welcome-file> content with your servlet name,here `restapi.TEST_Authenticate`!
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24947349

http://stackoverflow.com/comment/38722658
has text: @AndrewMedico: OMG, I didn't see it until Ondkloss's fix. Yeah, that is Not Cool. The code block should have got it past the question length, maybe that was a ninja edit and the OP didn't remove the rubbish. Yikes.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24914354

http://stackoverflow.com/q/24966611
has comment: http://stackoverflow.com/comment/38807784
upvote count: 4
has comment: http://stackoverflow.com/comment/38807666
type: AnsweredQuestion
tagged with: sql
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/24966667
has comment: http://stackoverflow.com/comment/38808685
type: Question
has comment: http://stackoverflow.com/comment/38807664
has body: I am executing a simple query on a small table SELECT * FROM SYSTEM System table only has three columns(Id, Name, Progress) and 1300 rows. My code for getting the data is: try { Class.forName("com.mysql.jdbc.Driver").newInstance(); conn = (Connection) DriverManager.getConnection( "jdbc:mysql://192.168.0.107:3306/my_database", username.getText(), password.getText()); String query = "select * from system"; stmt = (Statement) conn.createStatement(); rs = (ResultSet) stmt.executeQuery(query); while (rs.next()) { tableModel.addRow(new Object[] { rs.getInt("Number"), rs.getString("Name"), rs.getFloat("Progress") }); } } catch (Exception e) { // some other code }` This code takes around 15 seconds to display the date in my JTable, while if I execute the query in phpmyadmin it takes less than one second.
tagged with: jdbc
accepted answer: http://stackoverflow.com/a/24966667
score: 4
has answer: http://stackoverflow.com/a/34900597
tagged with: java
answer count: 2
has title: MySQL Query result is very slow
tagged with: mysql
has comment: http://stackoverflow.com/comment/38811135
possible better answer: http://stackoverflow.com/a/34900597
has comment: http://stackoverflow.com/comment/38807692

http://stackoverflow.com/a/25024142
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/25023981
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/25023981
has body: Here's a simple example using the Document Object Model to traverse the XML file: DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder(); Document document = documentBuilder.parse(new File("input.xml")); NodeList bNodes = document.getElementsByTagName("B"); for(int i = 0; i &lt; bNodes.getLength(); i++) { Element bElement = (Element) bNodes.item(i); NodeList cNodes = bElement.getElementsByTagName("C"); // ... }
type: AcceptedAnswer

http://stackoverflow.com/comment/38966929
type: Comment
has text: @VD' Yes you are right, I 50% misunderstood the question. the [Line of Interest] is executing in the main thread (Single Thread). that is always in a sequence.
type: QuestionComment
comment on: http://stackoverflow.com/q/25051031
score: 0

http://stackoverflow.com/comment/38853844
comment on: http://stackoverflow.com/q/24991258
score: 0
has text: Why not: `private EditText edtPhoneNumber;` too much `.NET` style?
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38902288
has text: Upload task performing in AsyncTask, when I cancelling AT it will cancelled but upload file not stop after upload it will called onCancel() and onCancel(String s) methods
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25012887

http://stackoverflow.com/q/24938327
has comment: http://stackoverflow.com/comment/38754402
type: Question
tagged with: exception
has comment: http://stackoverflow.com/comment/38754781
favorite count: 0
has answer: http://stackoverflow.com/a/24938933
has answer: http://stackoverflow.com/a/24938816
score: 0
answer count: 3
upvote count: 1
has title: How do I throw and catch exceptions in Java?
downvote count: 1
has comment: http://stackoverflow.com/comment/38754435
tagged with: java
has body: I am trying to learn exception handling for basic java programs. I read online and in a text book, and even practised the exercise my book gave me, yet I still don't have a good grasp of it. I was hoping I could post my code below and see if anyone could tell me a better way to handle exceptions, or if I was even doing it properly. public class labBookFortyTwo { public static void main(String[] args) { int size = 0; Scanner myInput = new Scanner(System.in); System.out.println("Please enter the amount of grades there are "); size = myInput.nextInt(); double grade = 0; double[] myArray = new double[size]; TestScoresTwo myScore = new TestScoresTwo(myArray, size); for (int count = 0; count &lt; myArray.length; count++) { System.out.println("enter grade "); grade = myInput.nextDouble(); myArray[count] = grade; System.out.println("you entered " + myArray[count]); } double avg = myScore.avgGrade(); System.out.println("avg is \t " + avg); } } Here is my class: public class TestScoresTwo { int size = 0; double[] tScore = new double[size]; double sum = 0; public TestScoresTwo(double[] scores, int sizE) { // double[] tScore = scores; //this line messed me up // the below line works tScore = scores; size = sizE; } public double avgGrade() { try { for (int otherCount = 0; otherCount &lt; size; otherCount++) { if (tScore[otherCount] &lt; 0 || tScore[otherCount] &gt; 100) { throw new IllegalArgumentException("At the " + (otherCount + 1) + " position " + tScore[otherCount] + " is a wrong input "); } } for (int count = 0; count &lt; tScore.length; count++) { sum = tScore[count] + sum; } } catch (IllegalArgumentException e) { System.out.println(e.getMessage()); } double avg = sum / size; return avg; } }
has answer: http://stackoverflow.com/a/24938634
type: UnansweredQuestion

http://stackoverflow.com/comment/38961331
comment on: http://stackoverflow.com/q/25048025
score: 0
type: Comment
type: QuestionComment
has text: Because of the recursive nature I think it's also just as valid to build up a list of valid strings of length 1, length 2, and so on.

http://stackoverflow.com/q/25022936
has comment: http://stackoverflow.com/comment/38914074
type: UnansweredQuestion
has body: I'm currently working on a java project in eclipse that uses 64-bit SWT libraries. A lot of the computers this program might be used on have 32 bit operating systems, so to avoid making a 32-bit and a 64-bit version, I want to explore dynamically loading a 32-bit or 64-bit SWT library depending on the JRE being used at the time. I found some references to using ClassLoader, ServiceLoader, and similar objects, however I'm not sure how that would fit in with eclipse's structure, and if eclipse's structure even allows for this type of loading in the first place. Additionally, I am unsure how to check which jvm is being used inside the code, which I assume would be a prerequisite for knowing which SWT libraries would load correctly. If you guys would be able to provide any suggestions or directions in which to focus my research, that would be great. I'm currently pretty unsure on how to proceed. Thanks!
tagged with: 32bit-64bit
tagged with: swt
tagged with: dynamic-loading
type: Question
has answer: http://stackoverflow.com/a/25023241
has comment: http://stackoverflow.com/comment/38914050
has title: Dynamically Loading Libraries in Eclipse
tagged with: java
has comment: http://stackoverflow.com/comment/38914146
tagged with: eclipse
score: 0
answer count: 1
linked to: http://stackoverflow.com/q/2706222

http://stackoverflow.com/comment/38740615
type: AnswerComment
has text: Thanks for your reply... I think you spotted the problem thats fine with `if` part your answer works.. but when it comes to `else if` part if any of the value is not equal (`suppose b value is not equal and remianing two are equal`) then I need the control to go to `my code 2` what should be the logic here? thanks again
comment on: http://stackoverflow.com/a/24931157
type: Comment
score: 0

http://stackoverflow.com/q/24989446
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/761194
tagged with: oop
tagged with: java
has answer: http://stackoverflow.com/a/24989544
has answer: http://stackoverflow.com/a/24989503
type: Question
tagged with: inheritance
has answer: http://stackoverflow.com/a/24989483
favorite count: 0
tagged with: abstract-class
possible better answer: http://stackoverflow.com/a/24989501
accepted answer: http://stackoverflow.com/a/24989503
has answer: http://stackoverflow.com/a/24989501
has title: Purpose of having super class as an abstract class in Java
score: -1
has answer: http://stackoverflow.com/a/24989639
answer count: 5
has body: Super class being an abstract class creates an overhead for all its sub classes to compulsorily define its abstract methods. I understand that it's very basic but I need to know why do programmers usually make super class as an abstract class, though we can do similar things using a super class as a non abstract class.
downvote count: 2
upvote count: 1
tagged with: superclass

http://stackoverflow.com/q/25056342
has body: I have two xml layout files, first one is a simply relative layout with other 7 relative layouts acting as columns and 7 views acting as separators. Each of column layout is using linear layout with multiple views that's placed in separate xml file as background. Here are layouts: Container: <View android:layout_width="0.5dp" android:layout_height="match_parent" android:layout_weight="0" android:background="@color/Gray"/> <include layout="@layout/day_background" /> <View android:layout_width="0.5dp" android:layout_height="match_parent" android:layout_weight="0" android:background="@color/Gray"/> <include layout="@layout/day_background" /> Background layout: <View android:layout_width="fill_parent" android:layout_height="0.5dp" android:layout_marginTop="0dp" android:background="@color/Gray" /> <View android:layout_width="fill_parent" android:layout_height="0.5dp" android:layout_marginTop="59dp" android:background="@color/Gray" /> I shortened both of them because they would be to long, so that's why there are just two columns. I also don't have idea why is the editor cutting tag in the end so I had to put it this way. I'm trying to modify that background layout width in container code but the problem's that's only first column background is getting changed, the rest stays with 52dp no mather what I do. I'm modyfing layout width using this: LinearLayout dayBackground = (LinearLayout) findViewById(R.id.day_background); dayBackground.getLayoutParams().width = SystemHelper.getDayColumnWidth(); dayBackground.requestLayout(); Here's is the screen from emulator, that's how it does look like: Emulator screen What could be the problem?
possible better answer: http://stackoverflow.com/a/25058591
has answer: http://stackoverflow.com/a/25058591
has comment: http://stackoverflow.com/comment/38977345
tagged with: android
accepted answer: http://stackoverflow.com/a/25104920
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
tagged with: java
type: Question
has title: How does one modify layout that's used multiple times programmaticaly?
tagged with: layout
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/25104920

http://stackoverflow.com/q/24946004
type: UnansweredQuestion
has title: Linkedlist recursive method
tagged with: recursion
has comment: http://stackoverflow.com/comment/38769632
tagged with: linked-list
has comment: http://stackoverflow.com/comment/38770372
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/24946108
has body: I'm trying to write a recursive method that prints a linked list in reverse but I get a stackoverflow error. The method should terminate when the last element of the array has been reached, and return control to the method that called it, and then that method will print and return to the one that called it and so forth. public void print(Node node){ if(node.next != null) print(node.next); System.out.println(" " + node.value + " "); }
linked to: http://stackoverflow.com/q/1565388
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/38769314
has comment: http://stackoverflow.com/comment/38770138
has comment: http://stackoverflow.com/comment/38770405
tagged with: stack-overflow
has comment: http://stackoverflow.com/comment/38770479

http://stackoverflow.com/a/24999037
has comment: http://stackoverflow.com/comment/38868626
downvote count: 1
has comment: http://stackoverflow.com/comment/38868894
score: 2
has body: IF there is a mechanism to check type of argument like if type(argument) == String , I will use generic method. If I understand you, then yes - there is instanceof. public static &lt;T&gt; void myMethod(T obj) { // &lt;-- generic type T if (obj instanceof String) { System.out.println("Printing String directly: " + (String) obj); } else { System.out.println("Printin String by toString(): " + obj.toString()); } } public static void main(String[] args) { myMethod("Hello"); myMethod(new Date()); } Per the Java Tutorial link, The instanceof operator compares an object to a specified type. You can use it to test if an object is an instance of a class, an instance of a subclass, or an instance of a class that implements a particular interface. You don't really need generics here, so you might implement myMethod() like public static void myMethod(Object obj) { // Any Object if (obj instanceof String) { System.out.println("Printing String directly: " + (String) obj); } else { System.out.println("Printin String by toString(): " + obj.toString()); } } Finally, all of this distracts from the problem at hand - you should probably just use function overloading as in this answer from laune.
has comment: http://stackoverflow.com/comment/38987716
has comment: http://stackoverflow.com/comment/38868600
has comment: http://stackoverflow.com/comment/38868786
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24998832
accepted answer of: http://stackoverflow.com/q/24998832
type: Answer
has comment: http://stackoverflow.com/comment/38869008
has comment: http://stackoverflow.com/comment/38869088
upvote count: 3

http://stackoverflow.com/a/25061021
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/25059964
downvote count: 0
type: Answer
has body: For good order: using the Java Unicode support. int countCyrillic(String s) { int n = 0; for (int i = 0; i &lt; s.length(); ) { int codePoint = s.codePointAt(i); i += Character.charCount(codePoint); if (UnicodeScript.of(codePoint) == UnicodeScript.CYRILLIC) { ++n; } } return n; } This uses the full Unicode (where two 16 bit chars may represent a Unicode "code point." And in Java the class Character.UnicodeScript has already everything you need. Or: int n = s.replaceAll("\\P{CYRILLIC}", "").length(); Here \\P is the negative of \\p{CYRILLIC} the Cyrillic group.

http://stackoverflow.com/q/25032814
type: Question
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25034830
score: 1
tagged with: java
has title: How to remove the soap headers and additional tags to retrieve the desired xml?
linked to: http://stackoverflow.com/q/8979851
answer count: 1
downvote count: 0
has body: This is the xml i have in the string format. <?xml version='1.0' encoding='UTF-8'?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"> <soapenv:Body> <ns:processRequestResponse xmlns:ns="http://service.soap.oneflexi.com"><ns:return> <?xml version="1.0" encoding="UTF-8"?> <CategoryCode /> <CategoryDescription /> 356 20% offer, Latest model <Quantity /> 24560 http://goo.gl/klCGG4 Front Loading Washing Machine 6.5Kg Capacity 6 Motion Direct Drive <ErrorCode /> <ErrorMessage /> 2499 <MID /> </ns:return> </ns:processRequestResponse> </soapenv:Body> </soapenv:Envelope> and the output i need should be subset of the above xml removing the soap headers and other tags. How can i achieve this output in java? <CategoryCode /> <CategoryDescription /> 356 20% offer, Latest model <Quantity /> 24560 http://goo.gl/klCGG4 Front Loading Washing Machine 6.5Kg Capacity 6 Motion Direct Drive <ErrorCode /> <ErrorMessage /> 2499 <MID /> Please any help would be appreciated and Thanks in advance. I have tried using the example given in this thread : [1]:Java How to extract a complete XML block. Here is the java code public static void main(String... args) throws Exception { // String xml = " 0 1 "; String xml = "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:ser=\"http://service.soap.oneflexi.com\"><soapenv:Header/><soapenv:Body><ser:processRequest><ser:in0> 20140614 <Time>162944 GMT+06:00 5320 9005001 5.0.1 2003001 2004002 <StanNo/><LastTxnRefNo/><OTP/> <OfferMerchant/> Y 1234 VC01 </ser:in0><ser:in4>?</ser:in4></ser:processRequest></soapenv:Body></soapenv:Envelope>"; DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); Document doc = dbf.newDocumentBuilder().parse(new InputSource(new StringReader(xml))); XPath xPath = XPathFactory.newInstance().newXPath(); Node result = (Node)xPath.evaluate(" Soapenv:Envelope/Soapenv:Body/ns:processRequestResponse/ns:return/BconRs[language=\"SG\"]", doc, XPathConstants.NODE); // N…
has comment: http://stackoverflow.com/comment/38931985
favorite count: 0
has answer: http://stackoverflow.com/a/25034830
tagged with: soap
tagged with: http://stackoverflow.com/tag/xml
tagged with: xpath
has comment: http://stackoverflow.com/comment/38931979
has comment: http://stackoverflow.com/comment/38932423
upvote count: 1

http://stackoverflow.com/comment/38972179
type: Comment
score: 0
type: AnswerComment
has text: Works for me, although it's very easy to introduce an error. Make sure to have a set of files you can compile using xjc from the command line. Or add an error listener to the SchemaCompiler.
comment on: http://stackoverflow.com/a/24984518

http://stackoverflow.com/comment/38815924
comment on: http://stackoverflow.com/a/24970928
score: 0
type: AnswerComment
has text: I have the mysql-connector-java-5.1.25 in Libraries folder in my JavaWeb project. :|
type: Comment

http://stackoverflow.com/comment/38978306
has text: why u r using `'convert'` within `' '`? it is name of variable. just write `int ascii = (convert/1);`
comment on: http://stackoverflow.com/q/25057365
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24922294
tagged with: spring-mvc
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38735979
has body: I have a Spring MVC webapp using Hibernate, and my problem is that em.merge doesn't respond after the call. Here is my Controller @RequestMapping(value = "/updDep", method = RequestMethod.PUT) @ResponseBody public String updDeps(@RequestBody Department department ) { departmentService.addDepartment(department); System.out.println("after merge; in controller"); return "Success"; } And Department Service class with addDepartment() method: @Repository public class DepartmentServiceImpl implements DepartmentService { @PersistenceContext(unitName = "MyPersistenceUnit") private EntityManager entityManager; .... //getter/setter entityManager.... ... @Override @Transactional public void addDepartment(Department department) { System.out.println(department.getName() + " merge: " + department.getId()); getEntityManager().merge(department); getEntityManager().flush(); System.out.println("after"); } So i try to explain problem: After addDepartment(Department department) method is called from my Controllers updDeps(..) method. I see this in my servers log: SECURITY23 merge: 3 Hibernate: select department0_.id as department0_.name a from departments departm where department0_.id=? Hibernate: update departments set name=? where id=? And that's all! Why did System.out.println("after"); and System.out.println("after merge; in controller"); not execute? After em.merge was called nothing happened. And data in MySQL table still not updated. But if I add department.setId(null); before, like that @Transactional public void addDepartment(Department department) { department.setId(null); System.out.println(department.getName() + " merge: " + department.getId()); getEntityManager().merge(department); getEntityManager().flush(); System.out.println("after"); } All works and it created new instance in db, but I want update current. What's the problem? UPDATE 1 Project Structure: PERSISTENCE.XML org.hibernate.ejb.HibernatePersistence </persistence> SPRING CONFIG <mvc:annotation-driven /> <context…
tagged with: java
tagged with: hibernate
type: Question
has answer: http://stackoverflow.com/a/24949609
has comment: http://stackoverflow.com/comment/38747980
has answer: http://stackoverflow.com/a/66047823
has comment: http://stackoverflow.com/comment/38746351
has comment: http://stackoverflow.com/comment/38743956
downvote count: 0
has comment: http://stackoverflow.com/comment/38740546
has comment: http://stackoverflow.com/comment/38765221
answer count: 4
accepted answer: http://stackoverflow.com/a/24949609
favorite count: 0
upvote count: 2
has answer: http://stackoverflow.com/a/24941742
has title: Hibernate EntityManager.merge() does not update database
linked to: http://stackoverflow.com/q/18380595
possible better answer: http://stackoverflow.com/a/35219121
tagged with: spring
has comment: http://stackoverflow.com/comment/38731176
has answer: http://stackoverflow.com/a/35219121

http://stackoverflow.com/q/24954266
linked to: http://stackoverflow.com/q/156503
has answer: http://stackoverflow.com/a/24956943
tagged with: exception
has body: I am trying to write some JUnits for my application, I believe I have got around 80% code coverage, but when i run the tests my report looks as follows; This is giving me a code coverage result of 52% which is not idea. Is there an alternative way to write the methods in which an exception is expected so as to maintain my coverage score? Thanks
type: AnsweredQuestion
tagged with: code-coverage
tagged with: java
has comment: http://stackoverflow.com/comment/38785234
downvote count: 1
has answer: http://stackoverflow.com/a/24958299
type: Question
score: 3
has comment: http://stackoverflow.com/comment/38784628
has title: How to Junit test and expect an exception whilst maintaining code coverage
upvote count: 4
answer count: 2
tagged with: junit
accepted answer: http://stackoverflow.com/a/24958299
has comment: http://stackoverflow.com/comment/38788460
has comment: http://stackoverflow.com/comment/38788584
possible better answer: http://stackoverflow.com/a/24956943
favorite count: 0

http://stackoverflow.com/q/24977328
has body: I am trying to create an outline of what a character is in a game. Then I want to create 10 different characters and compare their stats at different levels. I am creating a class called Character that looks like this, public class Character { String primaryAtribute; double strength; double agility; double inteligence; double armor; double damageMultiplyer; int health; int mana; int range; int movement; int level; int damageMin; int damageMax; public Character() { } //constructor ends private static int randomInt(int min, int max) { return min + (int)(Math.random() * (max - min + 1)); } int damageRange = randomInt(damageMin, damageMax); double damage = damageRange + level * damageMultiplyer; } //class ends Then I am creating each character like this, public class FirstCharacter { String primaryAtribute = "Agility"; int level = 0; double strength = 17 + level * 1.9; double agility = 26 + level * 1.9; double inteligence = 15 + level * 1.4; double armor = 0.64; double damageMultiplyer = 1.9; int health = 473; int mana = 195; int range = 625; int movement = 300; int damageMin = 44; int damageMax = 55; } Am I on the right path here? Once I create each character's class how would I go about setting which ever one I may pick to the Character class?
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38827648
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/38827663
has comment: http://stackoverflow.com/comment/38827716
has comment: http://stackoverflow.com/comment/38827661
has comment: http://stackoverflow.com/comment/38827676
type: Question
has comment: http://stackoverflow.com/comment/38827753
possible better answer: http://stackoverflow.com/a/24977517
downvote count: 2
has answer: http://stackoverflow.com/a/24977517
has title: Structuring Class Objects And Defining The Variables
has comment: http://stackoverflow.com/comment/38827658
has comment: http://stackoverflow.com/comment/38827640
upvote count: 3
has comment: http://stackoverflow.com/comment/38827731
accepted answer: http://stackoverflow.com/a/24977451
answer count: 3
has comment: http://stackoverflow.com/comment/38827692
has answer: http://stackoverflow.com/a/24977533
favorite count: 0
has answer: http://stackoverflow.com/a/24977451
has comment: http://stackoverflow.com/comment/38827642
has comment: http://stackoverflow.com/comment/38827733

http://stackoverflow.com/comment/38865522
has text: This does not deserve upvotes. It does not explain what continue does. Showing the flow of exexution is not an answer
type: Comment
comment on: http://stackoverflow.com/a/24996969
score: 6
type: AnswerComment

http://stackoverflow.com/comment/38950600
comment on: http://stackoverflow.com/q/25041843
has text: @Ro Siv, might be off topic, but you might also want to try giving the variable and methods in the Areas class meaningful names so it would be more understandable. Like getArea for methods.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24913696
favorite count: 0
has comment: http://stackoverflow.com/comment/38707990
has body: That's my activity, where I want to send a Post request with data JSON formatted. public class OrderActivity extends Activity { List&lt;Piatto&gt; ordine = new ArrayList&lt;Piatto&gt;(); Context context; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.order_layout); TextView disptext = (TextView) findViewById(R.id.dispid); ordine = getIntent().getParcelableArrayListExtra("ordinelist"); context = getApplicationContext(); String json = ""; Integer contatore = 0; for (Integer i = 0; i &lt; ordine.size(); i++) { if (ordine.get(i) != null){ if (contatore &gt; 0){ json = json+", "; } json = json+ordine.get(i).getJSON(); } } disptext.setText(json); POST("http://some.altervista.org/order.php", json); } public static String POST(String url, String json){ InputStream inputStream = null; String result = ""; try { // 1. create HttpClient HttpClient httpclient = new DefaultHttpClient(); // 2. make POST request to the given URL HttpPost httpPost = new HttpPost(url); // 5. set json to StringEntity StringEntity se = new StringEntity(json); // 6. set httpPost Entity httpPost.setEntity(se); // 7. Set some headers to inform server about the type of the content httpPost.setHeader("Accept", "application/json"); httpPost.setHeader("Content-type", "application/json"); // 8. Execute POST request to the given URL HttpResponse httpResponse = httpclient.execute(httpPost); } catch (Exception e) { Log.d("InputStream", e.getLocalizedMessage()); } // 11. return result return result; } } Then, this is the error I receive 07-23 16:09:21.450: E/AndroidRuntime(5806): FATAL EXCEPTION: main 07-23 16:09:21.450: E/AndroidRuntime(5806): java.lang.RuntimeException: Unable to start activity ComponentInfo{it.sii.mywaiter/it.sii.mywaiter.OrderActivity}: java.lang.NullPointerException: println needs a message 07-23 16:09:21.450: E/AndroidRuntime(5806): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2092) 07-23 16:0…
upvote count: 1
has answer: http://stackoverflow.com/a/24913807
downvote count: 1
type: AnsweredQuestion
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has title: HTTP Post with Android - "println needs a message" error
type: Question
accepted answer: http://stackoverflow.com/a/24913807
answer count: 1
linked to: http://stackoverflow.com/q/6018633
score: 0
tagged with: http-post
duplicate of: http://stackoverflow.com/q/6018633
tagged with: android

http://stackoverflow.com/q/24987616
accepted answer: http://stackoverflow.com/a/24988228
possible better answer: http://stackoverflow.com/a/24996911
has answer: http://stackoverflow.com/a/24996911
answer count: 2
tagged with: akka
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/24988228
has title: Convert Akka Iterable to java.lang.Iterable?
has body: I would like to iterate over the children of a given Actor in a for-each loop, like so: for(ActorRef child: this.getContext().children()){ // do things } This yields an error though: HelloWorld.java:78: error: for-each not applicable to expression type for(ActorRef child: this.getContext().children()) ^ required: array or java.lang.Iterable found: Iterable&lt;ActorRef&gt; 1 error The docs for UntypedActorContext say that the children() method should return an 'Iterable[ActorRef]', but the inline-hyperlink for the type definition for that particular 'Iterable' leads to the docs for the Scala Iterable-type rather than the Java type, which are not the same thing. This can be confirmed in practice: the object returned from the children() call fails an "instanceOf Iterable" check, and calling "getClass()" on it returns "class akka.actor.dungeon.ChildrenContainer$ChildrenIterable". It seems pretty clear to me that this is not a Java Iterable and that the error is appropriate. But how do I coerce or marshall it into a Java Iterable? This link in the Scala docs suggests that there are conversion functions for Scala->Java, but I cannot make heads or tails of what to import or how to call them from Java; the only examples I've seen have been for Scala. P.S. I realize I can probably use a while-loop and the Scala-Iterator returned by children().iterator() to construct the equivalent of a for-each loop here. What I'm really after is understanding how to use the type-conversion routines that Scala provides.
type: AnsweredQuestion
score: 1
tagged with: scala
tagged with: java
upvote count: 1
type: Question

http://stackoverflow.com/comment/38754874
type: QuestionComment
comment on: http://stackoverflow.com/q/24938461
type: Comment
has text: I have a button which calls the function with specific key name.
score: 0

http://stackoverflow.com/comment/38988053
type: Comment
score: 1
has text: The arguments that come into `main` in the `args` array are already separate strings, not one string delimited by spaces, so this is really not relevant to what the OP is trying to accomplish.
type: AnswerComment
comment on: http://stackoverflow.com/a/25061982

http://stackoverflow.com/q/24923418
tagged with: jackson
score: 0
tagged with: rest
has title: Spring REST - add Entity to DB from JSON input - DB foreign key error
tagged with: spring
has answer: http://stackoverflow.com/a/24926953
type: AnsweredQuestion
tagged with: java
tagged with: http://stackoverflow.com/tag/json
accepted answer: http://stackoverflow.com/a/24926953
has body: I have two entities: A and B: In controller class I have these methods: @RequestMapping(value="/json/get", method=RequestMethod.GET) public @ResponseBody List&lt;B&gt; getAll() { return BManager.findAll(); } @RequestMapping(value="/json/add", method=RequestMethod.POST) public @ResponseBody void addB(@RequestBody B b) { B.setA(AManager.findByAddress(123456)); // I must be from JSON, not static! BManager.save(b); } URL /json/get return to me: { "value":1, "title":"hello" } there is no value for A. But it is ok. Problem is when I want to create new B entity from JSON input. I send curl -X POST -H "Content-Type: application/json" -H "Accept: application/json" -d '{"value":2,"title":"world"}' http://localhost:8080/test/json/add If I have in method addB line B.setA(AManager.findByAddress(123456)); it save entity to db. But I need to specify address in input JSON like this (I can change json syntax): curl -X POST -H "Content-Type: application/json" -H "Accept: application/json" -d '{"address":123456,"value":2,"title":"world"}' http://localhost:8080/test/json/add it crash with: SEVERE: Servlet.service() for servlet [spring] in context with path [/test] threw exception [Request processing failed; nested exception is org.springframework.dao.DataIntegrityViolationException: could not execute statement; SQL [n/a]; constraint [null]; nested exception is org.hibernate.exception.ConstraintViolationException: could not execute statement] with root cause com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Column 'A_id' cannot be null Questions: 1) How can I specify address (class A) from B in input JSON? 2) If I want address (from class A) in output JSON (class B) from method getAll how can I do it? I would like to get /json/get: { "addrress":123456, "value":1, "title":"hello" }
type: Question
answer count: 1

http://stackoverflow.com/a/24960427
has body: I assume the "/r" is to add a new line? That won't actually work and will instead add a string literal "/r" to whatever other string you're adding it to. You also don't need to do that because Talend will automatically start a new line at the end of the row of data for your tFileOutputDelimited. But more importantly, you're attempting to call the divide method on a string which obviously doesn't exist (how would it be defined?). You need to first parse the string as a numeric type (such as float/double/Big Decimal) and then divide by another numeric type (your Var1 is defined as a string in your example, so will actually fail there too because a string must be contained in quotes). So typically you would either define the schema column that you are dividing as a numeric type (as mentioned) or you'd attempt to parse the string into a float in the tMap/tJavaRow component. If you have your prices defined as something like a double before your tMap/tJavaRow operation that divides then you can use: row1.prix2 / Var.var1 Or to round it to two decimal places: (double)Math.round((row1.prix2 / Var.var1) * 100) / 100 You can also use a tConvertType component to explicitly convert between types where available. Alternatively you could parse the string as a double using: Double.parseDouble(row1.prix2) And then proceed to use that as previously described. In your case though (according to your comment on Gabriele's answer), there is a further issue in that Java (and most programming languages) expect numbers to be formatted with a . for the decimal point. You need to add a pre-processing step to be able to parse your string as a double. As this question's answers show, there are a couple of options. You can use a regex processing step to change all of your commas in that field to periods or you can use a tJavaRow to set your locale to French as you parse the double like so: NumberFormat format = NumberFormat.getInstance(Locale.FRENCH); Number number = format.parse(input_row.prix…
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/24957396
has comment: http://stackoverflow.com/comment/38811901
answers question: http://stackoverflow.com/q/24957396

http://stackoverflow.com/a/25055760
score: 1
has comment: http://stackoverflow.com/comment/38975450
upvote count: 1
has body: I'm reading your question as: "Who actually allocates memory for an object - the new keyword or the constructor?" If that's the case, the answer is the new keyword. Constructors are typically chained, meaning that at least two constructors will run when you're creating an instance. On the other hand, memory for an instance is allocated only once. Also, the type of allocation is determined using analysis of the usage of the produced reference (escape analysis, for example). This means that the most obvious place for the allocation to happen is at the constructor call site (that is, the place of the new expression). The size of the memory allocated is such that it can accomodate an instance of the type following the new keyword. That latter size (the size of an instance of a type) is the aggregate size of the primitive types (int, float, double, etc) it consists of, plus the aggregate size of the references to the reference types (class or interface instances) it consists of, plus "secret" stuff embedded in instances so that Java features can work (like a virtual table pointer, to allow fast runtime resolution of virtual method calls) plus possible padding between each of those (to align the various types to their optimal address number multiples in memory). In any case, when you do T obj1 = new T(), where T is the name of a class: Memory is allocated somewhere to accomodate a T instance. The instance is constructed. If the instance is successfully constructed, a reference to the instance is returned. That reference is stored in the obj1 variable. When you do R obj2 = new R(), a similar thing happens for the type R, and type R may have a different size than T. But neither of these local variables contains the instance. They both contain a reference to their assigned object. (Thus, the variables themselves might even be of the same size, if all they have to do is store a memory address.)
has comment: http://stackoverflow.com/comment/38975476
answers question: http://stackoverflow.com/q/25055375
downvote count: 0
has comment: http://stackoverflow.com/comment/38975808
type: Answer
has comment: http://stackoverflow.com/comment/38975591

http://stackoverflow.com/a/25054372
has comment: http://stackoverflow.com/comment/38973010
score: 0
has comment: http://stackoverflow.com/comment/38972955
has body: When you overload a method, you allow the method to be invoked through different signature.. For example add(int a, int b); add(int a, int b, int c); add(int a, int b, int c, int d); As you see here, all the three overloads are having different signatures.. However, when you over-ride a method, You must have the same signature as the method you are trying to override.. Hence overloading requires same name whereas over-riding requires same signature, but different functioning..
type: Answer
answers question: http://stackoverflow.com/q/25054274

http://stackoverflow.com/q/25036888
has answer: http://stackoverflow.com/a/25037213
answer count: 4
has answer: http://stackoverflow.com/a/25037224
has title: Best Practices to avoid Dependencies between Java Classes in a certain case?
score: 1
tagged with: java
upvote count: 1
type: Question
downvote count: 0
has comment: http://stackoverflow.com/comment/38939323
has answer: http://stackoverflow.com/a/25037204
favorite count: 0
has answer: http://stackoverflow.com/a/25037226
type: UnansweredQuestion
has body: I spend too much time on figuring out how to avoid dependencies between classes. Maybe there are some best practices which you guys elaborated? To explain what I mean let's assume the following: I have a JPanel "topPanel" containing a JTextField "textField" and a custom Panel JCustomPanel "customPanel" Let's say, the JCustomPanel simply has two JButtons "button1" and "button2", which can be pressed to change the textField. And this is where the pain starts. As long as I don't want the button1 and button2 to interact with the textField, I have a nicely independent JCustomPanel Class, which I could use just everywhere. What would be the best way to edit the textField? I would prefer solutions where the JCustomPanel does not need to know anything about it's topPanel. Update to the question: My question received very good answers and I feel that the MVC-Pattern might really be a powerful solution to my question. Where I'm still having difficulties is how to realize the MVC-Pattern in my code. The answers seem to suggest different approaches, so I'm going to post some code to get the best implementation of the MVC-Pattern. public class JTopPanel extends JPanel { private JTextField textField; private JCustomPanel customPanel; private boolean myBool = true; public JTopPanel() { super(); this.setLayout(new BorderLayout(5,5)); textField = new JTextField("0", 15); textField.setEditable(false); customPanel = new JCustomPanel(); this.add(BorderLayout.NORTH, textField); this.add(BorderLayout.CENTER, customPanel); } // Constructor JTopPanel } // Class JTopPanel And now the JCustomPanel Class: public class JCustomPanel extends JPanel { private JButton button1, button2; public JCustomPanel() { super(); this.setLayout(new FlowLayout(FlowLayout.TRAILING, 1, 1)); button1 = new JButton("1"); button2 = new JButton("2"); this.add(button1); this.add(button2); button1.addActionListener( ... ); // change textField from JTopPanel button2.addActionListener( ... ); // change textField from JTo…
tagged with: swing

http://stackoverflow.com/q/25049021
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/59089502
has answer: http://stackoverflow.com/a/61979232
downvote count: 0
favorite count: 0
answer count: 5
has answer: http://stackoverflow.com/a/25050009
has answer: http://stackoverflow.com/a/72282922
accepted answer: http://stackoverflow.com/a/25050009
has answer: http://stackoverflow.com/a/57936026
score: 25
upvote count: 25
possible better answer: http://stackoverflow.com/a/61979232
has title: What is the purpose of ScheduledFuture.get() method if is retrieved from the scheduleWithFixedDelay/scheduleAtFixedRate method
has body: I am confused with the following. I know, if I use the schedule method from the ScheduledThreadPoolExecutor class: ScheduledFuture&lt;?&gt; scheduledFuture = scheduledThreadPoolExecutor.schedule(myClassRunnable, 5, TimeUnit.SECONDS); I am able to retrieve later the value through scheduledFuture.get(5, TimeUnit.SECONDS) or scheduledFuture.get() and it should be null because the task has been executed just only once and it is completed. And null because I am working with the Runnable schedule method version and not with the Callable schedule method version. It according with the API. Until here I am fine. My question: What is the purpose of ScheduledFuture if is retrieved from the scheduleWithFixedDelay (even from scheduleAtFixedRate) method: ScheduledFuture&lt;?&gt; scheduledFuture= scheduledThreadPoolExecutor.scheduleWithFixedDelay(myClassRunnable, 1, 5, TimeUnit.SECONDS); Yes, I know both fixed methods execute the same task many times until the ScheduledThreadPoolExecutor's shutdown method is called (it must stop all the tasks scheduled). I did a research through Google looking for some examples using ScheduledFuture returned from scheduleWithFixedDelay, I only found one using the cancel method, to cancel a specific task. But none working with get(). I don't know if I am wrong, but seems useless the get() method if we are working with scheduleWithFixedDelay, because if I use later: scheduledFuture.get() - it remains awaiting and the Runnable object remains working many times (run,complete,delay,run,etc... ) scheduledFuture.get(32, TimeUnit.SECONDS) - always gives a TimeoutException I thought I should be able to retrieve the null value since I can use the period argument/parameter from the scheduleWithFixedDelay method. I.e: Run the Runnable object, wait until it completes and use the scheduledFuture.get() to get the null value that confirms it has been completed, await the period of the delay time to run again the Runnable object according with the period value etc…
tagged with: java.util.concurrent
type: AnsweredQuestion

http://stackoverflow.com/comment/38861691
comment on: http://stackoverflow.com/a/24995172
type: AnswerComment
has text: @Daniel Can you please check `asList` docs ??? that `Returns a fixed-size list backed by the specified array`
score: 0
type: Comment

http://stackoverflow.com/comment/38850571
type: Comment
has text: Ok, I think using JLayer is the correct answer for my question. I don't want to set your answer as correct, since the JLayer hint is just a bottom note :) What is a good way for Stackoverflow, do you want to give a separate answer (JLayer) which I can set as correct? Or should I set this answer as correct? Thanks :)
type: AnswerComment
comment on: http://stackoverflow.com/a/24976064
score: 0

http://stackoverflow.com/q/24928042
has answer: http://stackoverflow.com/a/24934030
type: Question
answer count: 2
has title: JExcel getCellFormat() always null
score: 0
has comment: http://stackoverflow.com/comment/38735007
tagged with: nullpointerexception
tagged with: jexcelapi
has answer: http://stackoverflow.com/a/24955593
type: UnansweredQuestion
tagged with: excel
tagged with: cell-formatting
has body: I have a problem with Jexcel. I want read an excel file and detect for each cell the background color. I'm doing in this way : Cell cell = sheet.getCell(i, j); Colour cellColor = cell.getCellFormat().getBackgroundColour(); I have always NullPointerException at cell.getCellFormat(). I checked that file is correctly read and I'm also able to retrieve the content. What am I doing wrong? Thanks
tagged with: java

http://stackoverflow.com/a/25009659
upvote count: 1
score: 1
accepted answer of: http://stackoverflow.com/q/25009579
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/25009579
type: Answer
has body: Compare Strings with equals. Remove this next("stop") an call next() without parameters. double prevClose = 0; String test = "this is a test test test stop 123 3.5"; Scanner parse = new Scanner(test); while(parse.hasNext()) { if(parse.next().equals("stop")) prevClose = parse.nextDouble(); } System.out.println(prevClose); output: 123.0

http://stackoverflow.com/a/25010064
has body: You could create a Job (org.eclipse.core.runtime.jobs.Job) in the start method and schedule it to run. If your code needs to interact with the UI use UIJob. Alternatively you could use the org.eclipse.ui.startup extension point to have a class run early in Eclipse startup (but this may be too early for what you want to do so a Job may still be necessary). You could also use an OSGi service for your class.
score: 8
upvote count: 8
type: Answer
answers question: http://stackoverflow.com/q/25005882
accepted answer of: http://stackoverflow.com/q/25005882
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/38895815

http://stackoverflow.com/comment/38944294
comment on: http://stackoverflow.com/a/25019631
has text: Also, try checking the superclass methods. See if there is one that you can use for your needs.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/38803547
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/24963053
has text: @pascalhein: so that was what I missed. I didn't realize that i had to do that part. I was going by an example that we went over in class. Now all that needs to get done is my input. for some reason, everything i put in makes the `selected(in);` take over and not keep my answer.
score: 0

http://stackoverflow.com/a/24929639
type: Answer
has body: I guess the trick here is that the question doesn't take inner classes and interfaces into account. Answers A and B only refer to top-level class and interface declarations (although not explicitly stated).
score: 2
downvote count: 0
upvote count: 2
answers question: http://stackoverflow.com/q/24929563

timer
tags question: http://stackoverflow.com/q/24946476
tag name: timer
tags question: http://stackoverflow.com/q/25024115
tags question: http://stackoverflow.com/q/25007402
tags question: http://stackoverflow.com/q/24978279
tags question: http://stackoverflow.com/q/24913902
type: Tag
tags question: http://stackoverflow.com/q/24927893
tags question: http://stackoverflow.com/q/24940022
tags question: http://stackoverflow.com/q/24943552
tags question: http://stackoverflow.com/q/25001052
tags question: http://stackoverflow.com/q/25025715
tags question: http://stackoverflow.com/q/24996983
tags question: http://stackoverflow.com/q/24983989
tags question: http://stackoverflow.com/q/24927025
tags question: http://stackoverflow.com/q/25021807
tags question: http://stackoverflow.com/q/25025795
tags question: http://stackoverflow.com/q/24924986
tags question: http://stackoverflow.com/q/24995723
tags question: http://stackoverflow.com/q/25025666

http://stackoverflow.com/a/25000743
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38873450
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/38874117
has comment: http://stackoverflow.com/comment/38874197
has comment: http://stackoverflow.com/comment/38875253
answers question: http://stackoverflow.com/q/25000695
has body: I believe is your nextInt() call since it doesn't consume the Return Line... Add an extra nextLine() (don't have to assign it to anything) Also as explained by @cdhowie nextInt() has to consume an Integer value as your sixth input.
accepted answer of: http://stackoverflow.com/q/25000695
has comment: http://stackoverflow.com/comment/38873419
has comment: http://stackoverflow.com/comment/38873257
has comment: http://stackoverflow.com/comment/38873268

http://stackoverflow.com/comment/38792485
comment on: http://stackoverflow.com/a/24958618
has text: `LocalDateTime.now(clock)` or more directly `LocalDateTime.now(ZoneId.of("Europe/Warsaw"))` will create a more suitable object.
type: AnswerComment
type: Comment
score: 2

http://stackoverflow.com/a/25068914
answers question: http://stackoverflow.com/q/25068749
upvote count: 2
has body: This is a HUGE question, although that's not really your fault. Here goes: Read through the Java Swing Tutorial. Learn a bit about MVC. Link1 Link2 Understand that Swing is not thread safe. Then: The best layout manager for your graph is likely the grid layout. Probably you should add a JButton to each node so you can just click on it. JButtons can be made to look like anything so don't be put off by how they look by default. Then MOST IMPORTANT: probably you should use a GUI Builder tool of some sort. I recommend NetBeans Matisse if you are new. Now you should try all of that, and ask a SPECIFIC QUESTION when you get stuck. Good luck!
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/25068749
score: 2
downvote count: 0

fxml
tags question: http://stackoverflow.com/q/24934122
tags question: http://stackoverflow.com/q/24915391
tags question: http://stackoverflow.com/q/24967553
tags question: http://stackoverflow.com/q/25014366
tags question: http://stackoverflow.com/q/24998478
tags question: http://stackoverflow.com/q/24949807
tag name: fxml
type: Tag
tags question: http://stackoverflow.com/q/24957875

http://stackoverflow.com/q/24923787
has answer: http://stackoverflow.com/a/24923824
has answer: http://stackoverflow.com/a/71096250
has body: I need to randomly access keys in a HashMap. Right now, I am using Set's toArray() method on the Set that HashMap's keySet() returns, and casting it as a String[] (my keys are Strings). Then I use Random to pick a random element of the String array. public String randomKey() { String[] keys = (String[]) myHashMap.keySet().toArray(); Random rand = new Random(); return keyring[rand.nextInt(keyring.length)]; } It seems like there ought to be a more elegant way of doing this! I've read the following post, but it seems even more convoluted than the way I'm doing it. If the following solution is the better, why is that so?Selecting random key and value sets from a Map in Java
answer count: 4
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
tagged with: random-access
has comment: http://stackoverflow.com/comment/38727561
type: Question
has title: Random access for HashMap keys
tagged with: hashmap
accepted answer: http://stackoverflow.com/a/24923835
has comment: http://stackoverflow.com/comment/38727340
has answer: http://stackoverflow.com/a/24923863
has comment: http://stackoverflow.com/comment/38727269
downvote count: 0
tagged with: key
favorite count: 0
possible better answer: http://stackoverflow.com/a/24923824
has comment: http://stackoverflow.com/comment/38727253
has answer: http://stackoverflow.com/a/24923835

svn
tags question: http://stackoverflow.com/q/24969977
tags question: http://stackoverflow.com/q/25013853
type: Tag
tags question: http://stackoverflow.com/q/25039227
tags question: http://stackoverflow.com/q/25021336
tag name: svn
tags question: http://stackoverflow.com/q/25006925

http://stackoverflow.com/comment/38825724
has text: @AlexisRustamDevitre: Databases are not a well protected memory segment. Unless you mean using JavaDB with the memory driver. Nothing is going to read and write a DB to your Jar file. It just doesn't work that way.
comment on: http://stackoverflow.com/q/24976115
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/24940205
has answer: http://stackoverflow.com/a/24940420
type: UnansweredQuestion
downvote count: 0
has comment: http://stackoverflow.com/comment/38758642
has comment: http://stackoverflow.com/comment/38762766
favorite count: 0
has comment: http://stackoverflow.com/comment/38758378
type: Question
has answer: http://stackoverflow.com/a/24940909
score: 5
has comment: http://stackoverflow.com/comment/38758383
has body: The only way I know to get a user input is by using the Scanner Class in my code, which (I believe) only contains these methods: Read a byte - nextByte() Read a short - nextShort() Read an int - nextInt() Read a long - nextLong() Read a float - nextFloat() Read a double - nextDouble() Read a boolean - nextBoolean() Read a complete line - nextLine() Read a word - next() What if I want an input that doesn't requires the keyboard and proceeds only if the user clicks on the screen (for instance), how am I supposed to do that?
has title: Input methods other than using Scanner class?
has comment: http://stackoverflow.com/comment/38758229
has comment: http://stackoverflow.com/comment/38762036
answer count: 3
has answer: http://stackoverflow.com/a/24940518
has comment: http://stackoverflow.com/comment/38758567
upvote count: 5
tagged with: java

http://stackoverflow.com/comment/38860361
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24993790
has text: The behaviour of the GC is JVM specific. You need to indicate which JVM implementation you are using, including which version.

maven
tags question: http://stackoverflow.com/q/25060982
tags question: http://stackoverflow.com/q/24932425
tags question: http://stackoverflow.com/q/25037906
tags question: http://stackoverflow.com/q/24972091
tags question: http://stackoverflow.com/q/25005404
tags question: http://stackoverflow.com/q/24910955
tags question: http://stackoverflow.com/q/25016546
tags question: http://stackoverflow.com/q/25008594
type: Tag
tags question: http://stackoverflow.com/q/24935962
tags question: http://stackoverflow.com/q/24928144
tags question: http://stackoverflow.com/q/25053616
tags question: http://stackoverflow.com/q/25021336
tags question: http://stackoverflow.com/q/25031417
tags question: http://stackoverflow.com/q/24936619
tags question: http://stackoverflow.com/q/24950391
tags question: http://stackoverflow.com/q/24971788
tags question: http://stackoverflow.com/q/24969919
tags question: http://stackoverflow.com/q/24951746
tags question: http://stackoverflow.com/q/24963101
tags question: http://stackoverflow.com/q/24955184
tags question: http://stackoverflow.com/q/24957374
tags question: http://stackoverflow.com/q/24919222
tags question: http://stackoverflow.com/q/25055102
tags question: http://stackoverflow.com/q/25040924
tags question: http://stackoverflow.com/q/25044673
tags question: http://stackoverflow.com/q/24998799
tags question: http://stackoverflow.com/q/24946746
tags question: http://stackoverflow.com/q/24975486
tags question: http://stackoverflow.com/q/24930710
tags question: http://stackoverflow.com/q/25047740
tags question: http://stackoverflow.com/q/25036039
tags question: http://stackoverflow.com/q/25014585
tags question: http://stackoverflow.com/q/25000371
tags question: http://stackoverflow.com/q/25051431
tags question: http://stackoverflow.com/q/24996702
tags question: http://stackoverflow.com/q/25056107
tags question: http://stackoverflow.com/q/24911303
tags question: http://stackoverflow.com/q/24994056
tags question: http://stackoverflow.com/q/24961307
tags question: http://stackoverflow.com/q/25028123
tags question: http://stackoverflow.com/q/25036929
tags question: http://stackoverflow.com/q/25018991
tags question: http://stackoverflow.com/q/25040163
tags question: http://stackoverflow.com/q/24981777
tags question: http://stackoverflow.com/q/24974380
tags question: http://stackoverflow.com/q/25024694
tags question: http://stackoverflow.com/q/24952825
tags question: http://stackoverflow.com/q/25057736
tags question: http://stackoverflow.com/q/24925239
tags question: http://stackoverflow.com/q/25010812
tags question: http://stackoverflow.com/q/24987818
tags question: http://stackoverflow.com/q/25055338
tags question: http://stackoverflow.com/q/24953080
tags question: http://stackoverflow.com/q/24940534
tags question: http://stackoverflow.com/q/25022189
tags question: http://stackoverflow.com/q/24909699
tags question: http://stackoverflow.com/q/24989653
tags question: http://stackoverflow.com/q/24972123
tags question: http://stackoverflow.com/q/25056715
tags question: http://stackoverflow.com/q/24961072
tags question: http://stackoverflow.com/q/24948632
tags question: http://stackoverflow.com/q/25066290
tags question: http://stackoverflow.com/q/25037689
tags question: http://stackoverflow.com/q/24947266
tags question: http://stackoverflow.com/q/24943065
tags question: http://stackoverflow.com/q/24919624
tags question: http://stackoverflow.com/q/25051683
tags question: http://stackoverflow.com/q/24941997
tags question: http://stackoverflow.com/q/24935977
tags question: http://stackoverflow.com/q/24981078
tags question: http://stackoverflow.com/q/24927599
tags question: http://stackoverflow.com/q/25065580
tags question: http://stackoverflow.com/q/25021164
tags question: http://stackoverflow.com/q/24947347
tags question: http://stackoverflow.com/q/24910417
tags question: http://stackoverflow.com/q/24912541
tags question: http://stackoverflow.com/q/24947710
tags question: http://stackoverflow.com/q/24963702
tags question: http://stackoverflow.com/q/24987897

http://stackoverflow.com/q/25000661
score: 0
answer count: 2
accepted answer: http://stackoverflow.com/a/25096401
has answer: http://stackoverflow.com/a/25096401
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25001113
has title: Unzip response stream from zipped with GZipStream (C#) in GZIPInputStream
type: Question
possible better answer: http://stackoverflow.com/a/25001113
tagged with: gzip
tagged with: java
has body: I am trying to unzip a response from a .net middleware. The response has been ziped using GZipStream. GZipStream zipStream = new GZipStream(fileStream, CompressionMode.Compress, true); when I used GZIPInputStream in java to unzip the file. I am getting an IOException with message "not in zip format" in the following code. GZIPInputStream gzin = new GZIPInputStream(response); I tried this too. ByteArrayInputStream memstream = new ByteArrayInputStream(buffer2); GZIPInputStream gzin = new GZIPInputStream(memstream); Any help or suggestions are welcomed. Thanks in advance

http://stackoverflow.com/comment/38885280
has text: Start by making sure you have read through and understand the [JavaDocs for `Component#repaint`](http://docs.oracle.com/javase/7/docs/api/java/awt/Component.html#repaint(int,%20int,%20int,%20int)). When using these methods, the clipping rectangle is modified so only the area you specify is available to be within in the `Graphics` context, this means you are still free to paint outside this area, but it will have no effect. Also, make sure that you "clear" the previous area first, otherwise you end up with ghosting artifacts.
comment on: http://stackoverflow.com/q/25007946
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25021756
tagged with: asp.net-mvc
tagged with: java
type: Question
upvote count: 2
has title: ASP MVC5 UserManager add methods
tagged with: asp.net
has comment: http://stackoverflow.com/comment/38917449
favorite count: 0
answer count: 1
has answer: http://stackoverflow.com/a/25022226
accepted answer: http://stackoverflow.com/a/25022226
has comment: http://stackoverflow.com/comment/38918754
score: 2
tagged with: c#
has body: I want edit UserManager class to add some methods like ChangeEmailAsync (clone of ChangePasswordAsync) I am new on C# and .NET because I used to work in java, I am reading the initiation from Microsoft site and practicing with some forms. I see a line of code: IdentityResult result = await UserManager.ChangePasswordAsync(User.Identity.GetUserId(), model.OldPassword, model.NewPassword); I want see the code from UserManager to copy ChangePassword and create ChangeEmail, and learn the procedure to create some methods (change other fields, etc.) I navigate with F12 to UserManager and I see that its a interface (Or looks like java interface) #region Ensamblado Microsoft.AspNet.Identity.Core.dll, v1.0.0.0 // C:\Users\User\Documents\Visual Studio 2013\Projects\MTGWeb\packages\Microsoft.AspNet.Identity.Core.1.0.0\lib\net45\Microsoft.AspNet.Identity.Core.dll #endregion using System; using System.Diagnostics; using System.Security.Claims; using System.Threading.Tasks; namespace Microsoft.AspNet.Identity { public class UserManager&lt;TUser&gt; : IDisposable where TUser : global::Microsoft.AspNet.Identity.IUser { public UserManager(IUserStore&lt;TUser&gt; store); public ClaimsIdentityFactory&lt;TUser&gt; ClaimsIdentityFactory { get; set; } public IPasswordHasher PasswordHasher { get; set; } public IIdentityValidator&lt;string&gt; PasswordValidator { get; set; } protected IUserStore&lt;TUser&gt; Store { get; } public virtual bool SupportsUserClaim { get; } public virtual bool SupportsUserLogin { get; } public virtual bool SupportsUserPassword { get; } public virtual bool SupportsUserRole { get; } public virtual bool SupportsUserSecurityStamp { get; } public IIdentityValidator&lt;TUser&gt; UserValidator { get; set; } [DebuggerStepThrough] public virtual Task&lt;IdentityResult&gt; AddClaimAsync(string userId, Claim claim); [DebuggerStepThrough] public virtual Task&lt;IdentityResult&gt; AddLoginAsync(string userId, UserLoginInfo login); [DebuggerStepThrough] public virtual Task&lt;…
type: AnsweredQuestion
downvote count: 0

http://stackoverflow.com/comment/38871283
comment on: http://stackoverflow.com/q/24971552
has text: We're talking of a desktop app used by thousands of people, it's not only "my" local machine but everyone's. See http://josm.openstreetmap.de/wiki/Help/Preferences/RemoteControl if you're curious about the why, but that's off-topic. Concerning the SAN, yes, I have checked into Windows keystore manager and the entries are listed as expected: DNS Name=localhost IP Address=127.0.0.1 URL=https://127.0.0.1:8112 I have tried to set https://127.0.0.1 to the trusted sites and local intranet sections of IE but it does not change anything.
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/84529127
comment on: http://stackoverflow.com/q/25048199
has text: Possible duplicate of [How to generate a ddl creation script with a modern Spring Boot + Data JPA and Hibernate setup?](https://stackoverflow.com/questions/36966337/how-to-generate-a-ddl-creation-script-with-a-modern-spring-boot-data-jpa-and-h)
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/comment/38885954
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25008168
type: AnswerComment
has text: Yep missed that part :P

http://stackoverflow.com/q/24963359
tagged with: activemq-classic
type: UnansweredQuestion
score: 1
upvote count: 1
tagged with: java
type: Question
answer count: 1
downvote count: 0
tagged with: jms
favorite count: 0
has answer: http://stackoverflow.com/a/24970394
has title: ActiveMQ - JMS MapMessage Filter by key/value
has body: Before you mark this a duplicate, I have tried looking on all the relevant post here; but unable to find relevant post. My problem statement is: To filter a MapMessage based on certain key/value pair in its body content. The EE tutorial suggest that The message consumer then receives only messages whose headers and properties match the selector. A message selector cannot select messages on the basis of the content of the message body. However, since the JMS implementations are vendor specific, I would like to know if it is possible to filter MapMessage based on key/value in Apache activemq implementation. (As an example, active MQ supports XPath based selectors when working with messages containing XML bodies. Check here) or Is it possible to override the selector (by inheritance, or implementing a new selector) and plug the same with activemq to achieve the result? Thanks.

http://stackoverflow.com/a/24987449
type: Answer
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/38847012
has body: It really doesn't sound like split is what you want. Using a Pattern/Matcher seems to be more in line with what you're trying to do: String text = "dfgs#&amp;-6d5.,bdgj895-9-8"; Matcher m = Pattern.compile("-?\\d+").matcher(text); while (m.find()) System.out.println(m.group()); -6 5 895 -9 -8 You can use a List&lt;String&gt; to store the matches.
downvote count: 0
has comment: http://stackoverflow.com/comment/38846960
answers question: http://stackoverflow.com/q/24987421

http://stackoverflow.com/comment/38756662
type: QuestionComment
has text: @radai At least in a Spring environment injection into pojo is simple see `@Configurable`. Imho advising people to keep the domain layer dumb is not a good advise: http://www.martinfowler.com/bliki/AnemicDomainModel.html
comment on: http://stackoverflow.com/q/24938559
type: Comment
score: 1

http://stackoverflow.com/a/25009009
score: 0
answers question: http://stackoverflow.com/q/25007932
has comment: http://stackoverflow.com/comment/38887684
has body: To create exceptions to your split delimiter you can use lookarounds like this: (?&lt;!Jay|Ne)-(?!Z|Yo) RegEx Demo
type: Answer

http://stackoverflow.com/comment/38728362
score: 0
type: Comment
comment on: http://stackoverflow.com/q/24923643
type: QuestionComment
has text: is this dependency a lib or a plugin? you might need a pluginRepository instead of a normal one. also - is it a snapshot?. lastly - have you tried dropping the password encryption and just specifying the password in plain text in the settings? have you tried explicitly telling maven where the settings file is (-S flag), maybe its not looking where you think it is. also, run maven with the -X and -U flags. the 1st is for more info, the 2nd is to prevent any caching/retry issues

http://stackoverflow.com/comment/38918335
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25021488
type: AnswerComment
has text: The title was just dummy, of ocurse i'm dealing with more complex data. Thanks for the info, I did not know the following: "the result returned by an action class's action method is the result that will be used, and whatever the interceptors return afterwards is not accounted for".

http://stackoverflow.com/comment/38980410
has text: Oh by the way my file weights "only" 68 MB now, is there a way to reduce it's size?
type: Comment
comment on: http://stackoverflow.com/a/25058336
score: 0
type: AnswerComment

http://stackoverflow.com/a/66047823
type: Answer
has body: I had exactly the same problem. The problem was in a different place. I had the &lt;mvc: annotation-driven /&gt; line entered in the servlet.xml file I commented on the line and the problem was gone.
score: 0
answers question: http://stackoverflow.com/q/24922294

http://stackoverflow.com/comment/38814033
has text: You are not adding accounts to a product.
comment on: http://stackoverflow.com/q/24970060
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38733722
has text: That special thing is *autoboxing*. Have a google on it. I summarise it in parentheses but more detail can be found in reference texts.
type: AnswerComment
comment on: http://stackoverflow.com/a/24927200
type: Comment
score: 1

opengl
tags question: http://stackoverflow.com/q/24944576
tags question: http://stackoverflow.com/q/24972903
tags question: http://stackoverflow.com/q/25002078
tags question: http://stackoverflow.com/q/24922539
type: Tag
tags question: http://stackoverflow.com/q/24957752
tags question: http://stackoverflow.com/q/24964255
tag name: opengl

http://stackoverflow.com/comment/38776582
type: AnswerComment
has text: You always talk about "slow", but have you _measured_? We don't care about the algorithm since the system picks an appropriate one at runtime and even switches it when necessary. You really, _really_ need to [read this blog post](http://ridiculousfish.com/blog/posts/array.html) (it's about arrays, but the same is true of NSDictionary)!
comment on: http://stackoverflow.com/a/24935383
type: Comment
score: 0

http://stackoverflow.com/q/24944458
tagged with: android
tagged with: android-activity
has answer: http://stackoverflow.com/a/24944658
type: UnansweredQuestion
has title: New Activity from SherlockFragment
tagged with: android-intent
type: Question
tagged with: java
answer count: 1
has body: I'm trying to set a programmatically created button to open a new activity when clicked and use putExtra but the Activity won't even stay on after opening, it stays for 1 seconds and then crashes. The button code: blogs[i].setOnClickListener(new View.OnClickListener() { public void onClick(View v) { Log.e("button", "blog clicked"); Intent i = new Intent(getSherlockActivity(), Soundcloud.class); startActivity(i); } }); The new class: public class Soundcloud extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { //this.requestWindowFeature(Window.FEATURE_NO_TITLE); super.onCreate(savedInstanceState); //setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); Log.e("activity", "in activity"); setContentView(R.layout.soundcloud); } } Layout: <?xml version="1.0" encoding="utf-8"?> The manifest.xml: <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="19" /> <permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.INTERNET" /> <permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> Logcat: 07-24 22:27:22.310: E/pass 2.2(24015): blogs - connection success 07-24 22:27:23.990: E/button(24015): blog clicked 07-24 22:27:24.280: E/activity(24015): in activity 07-24 22:27:25.080: W/dalvikvm(24015): threadid=1: thread exiting with uncaught exception (group=0x40f21438)
score: 0

http://stackoverflow.com/comment/38928630
has text: Well, like I tried to show with the example, there is not really an infinite recursion. Anyway, you can tweak your performance with setting `fetch = FetchType.LAZY` in the ManyToMany annotation. This way it will not fetch the full objects of the list when the Skill or User object is fetched. The opposite is Eager, for more info you should check the hibernate documentation or this [example](http://howtoprogramwithjava.com/hibernate-eager-vs-lazy-fetch-type/).
type: AnswerComment
comment on: http://stackoverflow.com/a/24999692
score: 0
type: Comment

http://stackoverflow.com/comment/38737161
comment on: http://stackoverflow.com/a/24928025
has text: I changed it, same result :(
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/24992334
has answer: http://stackoverflow.com/a/24992418
has comment: http://stackoverflow.com/comment/38855849
type: Question
has answer: http://stackoverflow.com/a/24992618
answer count: 2
accepted answer: http://stackoverflow.com/a/24992418
possible better answer: http://stackoverflow.com/a/24992618
has body: I have a simple caching system in Java that maps an object id (Integer) with a timestamp (Long) and the latter to a List&lt;Object&gt;. I map this situation with two maps: Map&lt;Integer, Long&gt; objectTimestamps = ... Map&lt;Long, List&lt;Object&gt;&gt; timestampToList = .... //I know, Here I can use something like a Guava's MultiMap, but it is not really important at this point I studied a lot of the collections from libraries like Guava, but I didn't found any specific data structure to be used in this case. Can you propose another way to hold this data? Please, consider that I read/insert this values continuously in my algorithm. PS: In my example I map the timestamp to a list of Object instances, but sometimes I map the timestamp to just a simple Object.
score: 0
tagged with: dictionary
has title: Java data structure for replacing two maps Map<A,B>, Map<B,C> linked via B value
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/comment/38939852
comment on: http://stackoverflow.com/a/25037100
score: 1
has text: The idea was to get the guy to do that part him/herself. There's a bit too much "do for" and not "teach" here.
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/38926404
type: AnswerComment
comment on: http://stackoverflow.com/a/25029018
has text: Also, this isn't an interface. [Native methods](http://docs.oracle.com/javase/specs/jls/se8/html/jls-8.html#jls-8.4.3.4) are declared in classes.
type: Comment
score: 0

http://stackoverflow.com/comment/38920899
type: Comment
type: QuestionComment
has text: Do you expect us to swim through your entire project to look for a couple lines of code. Just show the code where you load the image and tell us the file structure up to where the image is.
score: 0
comment on: http://stackoverflow.com/q/25023766

http://stackoverflow.com/a/24991979
has comment: http://stackoverflow.com/comment/38855734
score: 1
accepted answer of: http://stackoverflow.com/q/24991871
upvote count: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24991871
has body: You can simply call replace again as in &lt;xsl:template match="soap:address/@location"&gt; &lt;xsl:attribute name="location" select="replace(replace(., 'xyz\.company\.com', 'abc.company.com'), 'myapp', 'xyzapp')"/&gt; &lt;/xsl:template&gt;
type: Answer
downvote count: 0

http://stackoverflow.com/comment/38840763
has text: Am I crazy or is the character set not super important here? What will you be doing with this `byte[]`? Writing it to a file? Will you be writing anything else to that file? How will you be reading it?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24983983
score: 1

http://stackoverflow.com/comment/38889606
type: Comment
comment on: http://stackoverflow.com/q/24989777
score: 0
has text: We are using WebSphereMQ Version:7.0.1.3
type: QuestionComment

http://stackoverflow.com/comment/38827606
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24977306
has text: ok thanks. so how could I set the Y to the right position? do I set it to the y of the parent layout? and its like the same thing?
type: AnswerComment

http://stackoverflow.com/q/25048190
type: UnansweredQuestion
type: Question
tagged with: java
tagged with: jpype
has answer: http://stackoverflow.com/a/25070290
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/38964565
has title: Error Installing JPype - Permission Denied after jni.h not found
has body: This is my first post on StackOverflow. I'm trying to install JPype. I have looked at the tutorials and forums about this online. However, I am not able to successfully complete the installation. This is the error I'm getting: In file included from src/native/common/jp_array.cpp:17: src/native/common/include/jpype.h:45:10: fatal error: 'jni.h' file not found I'm running Mac OSX 10.9.3. I will be using a remote server. EDIT: I managed to get past the jni.h not found error. However, now I have this error --> error: /Library/Python/2.7/site-packages/_jpype.so: Permission denied Below is the setup.py code from JPype from distutils.core import setup as distSetup, Extension import os, os.path, sys class JPypeSetup(object): def init(self) : self.extra_compile_args = [] self.macros = [] def setupFiles(self) : cpp_files = [ map(lambda x : "src/native/common/"+x, os.listdir("src/native/common")), map(lambda x : "src/native/python/"+x, os.listdir("src/native/python")), ] all_src = [] for i in cpp_files : all_src += i self.cpp = filter(lambda x : x[-4:] == '.cpp', all_src) self.objc = filter(lambda x : x[-2:] == '.m', all_src) def setupWindows(self): print 'Choosing the Windows profile' self.javaHome = os.getenv("JAVA_HOME") if self.javaHome is None : print "environment variable JAVA_HOME must be set" sys.exit(-1) self.jdkInclude = "win32" self.libraries = ["Advapi32"] self.libraryDir = [self.javaHome+"/lib"] self.macros = [ ("WIN32",1) ] self.extra_compile_args = ['/EHsc'] def setupMacOSX(self): #self.javaHome = '/System/Library/Frameworks/JavaVM.framework/Versions/A/Headers/jni.h' #self.javaHome = '/System/Library/Frameworks/JavaVM.framework/Versions/' self.javaHome = '/Developer/SDKs/MacOSX10.6.sdk/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/' self.jdkInclude = "" self.libraries = ["dl"] #self.libraryDir = [self.javaHome+"/System/Library"] self.libraryDir = [self.javaHome+"/Libraries"] self.macros = [('MACOSX',1)] def setupLinux(self): self.javaHome = os.getenv…
tagged with: python
tagged with: permissions
tagged with: installation

http://stackoverflow.com/q/24975455
score: 1
has comment: http://stackoverflow.com/comment/38824592
has answer: http://stackoverflow.com/a/26747891
favorite count: 0
has comment: http://stackoverflow.com/comment/38824459
tagged with: download
type: Question
upvote count: 2
answer count: 2
has body: I am using the following code to download a file using Java but i want to detect when connection is lost. I ran the following code and while in the middle of downloading i disconnected my internet purposefully but no exception was thrown and it hanged. Even after turning on the connection back nothing happened. So, it hanged forever without any exceptions. Is there a way to make it throw an exception when the connection is lost? Thanks for the help! package toplower.top; import java.io.FileOutputStream; import java.net.URL; import java.nio.channels.Channels; import java.nio.channels.ReadableByteChannel; import java.util.*; import javax.mail.*; public class testing { public static void main(String[] args) { try{ URL website = new URL("http://b128.ve.vc/b/data/128/1735/asd.mp3"); ReadableByteChannel rbc = Channels.newChannel(website.openStream()); FileOutputStream fos = new FileOutputStream("song.mp3"); fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); } catch(Exception e){ System.out.println("got here"); e.printStackTrace(); } System.out.println("Done downloading..."); } }
has comment: http://stackoverflow.com/comment/42080029
has comment: http://stackoverflow.com/comment/38824515
has answer: http://stackoverflow.com/a/24975758
has comment: http://stackoverflow.com/comment/38824417
has comment: http://stackoverflow.com/comment/38824275
tagged with: java
has comment: http://stackoverflow.com/comment/38824535
has title: How do you detect a network disconnection when downloading a file in java?
downvote count: 1
linked to: http://stackoverflow.com/q/14029393
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/24983596
has comment: http://stackoverflow.com/comment/38824453
has comment: http://stackoverflow.com/comment/38824289
has comment: http://stackoverflow.com/comment/38824441

http://stackoverflow.com/q/24964694
score: 0
answer count: 1
has body: I've been developing a game for android but it is very important to know that I didn't use a single Activity until now. My game is working quite good until now but I want to make use of one activity for some settings because this is way more easy to change.. I've been reading some similar topics but I didn't succeed in my purpose yet. So i need to get an intent to the SettingsActivity coming from a tap on the screen in bounds of 5,5,75,75 as you see in the code.. As I said I've been reading some similar topics and use the code but it didn't work.. Thanks for helping public class MainMenuScreen extends Screen { public MainMenuScreen(Game game) { super(game); } @Override public void update(float deltaTime) { Graphics g = game.getGraphics(); List&lt;TouchEvent&gt; touchEvents = game.getInput().getTouchEvents(); int len = touchEvents.size(); for (int i = 0; i &lt; len; i++) { TouchEvent event = touchEvents.get(i); if (event.type == TouchEvent.TOUCH_UP) { if(inBounds(event,5,5,75,75)){ // Get an Intent to open the SettingsActivity }if(inBounds(event,85,350,200,75)){ System.out.println("Start Last level"); if(SampleGame.progress==0) Settings.currentLevel=0; if(SampleGame.progress==1) Settings.currentLevel=1; if(SampleGame.progress==2) Settings.currentLevel=2; if(SampleGame.progress==3) Settings.currentLevel=3; if(SampleGame.progress==4) Settings.currentLevel=4; Settings.save(game.getFileIO()); GameScreen.state=GameState.Ready; game.setScreen(new GameScreen(game)); }if(inBounds(event,500,350,275,75)){ game.setScreen(new LevelSelectionScreen(game)); } } } } private boolean inBounds(TouchEvent event, int x, int y, int width, int height) { if (event.x &gt; x &amp;&amp; event.x &lt; x + width - 1 &amp;&amp; event.y &gt; y &amp;&amp; event.y &lt; y + height - 1) return true; else return false; } @Override public void paint(float deltaTime) { Graphics g = game.getGraphics(); g.drawImage(Assets.menu, 0, 0); } @Override public void pause() { } @Override public void resume() { } @O…
has title: Start Activity from non activity class/project
has comment: http://stackoverflow.com/comment/38805016
tagged with: android-activity
tagged with: 2d-games
tagged with: android-intent
has comment: http://stackoverflow.com/comment/38804695
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/24968929
accepted answer: http://stackoverflow.com/a/24968929
type: Question

http://stackoverflow.com/q/25033898
has answer: http://stackoverflow.com/a/25034079
tagged with: java
tagged with: hibernate
has body: The scenario is that I have a class that represents a node in a folder structure, which has an ID, a name and a link to its parent. I'm trying to write some code that deletes all the folders, however the query "DELETE FROM Folder" no longer works because of integrity constraints if the folders are not deleted in exactly the right order - ie a folder cannot be deleted if it has a child that references it. So what needs to happen is that the folders with no children need to be deleted first, and then the folders that are subsequently left with no children can be deleted, and so on iteratively until the root folders can be deleted. I've tried writing a loop to this effect but I'm struggling with the query, the code is like this: int rowsAffected = -1; while(rowsAffected != 0) { query = entityManager.createQuery( "DELETE FROM MessageFolder mfparent" + "WHERE NOT EXISTS (" + "FROM MessageFolder mfchild" + "WHERE mfchild.parentId = mfparent.id" + ") "); rowsAffected = query.executeUpdate(); } The error I get from this is: 10:56:00,988 INFO [stdout] (default task-9) Hibernate: delete from PT_MESSAGE 10:56:01,004 ERROR [org.hibernate.hql.internal.ast.ErrorCounter] (default task-9) line 1:72: unexpec ted token: NOT 10:56:01,004 ERROR [org.hibernate.hql.internal.ast.ErrorCounter] (default task-9) line 1:72: unexpec ted token: NOT: line 1:72: unexpected token: NOT at org.hibernate.hql.internal.antlr.HqlBaseParser.deleteStatement(HqlBaseParser.java:296) [h ibernate-core-4.3.1.Final.jar:4.3.1.Final] Which I don't quite understand as "NOT EXISTS" seems to be valid as part of the JPA spec. What am I doing wrong? Also to note that my persistence provider is Hibernate, so if I can do this in a better way with either JPA or Hibernate, that is also an option. For reference the MessageFolder class is here: import java.util.ArrayList; import java.util.List; import javax.persistence.CascadeType; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence…
linked to: http://stackoverflow.com/q/45494
answer count: 2
tagged with: jpa
has answer: http://stackoverflow.com/a/25034172
score: 0
has title: JPQL deleting from self referencing table
type: UnansweredQuestion
type: Question

http://stackoverflow.com/a/25070411
upvote count: 1
has body: The span does not create a new column or row for us. There has to be other components in the other column or row. FormLayout works the same. I came with two possible solutions. Solution 1 We can use the w constraint to set the preferred size of the panels. The taller panels gets double size: package com.zetcode; import java.awt.EventQueue; import javax.swing.BorderFactory; import javax.swing.JFrame; import javax.swing.JPanel; import net.miginfocom.swing.MigLayout; public class MigPanels extends JFrame { public MigPanels() { initUI(); setTitle("Spanning"); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setLocationRelativeTo(null); } private void initUI() { JPanel pnl = new JPanel(new MigLayout("wrap 5")); pnl.add(createPanel(), "w 50, h 150, top"); pnl.add(createPanel(), "w 50, h 150, top"); pnl.add(createPanel(), "w 50, h 300"); pnl.add(createPanel(), "w 50, h 150, top"); pnl.add(createPanel(), "w 50, h 150, top"); add(pnl); pack(); } private JPanel createPanel() { JPanel pnl = new JPanel(); pnl.setBorder(BorderFactory.createEtchedBorder()); return pnl; } public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { @Override public void run() { MigPanels ex = new MigPanels(); ex.setVisible(true); } }); } } Solution 2 We put a dummy label to the second row: package com.zetcode; import java.awt.Dimension; import java.awt.EventQueue; import javax.swing.BorderFactory; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import net.miginfocom.swing.MigLayout; public class MigPanels2 extends JFrame { public MigPanels2() { initUI(); setTitle("Spanning"); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setLocationRelativeTo(null); } private void initUI() { JPanel pnl = new JPanel(new MigLayout("wrap 5")); pnl.add(createPanel()); pnl.add(createPanel()); pnl.add(createPanel(), "growy, spany 2"); pnl.add(createPanel()); pnl.add(createPanel()); // dummy label pnl.add(new JLabel(""), "cell 0 1, w 50, h 150"); add(pnl); pack(); } p…
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/24983349

http://stackoverflow.com/comment/38895369
type: Comment
has text: Why are you running it as a daemon?
score: 1
comment on: http://stackoverflow.com/q/25013198
type: QuestionComment

swagger
tags question: http://stackoverflow.com/q/24951268
tag name: swagger
tags question: http://stackoverflow.com/q/24937585
type: Tag

http://stackoverflow.com/q/25045217
has comment: http://stackoverflow.com/comment/38956080
type: UnansweredQuestion
tagged with: web-applications
tagged with: spring
has answer: http://stackoverflow.com/a/25046048
tagged with: spring-mvc
tagged with: java
has comment: http://stackoverflow.com/comment/38959224
upvote count: 1
downvote count: 1
has body: I started my adventure with Spring MVC framework. My current background is rather Adobe CQ5 applications. Most of the articles, tutorials and books that I read cover simple examples of views and then they switch to db integrations and so on. I would like to create simple application which will be a frontend for my backend OSGI based application. So it is important that framework works on OSGI. (I managed to run Spring MVC on Apache Felix - Karaf) So, I would like to have components shared across pages like: autopopulated, dynamic menu bar, which behaves differently depending on who is logged in footer &amp; header (also can be dynamic) and a couple of page specific components. I know that application I mentioned isn't complex at all, but it's just an example. In my opinion, each of these elements should have separate model, view and controller. These components should have access to some kind of session. And I don't see a way of doing it in Spring MVC. Is Spring MVC good solution for what I want to accomplish? I reached to the point, where it seems that I made a bad decision. I feel a bit cheated, since there are lot of examples of Spring MVC doing web pages (like PetClinic) but it seems that doing more complex stuff would be a pain. I have two additional questions. What is Spring MVC good for? Do you have any suggestions on what framework should I look for instead?
type: Question
linked to: http://stackoverflow.com/q/1296235
has title: Is Spring MVC a good solution for writing web page applications?
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/25045927
favorite count: 0

http://stackoverflow.com/comment/38902430
comment on: http://stackoverflow.com/q/25016930
score: 0
has text: could you add the code where you use this?
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38990915
type: AnswerComment
comment on: http://stackoverflow.com/a/25064053
has text: OP end up with result and don't know, how the result came :P
type: Comment
score: 2

http://stackoverflow.com/a/24948614
downvote count: 0
answers question: http://stackoverflow.com/q/24948553
upvote count: 2
has body: David pointed out the problem. You can resolve it in this way: public static Node read(Scanner scan) { int i = scan.nextInt(); Node n = new Node(); if (i == -1) { return null; } else { n.data = i; n.next=read(scan); //you probably wanted to do this return n; } }
type: Answer
score: 2

http://stackoverflow.com/a/27505281
type: Answer
score: 2
upvote count: 2
downvote count: 0
answers question: http://stackoverflow.com/q/25041104
has body: Maybe you use the wrong path for the src directory. It should be in the path : ./yourApp/src/main and not ./yourApp/src/androidTest You can move it manually.

http://stackoverflow.com/comment/38912504
score: 0
type: Comment
type: QuestionComment
has text: @ChrisO So the user has a stack of images, where they pick a slice/image from that stack- that slice has x-y coordinate (which is basically the 2D image) but it also has a z-coordinate (like where each slice was taken in the MRI). I want to convert that single slice into a 3D image. Does that kind of makes sense?
comment on: http://stackoverflow.com/q/24989404

http://stackoverflow.com/comment/91011510
score: 4
has text: This probably isn't the right answer. Advice is only executed if call reaches controller. Filter chains are executed first and if an exception occurs like AuthException then advice will not be applied.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/34868778

http://stackoverflow.com/a/24918847
type: Answer
has body: This should work : private static boolean isPresent(int []arrays, int number) { ... }
upvote count: 0
answers question: http://stackoverflow.com/q/24918584
downvote count: 3
has comment: http://stackoverflow.com/comment/38719031
score: -3

http://stackoverflow.com/comment/38959414
comment on: http://stackoverflow.com/a/25047056
score: 0
type: Comment
has text: Thank you thekbb. I will look into this tonight and see how it works.
type: AnswerComment

http://stackoverflow.com/comment/53318219
has text: stash java client doesn't have any builds available so it is mostly useless
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/30252908

http://stackoverflow.com/a/24933212
has comment: http://stackoverflow.com/comment/38745740
downvote count: 0
has body: Use classname.this from the inner class. So if you class is MySuperClass you can reference MySuperClass.this from an instance inner class. There is no reason you need to define superClick as you could always just call super.btnOK_onClick(view);. So all told, you should be able to do something like MySuperClass.super.btnOK_onClick()
has comment: http://stackoverflow.com/comment/38745893
accepted answer of: http://stackoverflow.com/q/24932824
has comment: http://stackoverflow.com/comment/38746562
score: 1
answers question: http://stackoverflow.com/q/24932824
has comment: http://stackoverflow.com/comment/38746137
upvote count: 1
has comment: http://stackoverflow.com/comment/38746284
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38746236
type: Answer
has comment: http://stackoverflow.com/comment/38746222

http://stackoverflow.com/comment/38746115
type: AnswerComment
comment on: http://stackoverflow.com/a/24931330
score: 0
type: Comment
has text: If we have 2 details in an event: `SWT.SELECTED` which is 2 and some other which is let's say 8, then `event.detail` would look like this `1010`. I want to set `SWT.SELECTED` to `0`, right? `1010` XOR `0010` = `1000`. Using an AND with the negative of `SWT.SELECTED` will clear the whole thing: `1010` AND `0000` = `0000`. Am I overseeing something?

http://stackoverflow.com/q/24909689
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/38700076
has body: pretty much I'm trying to get back into full on programming in JAVA and just needed some guidence with this little project I'm working on. Pretty much, there is a pool tournament i'm hosting and I want each player to verse each player once and once only: I created that program(https://scontent-a-lhr.xx.fbcdn.net/hphotos-xpa1/t1.0-9/10382869_10203343480684571_4145375306278338405_n.jpg) That also randomizes its so ceri isn't playing the first 5 games etc. But now what I want to do is after the games are created I want a Who won what game? kind of program..? But the issues i'm running into are I save the Matches as a string so I cant really ask who won Names[i] or Names[j] since its saved as a string, if you get me? I am not asking for code.. just guidance on how i could create this program, I was thinking maybe a 2d array or some sort???
answer count: 1
score: 0
has comment: http://stackoverflow.com/comment/38700008
has answer: http://stackoverflow.com/a/24909905
has comment: http://stackoverflow.com/comment/38699843
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38704811
has title: Guidance needed for program - Fixtures/Match

http://stackoverflow.com/q/24938677
has comment: http://stackoverflow.com/comment/38755457
has answer: http://stackoverflow.com/a/24938817
score: 0
has body: There are many predefined classes in java. They have there own methods some of which cannot be overridden. I just want to know if there is any way for us to access code of those classes. Example: In java.util.Arrays , there is sort(int[] a). How can we know which algorithm it implements and how it implements and how is it better than our normal implementation? Thank you.
favorite count: 0
has title: Access code of predefined class in java
has comment: http://stackoverflow.com/comment/38755061
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24938808
upvote count: 1
downvote count: 1
linked to: http://stackoverflow.com/q/19892322
has comment: http://stackoverflow.com/comment/38755042
tagged with: java
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/38755615
tagged with: algorithm

http://stackoverflow.com/a/25039296
type: Answer
upvote count: 4
downvote count: 0
score: 4
answers question: http://stackoverflow.com/q/25039156
has body: In a Unix system, a file can be a: Regular file Directory Symbolic Link Named pipe Socket Device file Door (Sun Solaris system) "Normal" file refers to a regular file here. It's the one type of file where the system does not impose any requirement on the file's internal structure.

http://stackoverflow.com/q/25047627
score: -2
has comment: http://stackoverflow.com/comment/38960415
has answer: http://stackoverflow.com/a/25047996
downvote count: 3
accepted answer: http://stackoverflow.com/a/25047996
upvote count: 1
has comment: http://stackoverflow.com/comment/38960674
answer count: 1
has comment: http://stackoverflow.com/comment/38960514
favorite count: 0
has comment: http://stackoverflow.com/comment/38960451
has title: NullPointer Exception when running Android Activity
tagged with: android
has comment: http://stackoverflow.com/comment/38960913
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38960367
tagged with: java
type: Question
has body: I dont understand why my app keep crashing. THe google analytics keeps saying that this crash is the most common on my app and i cant fix it. I have looked over the code multiple times and dont know how to fix the issue. Here is error: java.lang.IllegalStateException: Could not execute method of the activity at android.view.View$1.onClick(View.java:3969) at android.view.View.performClick(View.java:4640) at android.view.View$PerformClick.run(View.java:19421) at android.os.Handler.handleCallback(Handler.java:733) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:136) at android.app.ActivityThread.main(ActivityThread.java:5579) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:515) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1268) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1084) at dalvik.system.NativeStart.main(Native Method) Caused by: java.lang.reflect.InvocationTargetException at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:515) at android.view.View$1.onClick(View.java:3964) ... 11 more Caused by: java.lang.NullPointerException at com.soloinc.meip.RecordRap.onClick(RecordRap.java:371) ... 14 more Here is recordrap @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_record_rap); //instrument name from previous activity instrument_file_name = getIntent().getExtras().getString("instrument_file_name"); instrument_title = getIntent().getExtras().getString("instrument_title"); TextView tv = (TextView) findViewById(R.id.instrument_title); tv.setText(instrument_title); //getting buffer size for our audio specification bufferSize = AudioRecord.getMinBufferSize(RECORDER_SAMPLERATE,RECORDER_CHANNELS,RECORDER_AUDIO_ENCODING); //setting listeners for seek bars seekBar1 = (SeekBar)(findViewById(R.id.see…

http://stackoverflow.com/comment/38966465
score: 0
has text: Hi I use Android studio, where would i find it in there do you know? thanks for your help
type: AnswerComment
comment on: http://stackoverflow.com/a/25029470
type: Comment

http://stackoverflow.com/a/25058701
answers question: http://stackoverflow.com/q/25058351
downvote count: 0
type: Answer
score: 3
has comment: http://stackoverflow.com/comment/38981064
upvote count: 3
has body: So, what is the purpose of it? Look at the signature of the copy constructor: ArrayList(Collection&lt;? extends E&gt; c) It constructs a list from any collection; e.g. a LinkedList, any kind of Set, etcetera. By contrast, you can only clone() an ArrayList from another ArrayList. Now there are undoubtedly "issues" with clone() in general. However for (at least) the standard non-concurrent collection classes, cloning works just as well as the copy constructor ... modulo that it does the job; see above. For these classes, the clone() method is defined to return a shallow copy; see the respective class javadocs. If anyone has the exact code of both the Copy Constructor and the Clone Method of the Java#ArrayList for comparison, that would be great. Google is your friend. Google for "java.util.ArrayList" source. (I prefer the Grepcode site. It has multiple versions of the code, and a nice UI for navigating the code, the package hierarchy, the class hierarchy, and even definition / usage relationships.)
has comment: http://stackoverflow.com/comment/38981008

http://stackoverflow.com/q/25056207
favorite count: 0
has answer: http://stackoverflow.com/a/25056407
linked to: http://stackoverflow.com/q/1776142
type: Question
upvote count: 2
answer count: 2
tagged with: spring-mvc
tagged with: java
has comment: http://stackoverflow.com/comment/38977212
has title: IllegalStateException: getOutputStream() has already been called for this response
has answer: http://stackoverflow.com/a/69560604
tagged with: jsp
tagged with: jquery
type: UnansweredQuestion
tagged with: ajax
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/38976591
has body: I have a JSP page which contains a table. On load of the page, the table will be populated. I also have an ajax call for every X seconds which has to refresh the table contents. On load, the contents are populated as expected. But during ajax call, it fails with below error: Jul 31, 2014 3:17:16 PM org.apache.catalina.core.StandardWrapperValve invoke SEVERE: Servlet.service() for servlet [SpringDispatcherServlet] in context with path [/sample] threw exception [java.lang.IllegalStateException: getOutputStream() has already been called for this response] with root cause java.lang.IllegalStateException: getOutputStream() has already been called for this response at org.apache.catalina.connector.Response.getWriter(Response.java:638) at org.apache.catalina.connector.ResponseFacade.getWriter(ResponseFacade.java:214) at javax.servlet.ServletResponseWrapper.getWriter(ServletResponseWrapper.java:105) at javax.servlet.ServletResponseWrapper.getWriter(ServletResponseWrapper.java:105) at org.springframework.security.web.context.SaveContextOnUpdateOrErrorResponseWrapper.getWriter(SaveContextOnUpdateOrErrorResponseWrapper.java:109) at org.apache.jasper.runtime.JspWriterImpl.initOut(JspWriterImpl.java:125) at org.apache.jasper.runtime.JspWriterImpl.flushBuffer(JspWriterImpl.java:118) at org.apache.jasper.runtime.PageContextImpl.release(PageContextImpl.java:190) I checked the existing questions on this issue, but with no good. I am not using scriplets in the code. JSP COde: $(document) .ready( function() { var performAjax = function() { $ .ajax({ method : 'get', contentType: 'application/json', dataType: "json", url : "${pageContext.request.contextPath}/refresh", success : function(data) { alert("got something"); }, error : function(e) { alert('Error: ' + e); } }); } setInterval(performAjax, 15000); }); Controller code: @RequestMapping(value = "/refresh") public @ResponseBody RefresingModel refresh(ModelMap modelMap, HttpSession session) { return refreshService.getUpdatedData(); }
has comment: http://stackoverflow.com/comment/38976217

null-layout-manager
tags question: http://stackoverflow.com/q/24988797
type: Tag
tags question: http://stackoverflow.com/q/24914907
tag name: null-layout-manager

http://stackoverflow.com/q/24968525
has title: Startup Activity Memory Leak
has comment: http://stackoverflow.com/comment/38811639
score: 0
answer count: 2
accepted answer: http://stackoverflow.com/a/24968839
tagged with: media
has answer: http://stackoverflow.com/a/24969302
has comment: http://stackoverflow.com/comment/38811583
has body: I have a simple Activity called StartupActivity that plays on startup of my application and opens up MainActivity in an intent. I noticed that if I change the manifest to open directly to MainActivity then my app uses 7mb or more less RAM on MainActivity. I believe this is a memory leak. I cannot find it though, could someone help me out public class StartupActivity extends Activity { private MediaManager mp; private CountDownTimer time; private boolean activityHasExited; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); setContentView(R.layout.activity_startup); activityHasExited=false; mp = new MediaManager(); mp.playSoundClip(this,R.raw.intro); //display the logo time = new CountDownTimer(4000,1000){ @Override public void onTick(long millisUntilFinished){ } @Override public void onFinish(){ if(!activityHasExited){ Intent i= new Intent(StartupActivity.this, MainActivity.class); startActivity(i); time=null; StartupActivity.this.finish(); } } }.start(); } @Override public void onDestroy(){ super.onDestroy(); if(time!=null){ time.cancel(); time=null; } mp.stop(); activityHasExited=true; } } Support class: //source: http://stackoverflow.com/questions/18254870/play-a-sound-from-res-raw public class MediaManager { private MediaPlayer mMediaPlayer; public void stop() { if (mMediaPlayer != null) { mMediaPlayer.release(); mMediaPlayer = null; } } public void playSoundClip(Context c, int rid) { stop(); mMediaPlayer = MediaPlayer.create(c, rid); mMediaPlayer.setOnCompletionListener(new MediaPlayer.OnCompletionListener() { @Override public void onCompletion(MediaPlayer mediaPlayer) { stop(); } }); mMediaPlayer.start(); } } Edit: By changing onDestroy to onStop (as per ChallengeAccepted's or Simon's suggestion) the activity will finish if the user hits home before the countdown ends, which is good! I'm still seeing more memory usage when I include the intro activ…
tagged with: android
tagged with: memory-leaks
possible better answer: http://stackoverflow.com/a/24969302
linked to: http://stackoverflow.com/q/18254870
type: AnsweredQuestion
tagged with: memory-management
tagged with: java
has answer: http://stackoverflow.com/a/24968839
type: Question

http://stackoverflow.com/q/24911935
upvote count: 6
answer count: 4
has answer: http://stackoverflow.com/a/52320364
type: UnansweredQuestion
score: 6
has answer: http://stackoverflow.com/a/24936824
type: Question
has answer: http://stackoverflow.com/a/24914219
has title: MongoDB, Java, sort by first array entry
tagged with: java
has comment: http://stackoverflow.com/comment/38748593
has body: I'm trying to sort values after executing a find on my MongoDB by Java API. The result list contains the following entries: { "_id": "P17-223", "property": "P17", "itemid": 223, "labels": [ { "language": "en", "value": "Greenland" }, { "language": "es", "value": "Groenlandia" }, { "language": "de", "value": "Grönland" } ] } I want to sort by the first entry of the array labels: DBCursor cursor = getCollection().find(query); BasicDBObject orderBy = new BasicDBObject("labels[0].value", 1); cursor.sort(orderBy); Cursor values are not sorted by this code. Can you help me?
has answer: http://stackoverflow.com/a/45549127
has comment: http://stackoverflow.com/comment/38706923
tagged with: mongodb
has comment: http://stackoverflow.com/comment/38751475
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/38705505
tagged with: aggregation-framework
has comment: http://stackoverflow.com/comment/38712365

http://stackoverflow.com/a/25066842
has comment: http://stackoverflow.com/comment/38999857
answers question: http://stackoverflow.com/q/25066022
has body: If you ask about passing a collection from java code to jasperreports, the best way is to use: net.sf.jasperreports.engine.data.JRBeanCollectionDataSource EDIT: Full example: HashMap&lt;String, Object&gt; parameters = new HashMap&lt;&gt;(); List&lt;MyObject&gt; objects = new ArrayList&lt;&gt;(); JRBeanCollectionDataSource jDataSource = new JRBeanCollectionDataSource(objects); // Load report ClassPathResource report = new ClassPathResource("/myReport.jasper"); InputStream input = report.getInputStream(); // Fill the report with data JasperReport jasperReport = (JasperReport) JRLoader.loadObject(input); JasperPrint print = JasperFillManager.fillReport(jasperReport, parameters, jDataSource); // Export the report to the output ByteArrayOutputStream output = new ByteArrayOutputStream() JRExporter exporter = new JRPdfExporter(); exporter.setParameter(JRExporterParameter.JASPER_PRINT, print); exporter.setParameter(JRExporterParameter.OUTPUT_STREAM, output); exporter.exportReport(); // Return the byte[] return output.toByteArray();
score: 0
has comment: http://stackoverflow.com/comment/39007284
type: Answer

http://stackoverflow.com/comment/38955494
type: AnswerComment
has text: however, OP says that is what the main list would be and seems to be handling 3 lists. It's possible to accomplish both the things we mentioned in linear time and without overriding .equals() and .hashCode().
type: Comment
comment on: http://stackoverflow.com/a/25044969
score: 0

http://stackoverflow.com/comment/38973765
has text: It's a news source, not under my control. The thing is that if a browser shows mobile version, I guess WebView should also be able to show it.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25039674
type: Comment

http://stackoverflow.com/a/24987559
type: AcceptedAnswer
downvote count: 0
score: 79
type: Answer
has comment: http://stackoverflow.com/comment/126386907
answers question: http://stackoverflow.com/q/24986945
has comment: http://stackoverflow.com/comment/126536655
has comment: http://stackoverflow.com/comment/126539753
has comment: http://stackoverflow.com/comment/126486860
accepted answer of: http://stackoverflow.com/q/24986945
has comment: http://stackoverflow.com/comment/126488984
has body: I believe OP's question is more on : why there are duplicated methods, given empty() and isEmpty() are doing the same thing? If you take a closer look, in Vector, Stack and HashTable, there are more examples of methods doing similar thing with different names. Here is the brief history: At the time of JDK 1.0, there was no "Collection" framework in Java. Stack, Vector, HashTable were some of the basic data structures provided by Java. Later in JDK 1.2, Collection framework was added to JDK, and standard interfaces (like List, Map) were introduced. However in these new standard collection interfaces, methods were named in a different convention. The change in naming convention was most probably influenced by Java Bean standard introduced also in JDK 1.2. These method names were different from those in old Stack, Vector and HashTable classes. For example, it was named empty() in original class but was named isEmpty() of Collection interface. In order to make Stack, Vector and HashTable compatible with Collection framework, Stack, Vector and HashTable has implemented its corresponding Collection interfaces. On the same time, old methods were kept for the sake of backward compatibility. Hence the "duplicated" methods you see now.
upvote count: 79

http://stackoverflow.com/comment/38816419
score: 0
type: Comment
type: QuestionComment
has text: you are not reading my post carefully and you have wasted your 1 hour to figure this issue....
comment on: http://stackoverflow.com/q/24970603

http://stackoverflow.com/q/25001677
answer count: 4
favorite count: 0
upvote count: 2
type: UnansweredQuestion
has body: I am trying to build an opaque Binary Blob 64-bit encoded with any garbage/random content, also trying to make it in such a way so that I can specify the size in Kb for the blob of data to generate into it. The purpose of it is to bench-mark the write throughput of a DB application which support the blob datatype (e.g. C*). The blob does not need to be unique, hence it can be constructed once and just reuse it to avoid latency client side due to GC and object creation. I have naively tried using a ByteBuffer.allocateDirect(bSize) thinking I could just use whatever garbage it will pickup from memory, however I am doubtful that this approach works. Any suggestions as to how to achieve that?
score: 2
tagged with: java
type: Question
tagged with: blob
has answer: http://stackoverflow.com/a/25003100
tagged with: encoding
tagged with: arrays
has answer: http://stackoverflow.com/a/32760241
tagged with: bytebuffer
has title: How to generate a binary blob object in java of a specific size?
has answer: http://stackoverflow.com/a/25001948
has answer: http://stackoverflow.com/a/25001817
downvote count: 0

http://stackoverflow.com/a/25041908
has comment: http://stackoverflow.com/comment/38974908
answers question: http://stackoverflow.com/q/25041675
has comment: http://stackoverflow.com/comment/38951045
upvote count: 1
has body: Trivially root = null;. However there is a difference with C++ as Java cannot change a passed variable: delete(root); will never set root to something else. This was a design principle to make Java more qualitative in software engineering sense (less error prone) than C++ (Node*&amp;). You need to use return values, as there are no output values. A modified example: Node deleteSubtree(Node tree, Object value) { if (tree == null) { return null; } if (value.equals(tree.value)) { return null; // Deleting a subtree } tree.left = delete(tree.left, value); tree.right = delete(tree.right, value); return root; } NOde root = ... root = delete(root, "war"); This would delete the subtree rooted at "war".
type: Answer
downvote count: 0
score: 1

http://stackoverflow.com/q/24926646
has title: How to set-up spring security without inMemoryAuthentication?
has answer: http://stackoverflow.com/a/57813207
type: UnansweredQuestion
tagged with: spring
downvote count: 1
tagged with: spring-mvc
tagged with: java
score: -1
type: Question
answer count: 2
upvote count: 0
tagged with: spring-security
has answer: http://stackoverflow.com/a/24929648
favorite count: 0
has body: I've my spring security up and running. It's using my own authentication provider since the authentication is done by a host system. Since I want to have annotation based security I added @EnableGlobalMethodSecurity(securedEnabled = true) to my servlet configuration. Unfortunately this was triggering a AuthenticationManager is required exception. The only way to avoid this exception was to add a configureGlobal method to the servlet config with an inMemoryAuthentication. Obviously I don't want this inMemoryAuthentication since the application depends on my own host authentication. How can I get rid of the inMemoryAuthentication? This is my servlet configuration: @Configuration @EnableWebMvc @EnableGlobalMethodSecurity(securedEnabled = true) @Import({ FooControllerConfig.class, }) public class FooServerletConfig { @Autowired //@formatter:off public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception { auth .inMemoryAuthentication() .withUser("user").password("password").authorities("ROLE_USER"); } //@formatter:on } This is the security configuration: @Configuration @EnableWebMvcSecurity public class FooSecurityConfig extends WebSecurityConfigurerAdapter { @Override //@formatter:off protected void configure(HttpSecurity http) throws Exception { http .authenticationProvider(aS400AuthenticationProvider()) .formLogin() .loginProcessingUrl("/authorized") .passwordParameter("password") .usernameParameter("clientId") .successHandler(fooAuthenticationSuccessHandler()) .failureHandler(fooAuthenticationFailureHandler()) .and() .csrf().disable() .rememberMe() .rememberMeServices(fooRememberMeServices()) .key(CookieService.LIR_SESSION_COOKIE_NAME) .and() .sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS) .and() .exceptionHandling().authenticationEntryPoint(new Http403ForbiddenEntryPoint()); ; } //@formatter:on } This is the exception I get if the configureGlobal method is missing: SEVERE: Servlet /FOO threw load() exception java.lang…

http://stackoverflow.com/comment/38855899
type: Comment
comment on: http://stackoverflow.com/a/24991087
type: AnswerComment
score: 0
has text: So is there an issue in my modified ListAsGridExampleAdapter? or is it correct because I used it with your ListAsGridBaseAdapter.

http://stackoverflow.com/comment/38927606
type: AnswerComment
has text: Ahh, you were right with your comment. Just running nmap on target host to get open ports. There was no pop3 port but an open imaps port (993). I just change properties to imap and everything is working fine now. But why did telnet command from above not fail?
type: Comment
comment on: http://stackoverflow.com/a/25017942
score: 0

http://stackoverflow.com/a/25022926
downvote count: 0
has body: Creating a new pool does get rid of the old one, unless you shut it down you now have two pools, one with three threads and one with four. The simplest thing to do is to create a ThreadPoolExecutor (which is the implementing class here) This will allow you to change the core pool size and the maximum pool times. // start with a pool with a min/max size of 3. ThreadPoolExecutor executor = new ThreadPoolExecutor(3,3,60, TimeUnit.MINUTES, new LinkedBlockingQueue&lt;Runnable&gt;()); // set the min/max size to 4. executor.setMaximumPoolSize(4); executor.setCorePoolSize(4); Another option is to make the pool size 4 from the start if you know that 4 is reasonable.
type: Answer
upvote count: 6
has comment: http://stackoverflow.com/comment/38914307
score: 6
answers question: http://stackoverflow.com/q/25022810
has comment: http://stackoverflow.com/comment/38913977

http://stackoverflow.com/q/25028868
downvote count: 0
type: AnsweredQuestion
score: 3
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/25028907
accepted answer: http://stackoverflow.com/a/25028907
answer count: 1
tagged with: arrays
has body: I have a program that uses an array if integers to behave like a Stack of Integers. However, with an array, there must be a defined number of elements. When the user calls a method such as push() and that goes over the initial number of arrays, I must allocate everything from the original into the updated array and resize it. If I have: int[] data = new int[100]; and the user calls push(), it would resize when necessary. public int push(int item) { if (size + 1 &gt; data.length) { // O(n) solution data = Arrays.copyOf(data, data.length * 2 + 1); // double array size } data[size] = item; // size is elements from 0 to size that matter(as a stack) size++; return item; } However, I am wondering: What the runtime complexity for Arrays.copyOf()? My tests seems to indicate somewhere between O(n) and O(constant), but I'm still not sure. If it isn't O(constant), is there a new way to resize the array while keeping a O(constant) runtime for this method?
upvote count: 3
has comment: http://stackoverflow.com/comment/38924972
favorite count: 0
tagged with: big-o
has title: Time Complexity for Array.copyOf()
has comment: http://stackoverflow.com/comment/38925024

http://stackoverflow.com/q/25008214
has answer: http://stackoverflow.com/a/25008269
upvote count: 1
has body: Any idea on how I can fix this? I'm telling the user to enter the amount of numbers he would like to average. Of course as you can see in the code, if he inputs a 0 or a negative number I want it to flag the user to enter another number that is not 0 or a negative number. The problem is, once the user puts a 0 or a negative number, it gets stuck in that state and I have to terminate the program. Help? import javax.swing.JOptionPane; public class TestProgTres { public static void main(String[] args) { //Variable Declaration String ShowSome; String ShowSomeAgain; int z = 0; double avg = 0; double totalamt = 0; ShowSome = JOptionPane.showInputDialog("Enter the amount of numbers you would like to average"); double AllNumbers = Double.parseDouble(ShowSome); while (AllNumbers &lt; 1) { JOptionPane.showInputDialog("You cannot enter a negative or a 0. Enter the amount of numbers you would like to average"); AllNumbers = Double.parseDouble(ShowSome); }//end while if (AllNumbers &gt; 0) { double Numbers [] = new double [(int) AllNumbers]; for (z = 0; z &lt; Numbers.length; z++) { ShowSomeAgain= JOptionPane.showInputDialog("Enter number " + (z + 1)); Numbers[z]=Double.parseDouble(ShowSomeAgain); totalamt += Numbers[z]; avg = totalamt/AllNumbers; } } JOptionPane.showMessageDialog(null, "The of the numberes entered is " + avg); }//end main }// end class
favorite count: 0
answer count: 3
possible better answer: http://stackoverflow.com/a/25008263
downvote count: 0
has answer: http://stackoverflow.com/a/25008340
has comment: http://stackoverflow.com/comment/38885827
accepted answer: http://stackoverflow.com/a/25008340
has title: Display error message when user inputs "0", cannot get out of "error" message
type: Question
type: AnsweredQuestion
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/25008263

http://stackoverflow.com/comment/38862115
comment on: http://stackoverflow.com/q/24995617
type: Comment
type: QuestionComment
score: 2
has text: I think FileInputStream(String name) is there just for convenience.

http://stackoverflow.com/q/24981501
has answer: http://stackoverflow.com/a/25419740
type: Question
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/24992059
tagged with: stack-overflow
tagged with: serialization
tagged with: wicket
has comment: http://stackoverflow.com/comment/38902867
type: UnansweredQuestion
tagged with: java
has title: Wicket StackOverflowError in Serializing or Seserializing Session
has body: I'm using Wicket 6.15 and I got following exception in my program java.lang.StackOverflowError at java.lang.Exception.&lt;init&gt;(Exception.java:102) at java.lang.ReflectiveOperationException.&lt;init&gt;(ReflectiveOperationException.java:89) at java.lang.reflect.InvocationTargetException.&lt;init&gt;(InvocationTargetException.java:72) at sun.reflect.GeneratedMethodAccessor11.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.apache.wicket.core.util.objects.checker.CheckingObjectOutputStream.internalCheck(CheckingObjectOutputStream.java:398) at org.apache.wicket.core.util.objects.checker.CheckingObjectOutputStream.check(CheckingObjectOutputStream.java:361) at org.apache.wicket.core.util.objects.checker.CheckingObjectOutputStream.checkFields(CheckingObjectOutputStream.java:645) at org.apache.wicket.core.util.objects.checker.CheckingObjectOutputStream.internalCheck(CheckingObjectOutputStream.java:569) at org.apache.wicket.core.util.objects.checker.CheckingObjectOutputStream.check(CheckingObjectOutputStream.java:361) at org.apache.wicket.core.util.objects.checker.CheckingObjectOutputStream.checkFields(CheckingObjectOutputStream.java:645) at org.apache.wicket.core.util.objects.checker.CheckingObjectOutputStream.internalCheck(CheckingObjectOutputStream.java:569) at org.apache.wicket.core.util.objects.checker.CheckingObjectOutputStream.check(CheckingObjectOutputStream.java:361) ... I have no idea what can cause such StackOverFlow in wicket-core. I search for this exception and found that these part of exception are belongs to Serialization. so I checked all of my object and all of them implements Serializable an other interesting port of problem is that this exception doesn't occurs at the first time, It occurs after i try to render component 2 or 3 time. Any help would be greatly appreciated.

http://stackoverflow.com/q/24953497
has comment: http://stackoverflow.com/comment/38883779
type: Question
tagged with: firefox
downvote count: 0
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/25265664
upvote count: 2
type: UnansweredQuestion
has body: I'm testing with firefox webdriver and it works quite well until firefox upgraded to 31 recently. It will take several minutes for the firefox webdriver to find a element, which took less than a second in the older version. This does not happen in all web pages, nor all elements on the same page. It seems only the first one will take such long time. Did anyone get into similar issue? Any advice will be deeply appreciated, thanks in advance! regards, Hanbo Below are the selenum logs for reference: 18:02:55.941 INFO - Java: Oracle Corporation 24.51-b03 18:02:55.944 INFO - OS: Windows 8 6.2 amd64 18:02:55.961 INFO - v2.42.2, with Core v2.42.2. Built from revision 6a6995d ...... 18:03:42.840 INFO - Executing: [new session: Capabilities [{firefox_profile=UEsDBBQACAgIAHWQ+UQAAAAAAAAAA..., browserName=firefox, unexpectedAlertBehaviour=ignore}]]) 18:03:42.865 INFO - Creating a new session for Capabilities [{firefox_profile=UEsDBBQACAgIAHWQ+UQAAAAAAAAAA..., browserName=firefox, unexpectedAlertBehaviour=ignore}] 18:03:50.423 INFO - Done: [new session: Capabilities [{firefox_profile=UEsDBBQACAgIAHWQ+UQAAAAAAAAAA..., browserName=firefox, unexpectedAlertBehaviour=ignore}]] 18:03:50.454 INFO - Executing: [set window position]) 18:03:50.483 INFO - Done: [set window position] 18:03:50.491 INFO - Executing: [set window size]) 18:03:50.513 INFO - Done: [set window size] 18:03:50.522 INFO - Executing: [page load wait: 60000]) 18:03:50.545 INFO - Done: [page load wait: 60000] 18:03:50.552 INFO - Executing: [implicitly wait: 1000]) 18:03:50.565 INFO - Done: [implicitly wait: 1000] 18:03:50.573 INFO - Executing: [set script timeoutt: 60000]) 18:03:50.589 INFO - Done: [set script timeoutt: 60000] 18:03:50.596 INFO - Executing: [get: https://user:password@test.site]) 18:03:53.048 INFO - Done: [get: https://user:password@test.site] ......here goes the first element, nearly 4 minutes and NO timeout 18:04:09.796 INFO - Executing: [find element: By.id: input-dialog-year]) 18:07:44.731 INFO - D…
score: 2
has title: Extremely slow to find element on Firefox 31 and Selenium 2.42.2
has comment: http://stackoverflow.com/comment/38782827
tagged with: java
tagged with: selenium

http://stackoverflow.com/comment/38874686
comment on: http://stackoverflow.com/a/25002261
type: AnswerComment
score: 0
type: Comment
has text: I'm giving that link a look. Thanks for posting!

apache-poi
tags question: http://stackoverflow.com/q/25013988
tags question: http://stackoverflow.com/q/24978842
tags question: http://stackoverflow.com/q/25054901
tags question: http://stackoverflow.com/q/24933868
tags question: http://stackoverflow.com/q/25029058
tags question: http://stackoverflow.com/q/25063177
type: Tag
tags question: http://stackoverflow.com/q/25003745
tags question: http://stackoverflow.com/q/25058339
tags question: http://stackoverflow.com/q/24951585
tag name: apache-poi
tags question: http://stackoverflow.com/q/25043720
tags question: http://stackoverflow.com/q/24969236
tags question: http://stackoverflow.com/q/24911591
tags question: http://stackoverflow.com/q/24927438
tags question: http://stackoverflow.com/q/24934975
tags question: http://stackoverflow.com/q/25013629
tags question: http://stackoverflow.com/q/24973720

http://stackoverflow.com/comment/38847082
has text: @user3882666 You really have to check documentation/basics of java language.Check String's format() method documentation.String.format("number is %d",balance); //Where %d is placeholder for actual value,and balance is for instance supplyer/parameter for that value.You dont even have to use format method if you dont know how to use it yet.Use plain old string concatenation.
comment on: http://stackoverflow.com/a/24986900
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/38924476
type: AnswerComment
has text: haha actually my boss doesn't like when I do that, i.e. passing a boolean value which tells the function what to do.
type: Comment
comment on: http://stackoverflow.com/a/25028607
score: 0

http://stackoverflow.com/q/24996093
has answer: http://stackoverflow.com/a/24996203
has answer: http://stackoverflow.com/a/24996185
linked to: http://stackoverflow.com/q/2851938
tagged with: collections
has comment: http://stackoverflow.com/comment/38862975
type: AnsweredQuestion
tagged with: enums
has comment: http://stackoverflow.com/comment/38862846
tagged with: java
has answer: http://stackoverflow.com/a/24996301
has body: I have two EnumSets. EnumSet.of(A1, A2, A3); EnumSet.of(A3, A4, A5, A6); I want to find which values exist in both sets. (In that case, A3.) Is there any quick way to do that?
has comment: http://stackoverflow.com/comment/38862921
score: 9
type: Question
has answer: http://stackoverflow.com/a/24996191
accepted answer: http://stackoverflow.com/a/24996191
possible better answer: http://stackoverflow.com/a/24996203
duplicate of: http://stackoverflow.com/q/2851938
upvote count: 10
linked to: http://stackoverflow.com/q/7574311
downvote count: 1
has title: Check enumsets for same enum values
answer count: 4
favorite count: 0
tagged with: enumset

http://stackoverflow.com/comment/38997852
has text: Java*Script* applets?
score: 2
comment on: http://stackoverflow.com/q/25067336
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24975157
answers question: http://stackoverflow.com/q/24975079
score: 1
has comment: http://stackoverflow.com/comment/38823506
upvote count: 1
downvote count: 0
has body: Without running your code, my guess is that the jvm's "main" thread started the listeners but then didn't block, it exited the "main" method.
type: Answer

http://stackoverflow.com/a/25051603
answers question: http://stackoverflow.com/q/25000055
type: Answer
accepted answer of: http://stackoverflow.com/q/25000055
score: 0
has comment: http://stackoverflow.com/comment/56759425
has body: I got it working using HTTPClient API with NTLM credentials. DefaultHttpClient httpClient = new DefaultHttpClient(); HttpGet httpGetRequest = new HttpGet(fileUrl); org.apache.http.auth.Credentials credentials = new org.apache.http.auth.NTCredentials(username,password, workstation, domain); httpClient.getCredentialsProvider().setCredentials(SharePoint_URL, SharePoint_Port),credentials); HttpResponse response = httpClient.execute(httpGetRequest); StatusLine status = response.getStatusLine();
type: AcceptedAnswer

http://stackoverflow.com/comment/38850284
type: Comment
type: QuestionComment
score: 2
has text: can you please post code?
comment on: http://stackoverflow.com/q/24989280

http://stackoverflow.com/comment/38834801
type: QuestionComment
type: Comment
score: 2
has text: It's not `java.util.Integer` but `java.lang.Integer`.
comment on: http://stackoverflow.com/q/24981278

http://stackoverflow.com/q/24968466
has answer: http://stackoverflow.com/a/54318567
tagged with: secret-key
tagged with: aes
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/24968616
has comment: http://stackoverflow.com/comment/38811083
linked to: http://stackoverflow.com/q/9655181
type: Question
has comment: http://stackoverflow.com/comment/38811097
has title: How to use Cipher on this Method to decrypt a String?
has comment: http://stackoverflow.com/comment/38816715
linked to: http://stackoverflow.com/q/4551263
has comment: http://stackoverflow.com/comment/38810927
upvote count: 2
has body: Hello I build this 2 Methods the Encryption works fine but the Decryption get an error because cipher wants a byte and i want to encrypt from a String import javax.crypto.Cipher; import javax.crypto.spec.SecretKeySpec; public class Test { private byte[] encrypted; private String encryptedtext; private String decrypted; public String Encrypt (String pInput) { try { String Input = pInput; String key = "Bar12345Bar12345Bar12345Bar12345"; // Erstelle key and cipher SecretKeySpec aesKey = new SecretKeySpec(key.getBytes(), "AES"); Cipher cipher = Cipher.getInstance("AES"); // Verschlüsselung cipher.init(Cipher.ENCRYPT_MODE, aesKey); byte[] encrypted = cipher.doFinal(Input.getBytes()); encryptedtext = new String(encrypted); System.err.println("encrypted:" + encryptedtext); }catch(Exception e) { e.printStackTrace(); } return encrypted; } public String Decrypt (String pInput) { try { String Input = pInput; String key = "Bar12345Bar12345Bar12345Bar12345"; // Erstelle key and cipher SecretKeySpec aesKey = new SecretKeySpec(key.getBytes(), "AES"); Cipher cipher = Cipher.getInstance("AES"); // Entschlüsselung cipher.init(Cipher.DECRYPT_MODE, aesKey); decrypted = new String(cipher.doFinal(encryptedtext)); // HERE IS THE PROBLEM IT WANT BYTE BUT I WANT TO ENCRYPT FROM A STRING System.err.println("decrypted: " + decrypted); }catch(Exception e) { e.printStackTrace(); } return pInput; } }
answer count: 2
downvote count: 1
has comment: http://stackoverflow.com/comment/38811025
has comment: http://stackoverflow.com/comment/38811211
favorite count: 0
type: UnansweredQuestion
tagged with: encryption

http://stackoverflow.com/q/25038724
answer count: 2
accepted answer: http://stackoverflow.com/a/25039930
has comment: http://stackoverflow.com/comment/38943888
has title: How to simulate UDP with TCP in java?
linked to: http://stackoverflow.com/q/2607696
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38943399
possible better answer: http://stackoverflow.com/a/25039361
tagged with: java
has answer: http://stackoverflow.com/a/25039361
has comment: http://stackoverflow.com/comment/38943365
type: Question
has answer: http://stackoverflow.com/a/25039930
has body: I want to be able to have a TCP client send basic strings to be broadcast over UDP. I can't seem to find any resources on how to write UDP Datagrams into TCP or send messages over TCP that get intercepted and translated into UDP. Sender: import java.io.*; import java.net.*; public class MulticastSender { public static void main(String[] args) { DatagramSocket socket = null; DatagramPacket outPacket = null; byte[] outBuf; final int PORT = 8888; try { socket = new DatagramSocket(); long counter = 0; String msg; while (true) { msg = "This is multicast! " + counter; counter++; outBuf = msg.getBytes(); //Send to multicast IP address and port InetAddress address = InetAddress.getByName("224.2.2.3"); outPacket = new DatagramPacket(outBuf, outBuf.length, address, PORT); socket.send(outPacket); System.out.println("Server sends : " + msg); try { Thread.sleep(500); } catch (InterruptedException ie) { } } } catch (IOException ioe) { System.out.println(ioe); } } } Receiver: import java.io.*; import java.net.*; public class MulticastReceiver { public static void main(String[] args) { MulticastSocket socket = null; DatagramPacket inPacket = null; byte[] inBuf = new byte[256]; try { //Prepare to join multicast group socket = new MulticastSocket(8888); InetAddress address = InetAddress.getByName("224.2.2.3"); socket.joinGroup(address); while (true) { inPacket = new DatagramPacket(inBuf, inBuf.length); socket.receive(inPacket); String msg = new String(inBuf, 0, inPacket.getLength()); System.out.println("From " + inPacket.getAddress() + " Msg : " + msg); } } catch (IOException ioe) { System.out.println(ioe); } } } Is it possible for some way for a TCP client to write to a TCP socket opened on a server, and put the contents to be sent over listening UDP to a UDP client? (Such that a TCP client can send messages to UDP, and UDP messages can be listened to and send over the TCP connection)
score: 0

http://stackoverflow.com/comment/38733025
has text: So do u mean i have to specify `domainname.com` in facebook application and it will work for `www.domainname.com `
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24918827

http://stackoverflow.com/q/24932750
has title: how to write UTF8 data to xml file using RandomAccessFile?
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/38744131
type: Question
possible better answer: http://stackoverflow.com/a/24933144
has comment: http://stackoverflow.com/comment/38743829
has answer: http://stackoverflow.com/a/24933144
downvote count: 0
has answer: http://stackoverflow.com/a/24933143
tagged with: randomaccessfile
favorite count: 0
answer count: 3
accepted answer: http://stackoverflow.com/a/24933143
tagged with: utf-8
has body: When trying to write some UTF8 data to a file, I end up with some garbage in the file. The code is as follows public static boolean saveToFile(StringBuffer buffer, String fileName, ArrayList exceptionList, String className) { log.debug("In saveToFile for file [" + fileName + "]"); RandomAccessFile raf = null; File file = new File(fileName); File backupFile = new File(fileName+"_bck"); try { if (file.exists()) { if (backupFile.exists()) { backupFile.delete(); } file.renameTo(backupFile); } raf = new RandomAccessFile(file, "rw"); raf.writeBytes(buffer.toString()); raf.close(); The output of buffer.toString() is <?xml version="1.0" encoding="UTF-8"?> <ivr> 1.1 αβγδεζη The data in the file however is <?xml version="1.0" encoding="UTF-8"?> <ivr> 1.1 ▒▒▒▒▒▒▒ How can I make sure that data i nthe file itself is UTF8
has comment: http://stackoverflow.com/comment/38743838
upvote count: 1
has answer: http://stackoverflow.com/a/67963582
type: AnsweredQuestion

jsp
tags question: http://stackoverflow.com/q/24943584
tags question: http://stackoverflow.com/q/24992893
tags question: http://stackoverflow.com/q/24994351
tags question: http://stackoverflow.com/q/24963647
tags question: http://stackoverflow.com/q/24986352
tags question: http://stackoverflow.com/q/24990948
tags question: http://stackoverflow.com/q/25025057
tags question: http://stackoverflow.com/q/24937494
tags question: http://stackoverflow.com/q/25042247
tags question: http://stackoverflow.com/q/25050799
tags question: http://stackoverflow.com/q/24955808
tags question: http://stackoverflow.com/q/25067867
tags question: http://stackoverflow.com/q/24943304
tags question: http://stackoverflow.com/q/25055610
tags question: http://stackoverflow.com/q/24985479
tags question: http://stackoverflow.com/q/25051521
tags question: http://stackoverflow.com/q/24920665
tags question: http://stackoverflow.com/q/24941427
tags question: http://stackoverflow.com/q/25058763
tags question: http://stackoverflow.com/q/24934268
tags question: http://stackoverflow.com/q/24977797
tags question: http://stackoverflow.com/q/25000506
tags question: http://stackoverflow.com/q/24949338
tags question: http://stackoverflow.com/q/24931226
tags question: http://stackoverflow.com/q/24954345
tags question: http://stackoverflow.com/q/24963869
tags question: http://stackoverflow.com/q/25047015
tags question: http://stackoverflow.com/q/24991577
tags question: http://stackoverflow.com/q/24951179
tags question: http://stackoverflow.com/q/25030600
tags question: http://stackoverflow.com/q/25030123
tags question: http://stackoverflow.com/q/24998395
tags question: http://stackoverflow.com/q/24972559
tags question: http://stackoverflow.com/q/24910120
tags question: http://stackoverflow.com/q/24949704
tags question: http://stackoverflow.com/q/24951627
tags question: http://stackoverflow.com/q/24947312
type: Tag
tags question: http://stackoverflow.com/q/25011432
tags question: http://stackoverflow.com/q/25008841
tags question: http://stackoverflow.com/q/24950400
tags question: http://stackoverflow.com/q/25005294
tags question: http://stackoverflow.com/q/24912489
tags question: http://stackoverflow.com/q/24949018
tags question: http://stackoverflow.com/q/25027714
tags question: http://stackoverflow.com/q/24972100
tags question: http://stackoverflow.com/q/25039915
tags question: http://stackoverflow.com/q/25006815
tags question: http://stackoverflow.com/q/25006597
tags question: http://stackoverflow.com/q/25019265
tags question: http://stackoverflow.com/q/24937613
tags question: http://stackoverflow.com/q/25014625
tags question: http://stackoverflow.com/q/24938666
tags question: http://stackoverflow.com/q/25023909
tags question: http://stackoverflow.com/q/24959546
tags question: http://stackoverflow.com/q/24924542
tags question: http://stackoverflow.com/q/24921462
tags question: http://stackoverflow.com/q/24995208
tag name: jsp
tags question: http://stackoverflow.com/q/25030022
tags question: http://stackoverflow.com/q/25040076
tags question: http://stackoverflow.com/q/24939515
tags question: http://stackoverflow.com/q/25039387
tags question: http://stackoverflow.com/q/24934642
tags question: http://stackoverflow.com/q/24955350
tags question: http://stackoverflow.com/q/24932145
tags question: http://stackoverflow.com/q/25036929
tags question: http://stackoverflow.com/q/24936521
tags question: http://stackoverflow.com/q/24925328
tags question: http://stackoverflow.com/q/24936833
tags question: http://stackoverflow.com/q/24996806
tags question: http://stackoverflow.com/q/24952043
tags question: http://stackoverflow.com/q/24939581
tags question: http://stackoverflow.com/q/24953856
tags question: http://stackoverflow.com/q/25056207
tags question: http://stackoverflow.com/q/25028171
tags question: http://stackoverflow.com/q/24990105
tags question: http://stackoverflow.com/q/24939497
tags question: http://stackoverflow.com/q/24917240
tags question: http://stackoverflow.com/q/25033600

http://stackoverflow.com/q/24937118
type: AnsweredQuestion
score: -2
possible better answer: http://stackoverflow.com/a/24937459
accepted answer: http://stackoverflow.com/a/24937432
favorite count: 0
has body: i'm trying to print my data in database from jTable, for example in the column of name Jackson demarie Calvin Dkelein Tom Enderson but when i convert it to .pdf or print it, it become messy,because of the appearing of the unknown irregular spacing like this Jackson demarie Calvin Dkelein Tom Enderson here my code for inserting into database in server's side: public String insertPJG(String Nama_PJG,String Gugus)throws RemoteException { int rowsAffected=0; String sReturn="insert failed"; try { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); con=DriverManager.getConnection("jdbc:odbc:PKKP","",""); CallableStatement prepstmt = con.prepareCall("{call insertPJG(?,?)}"); prepstmt.setString(1, Nama_PJG); prepstmt.setString(2, Gugus); rowsAffected=prepstmt.executeUpdate(); if(rowsAffected&gt;0) { sReturn="insert success"; } } catch(Exception ex) { System.out.println("Error at insert :"+ex.getMessage()); } return sReturn; } and here my code for inserting into database in client's side: private void jAddActionPerformed(java.awt.event.ActionEvent evt) { try { server serv = (server)Naming.lookup("rmi://127.0.0.1/server"); //validasi String nama= JOptionPane.showInputDialog("Input Name").trim(); String Gugus= ""; while(flag) { if (!nama.equals("")) { Gugus=JOptionPane.showInputDialog("Input Gugus"); if (!Gugus.equals("")) { String insert=serv.insertPJG(nama, Gugus); System.out.println(insert); if(insert.equals("insert success")) { JOptionPane.showMessageDialog(null, "inserted"); } else { JOptionPane.showMessageDialog(null, "insert failed"); } flag= false; } else { JOptionPane.showConfirmDialog(this, "Please provide the Grup ", "input invalid", JOptionPane.CLOSED_OPTION); Gugus= JOptionPane.showInputDialog("Input Gugus"); } } else { JOptionPane.showConfirmDialog(this, "Please provide the Name ", "input invalid", JOptionPane.CLOSED_OPTION); nama= JOptionPane.showInputDialog("Input Name"); } } and this is my code for populating data from database into Jtable public Vector viewPJG() t…
has answer: http://stackoverflow.com/a/24937459
type: Question
answer count: 2
downvote count: 2
tagged with: java
has answer: http://stackoverflow.com/a/24937432
upvote count: 0
has title: how to Print Data from Database in jTable that contained a space

http://stackoverflow.com/q/25042689
type: Question
has body: I have made a simple Async Web Services with Jersey. In one API I want to use PhantomJs, so I try this code: First in my dao file: Book getBook() { DesiredCapabilities caps = new DesiredCapabilities(); caps.setJavascriptEnabled(true); caps.setCapability("takesScreenshot", false); caps.setCapability("phantomjs.page.settings.loadImages", false); caps.setCapability( PhantomJSDriverService.PHANTOMJS_EXECUTABLE_PATH_PROPERTY, "/home/carl/phantomjs/bin/phantomjs"); driver = new PhantomJSDriver(caps); // ....selenium code... } ListenableFuture&lt;Book&gt; getBookAsync(){ ListenableFuture&lt;Book&gt; future = service.submit(new Callable&lt;Book&gt;() { public Book call() throws Exception{ return getBook(); } }); return(future); } and in my Resource I have: @GET @Produces(MediaType.APPLICATION_JSON) @ManagedAsync public void getBook(@Suspended final AsyncResponse response){ ListenableFuture&lt;Book&gt; bookFuture = dao.getBookAsync(); Futures.addCallback(bookFuture, new FutureCallback&lt;Book&gt;() { public void onSuccess(Book book){ response.resume(book); } public void onFailure(Throwable thrown){ response.resume(thrown); } }); } Error: MessageBodyWriter not found for media type=text/html, type=class org.json.JSONObject, genericType=class org.json.JSONObject.
tagged with: phantomjs
has comment: http://stackoverflow.com/comment/38984412
has title: Error instance PhantomJS in Async Jersey
tagged with: jersey-2.0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38983107
tagged with: selenium-webdriver
answer count: 0
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/38954612

http://stackoverflow.com/comment/38806570
has text: " wouldn't I need to provide the URL somewhere in onPostExecute for that to happen" no, the URL should only be needed in `doInBackground()`.
type: AnswerComment
comment on: http://stackoverflow.com/a/24966030
score: 0
type: Comment

http://stackoverflow.com/q/24951497
has answer: http://stackoverflow.com/a/24951517
tagged with: android
has title: SQLiteAssetHelper extension returns null
type: UnansweredQuestion
upvote count: 1
downvote count: 1
has body: I'm getting a NullPointerException from my DatabaseHandler. Here is my DatabaseHandler: public class DatabaseHandler extends SQLiteAssetHelper { private static final int DATABASE_VERSION = 1; private static final String DATABASE_NAME = "carsGrid", TABLE_CARS = "cars ", KEY_ID = "id", KEY_POSTCODE = "postcode", KEY_ADDRESS = "address", KEY_IMAGE = "image"; public DatabaseHandler(Context context) { //super(context, DATABASE_NAME, null, DATABASE_VERSION); super(context, DATABASE_NAME, context.getExternalFilesDir(null).getAbsolutePath(), null, DATABASE_VERSION); } } MyActivity.java: Line which is reporting error: // Initiate Database DatabaseHandler db = new DatabaseHandler(this); // "this" refer to the context I have a feeling it's the context causing issues, but I'm not sure what the context should be. I have just changed from SQLiteOpenHelper Previous line with error: public DatabaseHandler(Context context) { //super(context, DATABASE_NAME, null, DATABASE_VERSION); super(context, DATABASE_NAME, context.getExternalFilesDir(null).getAbsolutePath(), null, DATABASE_VERSION); }
tagged with: java
type: Question
answer count: 1
favorite count: 0
score: 0

http://stackoverflow.com/q/24987587
tagged with: java
has answer: http://stackoverflow.com/a/24988272
tagged with: sharedpreferences
has title: Nullpointerexception when trying to use dynamically created imagebutton
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/38847367
favorite count: 0
tagged with: nullpointerexception
tagged with: android
has comment: http://stackoverflow.com/comment/38847641
has comment: http://stackoverflow.com/comment/38847410
type: UnansweredQuestion
score: 1
has comment: http://stackoverflow.com/comment/38847488
has comment: http://stackoverflow.com/comment/38847213
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/38847981
has body: I am making an app where the user can purchase buildings (imagebuttons) that use the drag and drop API. When a new buildings is purchased, the id of the building is stored using shared preferences so that when the app is opened back up, it is known that it was purchased and the coordinates are saved so the building can be loaded where it was left off. My issue right now is that before a building is created, the ID is null, so I get a nullpointerexception because it knows that it is null. I will post the code and the logcat so you see my problem. Here is the code checking if the building exists or not: prefs = getSharedPreferences("Buildings", MODE_PRIVATE); newColonyHutID = prefs.getInt("NewColonyHut", 0); if (newColonyHutID != 0) { prefs = getSharedPreferences("Coordinates", MODE_PRIVATE); colonyHutX = prefs.getInt("ColonyHutX", 0); colonyHutY = prefs.getInt("ColonyHutY", 0); Toast.makeText(getApplicationContext(), "X: " + colonyHutX + " Y: " + colonyHutY, Toast.LENGTH_SHORT).show(); newColonyHutFrame = (FrameLayout) findViewById(R.id.bottomHalf); newColonyHut = new ImageButton(runGraphics.this); newColonyHut.setBackgroundResource(R.drawable.mainhut); newColonyHut.setX(colonyHutX); newColonyHut.setY(colonyHutY); newColonyHut.setTag("NewColonyHut"); newColonyHut.setOnTouchListener(new BuildingsClick()); findViewById(R.id.topHalf).setOnDragListener(new ColonyHutDrag(getApplicationContext())); findViewById(R.id.bottomHalf).setOnDragListener(new ColonyHutDrag(getApplicationContext())); FrameLayout.LayoutParams param1 = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.WRAP_CONTENT, FrameLayout.LayoutParams.WRAP_CONTENT); newColonyHutFrame.addView(newColonyHut, param1); }//end if Here is the code where the building is created and the id is saved: newColonyHutFrame = (FrameLayout) findViewById(R.id.bottomHalf); newColonyHut = new ImageButton(runGraphics.this); newColonyHut.setBackgroundResource(R.drawable.mainhut); prefs = getSharedPreferences("Buildings", MODE_PRIVA…

http://stackoverflow.com/a/24949609
has comment: http://stackoverflow.com/comment/38824855
downvote count: 2
answers question: http://stackoverflow.com/q/24922294
has body: I am not sure but I think that's problem with 'detached' objects. Look at this link http://www.objectdb.com/java/jpa/persistence/detach
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/136519340
accepted answer of: http://stackoverflow.com/q/24922294
has comment: http://stackoverflow.com/comment/38776112
upvote count: 2
score: 0

http://stackoverflow.com/q/24935888
has answer: http://stackoverflow.com/a/24936006
tagged with: setter
possible better answer: http://stackoverflow.com/a/24936076
tagged with: getter
has comment: http://stackoverflow.com/comment/38749751
has answer: http://stackoverflow.com/a/24936076
answer count: 3
tagged with: junit
downvote count: 0
has comment: http://stackoverflow.com/comment/38749632
favorite count: 0
has answer: http://stackoverflow.com/a/24936039
has comment: http://stackoverflow.com/comment/38749770
type: AnsweredQuestion
has body: I have a class that will have these methods. In future there will be a method that sets email and password variables. But these variables would never be able for setup from outside of the class. How to test these methods? public class Auth { private String email; private String password; public String getEmail(){ return this.email; } public String getPassword(){ return this.password; } }
score: 1
tagged with: java
upvote count: 1
accepted answer: http://stackoverflow.com/a/24936039
has title: How to test Java getter methods
type: Question

http://stackoverflow.com/q/24917917
has comment: http://stackoverflow.com/comment/38716478
accepted answer: http://stackoverflow.com/a/24918129
score: 4
upvote count: 4
answer count: 3
tagged with: sql
downvote count: 0
has comment: http://stackoverflow.com/comment/38716633
has body: I have a Java-code: String searchPerson = "select * from persons where surname like ? and name like ?"; //connect to DB PreparedStatement statement = connect.prepareStatement(searchPerson); statement.setString(1,"%"+ surname + "%"); statement.setString(2, "%" + name + "%"); ResultSet resultPerson = statement.executeQuery(searchPerson); //..code Then I have SQLException: 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 '?'
favorite count: 0
tagged with: jdbc
has comment: http://stackoverflow.com/comment/38716316
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24918011
has title: right syntax to use near '?'
has comment: http://stackoverflow.com/comment/38716735
tagged with: java
possible better answer: http://stackoverflow.com/a/40806900
tagged with: mysql
has answer: http://stackoverflow.com/a/40806900
tagged with: prepared-statement
has answer: http://stackoverflow.com/a/24918129
type: Question

http://stackoverflow.com/a/25032457
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/25031414
upvote count: 1
has body: Welcome to the wonders of floating point arithmetic. The implementation of Math.pow may vary. If you change the Java code to static long power(int b,int i){ long num; if(i==1) return b; else if(i%2==0){ long p = power(b,i/2); double dp = (double)p; num=(long)(dp*dp); if(num&gt;=1000000007) num%=1000000007; return num; } else { long p = power(b,i/2); double dp = (double)p; num=(long)(b*dp*dp); num=(long)(b*Math.pow(power(b,(i-1)/2),2)); if(num&gt;=1000000007) num%=1000000007; return num; } } the results are 646458262 477022294 which shows that C++ appears to handle integer powers differently, in comparison to Math.pow( double base, double exp ); It's impossible to discuss such issues without reading the source code of Math.pow and the pow function in the C++ library.

http://stackoverflow.com/comment/38704007
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24911306
has text: Post the entire code? And please make sure MyEvent is never null at the point of calling onMyEvent(MyEvent) function.

http://stackoverflow.com/q/25002954
has comment: http://stackoverflow.com/comment/38879196
has body: This is the constructor for the JDialog View in question: import javax.swing.JButton; import javax.swing.JDialog; import javax.swing.JPanel; import javax.swing.border.EmptyBorder; public class AjoutPatient extends JDialog { private static final long serialVersionUID = 1L; private ControleurAjout ajoutControleur; private JPanel contentPane; private JPanel buttonPane; private JButton ajouterButton; private JButton annulerButton; AjoutPatient() { init(); //Creation du controleur ajoutControleur = new ControleurAjout(this); //Ajout de listeners sur les composantes ajouterButton.addActionListener(ajoutControleur); annulerButton.addActionListener(ajoutControleur); //Reglage de visibilite et modal setModal(true); setVisible(true); } private void init(){ setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); setTitle("Test JDialog"); //Ajout panel principal contentPane = new JPanel(); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); setContentPane(contentPane); contentPane.setLayout(null); //Panel des bouton ajouter et annuler buttonPane = new JPanel(); buttonPane.setBounds(5, 322, 304, 42); contentPane.add(buttonPane); buttonPane.setLayout(null); //Boutons ajouter et annuler ajouterButton = new JButton("Ajouter"); ajouterButton.setBounds(130, 11, 81, 23); buttonPane.add(ajouterButton); annulerButton = new JButton("Annuler"); annulerButton.setBounds(213, 11, 81, 23); buttonPane.add(annulerButton); } /* * Getters */ public JButton getAjouterButton(){ return ajouterButton; } public JButton getAnnulerButton(){ return annulerButton; } } Then the JDialog controller: import java.awt.event.ActionEvent; import java.awt.event.ActionListener; public class ControleurAjout implements ActionListener { private AjoutPatient vue; ControleurAjout(AjoutPatient ajout){ vue = ajout; } public void actionPerformed(ActionEvent e) { if(e.getSource() == vue.getAjouterButton()){ vue.dispose(); } }else if(e.getSource() == vue.getAnnulerButton()){ vue.dispose(); } } public JButton getAjouterButton(){ …
tagged with: swing
tagged with: jbutton
tagged with: model-view-controller
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25003668
has title: How come the JButton in my JDialog are not working? Fixed
has comment: http://stackoverflow.com/comment/38876059
tagged with: java
has comment: http://stackoverflow.com/comment/38880177
tagged with: mouseevent
type: Question
has comment: http://stackoverflow.com/comment/38876714
has comment: http://stackoverflow.com/comment/38879047
has comment: http://stackoverflow.com/comment/38881716
accepted answer: http://stackoverflow.com/a/25003668
score: 0
has comment: http://stackoverflow.com/comment/38882215
answer count: 1

osx-mavericks
tags question: http://stackoverflow.com/q/25039156
type: Tag
tags question: http://stackoverflow.com/q/24913114
tag name: osx-mavericks
tags question: http://stackoverflow.com/q/25028314

http://stackoverflow.com/q/24960280
downvote count: 0
has comment: http://stackoverflow.com/comment/38796284
has body: I am having issues where I'm getting various errors when trying to use the Stanford Core NLP tools. My aim is to have a pipeline running on a server similar to here so that I can make requests as needed from another program and don't have to wait for the models to be reloaded each time (which takes ~20 seconds). However I've not been able to get the tools to work either when running my own code from Netbeans with the needed jars added to the classpath, or when running code such as the server above and setting the classpath to the jars on the command line. I've been trying to get this to work for days and really don't know why it's not working. I've tried doing exactly as the top answer states at Error in stanford nlp core, using exactly the same sample code and adding the same jars to the classpath (except using the jars from a more recent version of the tools). The only difference I can see between mine and theirs is that I'm using Linux and Netbeans rather that Windows and Eclipse, but I don't see why that would make a difference? I get this error message: Exception in thread "main" java.lang.RuntimeException: edu.stanford.nlp.io.RuntimeIOException: Unrecoverable error while loading a tagger model when trying to run this code. I've also tried setting the models explicitly when trying to run the tools in a servlet on Tomcat, however I then get a ClassNotFoundException for nu.xom.node when trying to make a request to the servlet - however xom.jar is on the classpath. Thanks for any help, I can give more detail about anything if needed, I tried to give links to the code and error messages but apparently can't put more than two in a post. Update: Stacktrace when running code as in second link above: Exception in thread "main" java.lang.RuntimeException: edu.stanford.nlp.io.RuntimeIOException: Unrecoverable error while loading a tagger model at edu.stanford.nlp.pipeline.StanfordCoreNLP$4.create(StanfordCoreNLP.java:558) at edu.stanford.nlp.pipeline.AnnotatorPool.get(An…
has comment: http://stackoverflow.com/comment/38797395
has comment: http://stackoverflow.com/comment/38796017
favorite count: 0
answer count: 0
type: UnansweredQuestion
upvote count: 1
has comment: http://stackoverflow.com/comment/38796364
linked to: http://stackoverflow.com/q/9528080
has comment: http://stackoverflow.com/comment/38796538
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/38796509
tagged with: classpath
type: Question
has title: Getting errors in Java when trying to use Stanford Core NLP tools
tagged with: stanford-nlp

http://stackoverflow.com/comment/38968121
has text: Obviously, it does. I have another program ready and executed which copies from the same table and inserts into oracle. No issues there. But there, i already know the column names. Here, i need to store the column names beforehand. Lastly, I can assure you that Oracle has the data.
comment on: http://stackoverflow.com/q/25051827
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38810636
type: Comment
type: QuestionComment
has text: try providing JRE Location with the command `./runInstaller -jreLoc JRE_LOCATION` as mentioned here http://docs.oracle.com/cd/E17904_01/doc.1111/e15017/install_osb.htm Also, share the values of your PATH and JAVA_HOME. Just run `echo %JAVA_HOME%` and `echo %PATH%` from a newly opened command prompt
comment on: http://stackoverflow.com/q/24968031
score: 0

checkstyle
tags question: http://stackoverflow.com/q/24988640
tags question: http://stackoverflow.com/q/24910515
type: Tag
tags question: http://stackoverflow.com/q/24924093
tag name: checkstyle

http://stackoverflow.com/comment/38775608
has text: Of course, this is only a solution if you're using Windows. Still +1
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24949178

http://stackoverflow.com/comment/38949308
has text: Hello thank you for reply. i want to display an image which is having same name as values in status Jlabel. For example if status has a value "America" i want to display an image E:/America.png. But If i use status.getText() it returning name of status Jlabel not the value in status JLabel.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25041861
score: 0

http://stackoverflow.com/a/24924714
downvote count: 0
has comment: http://stackoverflow.com/comment/38728786
upvote count: 2
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/38728826
has body: You have to use a generic type with iterable (Integer in your case) public class Counter implements Iterable&lt;Integer&gt; { ... }
has comment: http://stackoverflow.com/comment/38728797
answers question: http://stackoverflow.com/q/24924689

jvm
tags question: http://stackoverflow.com/q/25028314
tags question: http://stackoverflow.com/q/25009717
tags question: http://stackoverflow.com/q/25031528
tags question: http://stackoverflow.com/q/25060045
tags question: http://stackoverflow.com/q/24997639
tags question: http://stackoverflow.com/q/24971977
type: Tag
tags question: http://stackoverflow.com/q/24913114
tags question: http://stackoverflow.com/q/24995291
tags question: http://stackoverflow.com/q/24962250
tags question: http://stackoverflow.com/q/25030212
tags question: http://stackoverflow.com/q/24960771
tags question: http://stackoverflow.com/q/24918252
tags question: http://stackoverflow.com/q/24943859
tag name: jvm
tags question: http://stackoverflow.com/q/24947001
tags question: http://stackoverflow.com/q/24974526
tags question: http://stackoverflow.com/q/24914035
tags question: http://stackoverflow.com/q/24962609
tags question: http://stackoverflow.com/q/25015338
tags question: http://stackoverflow.com/q/24996509
tags question: http://stackoverflow.com/q/24993790
tags question: http://stackoverflow.com/q/25010288

http://stackoverflow.com/comment/38894308
type: QuestionComment
has text: I would agree with @Stefan Beike here. I don't know the actual size of your `ArrayList` but if it's big enough it makes a great difference checking if it contains each element.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25012524

http://stackoverflow.com/comment/38767906
type: Comment
has text: @SpiderPig just out of curiosity is this possible to do with selection sort? if so i will try to solve it my self for practice.
type: QuestionComment
comment on: http://stackoverflow.com/q/24944844
score: 0

http://stackoverflow.com/comment/39002826
type: AnswerComment
type: Comment
has text: Wait.. Now its giving me a different error. I still have reservation_number but it's failing at ` List<CardDetails> cardDetailsList = query.list();`
score: 0
comment on: http://stackoverflow.com/a/25068215

http://stackoverflow.com/comment/38788901
has text: @markspace Sanitized means I'm passing it to the Markdown.getSanitizingConverter() instance, which simply removes any html tags not on the whitelist. It's more complicated than that though, as it does **not** strip html tags that are inside a code block, which is what I need. This makes it difficult to use a Java solution, as they all seem to be all-or-nothing instead of the selective sanitation that respects the code blocks.
comment on: http://stackoverflow.com/q/24946092
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24951321
type: UnansweredQuestion
tagged with: pdf-generation
tagged with: adobe
has comment: http://stackoverflow.com/comment/38780593
answer count: 0
has body: I am using itext pdf version 5.3.4. Until recent the code worked ok but the client needed some modifications and now when opening the generated pdf the following error is shown " "An error exists on this page. Acrobat may not display the page correctly. please contact the person who created the pdf document to correct the problem". I will put below the piece of code where i think the error is and also explain it a little bit. Basically i have a collection of rows that i am iterating and i want the content to be shown toghether (that's why i am using generalTable variable). Below is the code and if i can give you anymore details please let me know : PdfPTable generalTable = new PdfPTable(2); generalTable.setKeepTogether(true); generalTable.setWidthPercentage(100); Iterator rows = objects.iterator(); String ratingCellText = ""; while (rows.hasNext()) { SupplierSearchRecord rec = (SupplierSearchRecord)rows.next(); if (rec.getMgID() == mgVO.getId() &amp;&amp; rec.getGaID() == gzVO.getId()) { String cellText = ""; if (company != rec.getCompanyId()) { if (ratingCellText.length() &gt; 0) { PdfPCell myCell1 = PdfUtil.makeCell(simpleFont, PdfUtil.getText(ratingCellText)); myCell1.setBorder(Rectangle.TOP); myCell1.setColspan(2); generalTable.addCell(myCell1); ratingCellText = ""; } generalTable.addCell(PdfUtil.makeCell(simpleFont, PdfUtil.getText("\n\n" + rec.getCompanyTitle()))); String duns = "\n\n" + ((isNotEmpty(rec.getCompanyDuns()))?txtUtil.msg("optioncompanyDuns")+": ":"") + PdfUtil.getText(rec.getCompanyDuns()) ; generalTable.addCell(PdfUtil.makeCell(simpleFont, duns)); String tel = ((isNotEmpty(rec.getCompanyPhone1()))?" Tel: ":"") + PdfUtil.getText(rec.getCompanyPhone1()) + ((isNotEmpty(rec.getCompanyPhone1()))?", ":"") ; String fax = ((isNotEmpty(rec.getCompanyFax()))?"Fax: ":"") + PdfUtil.getText(rec.getCompanyFax()) + ((isNotEmpty(rec.getCompanyFax()))?", ":"") ; String homePage = ((isNotEmpty(rec.getCompanyInternetAddress()))?txtUtil.msg("optioncompanyInternetAd…
tagged with: java
tagged with: itext
type: Question
has comment: http://stackoverflow.com/comment/38779762
has comment: http://stackoverflow.com/comment/38779169
score: 0
has comment: http://stackoverflow.com/comment/38780081
tagged with: http://stackoverflow.com/tag/pdf
has comment: http://stackoverflow.com/comment/38780345
has comment: http://stackoverflow.com/comment/38780241
has title: Itext generated pdf throws error at opening

http://stackoverflow.com/comment/38820346
type: QuestionComment
has text: Oh,SORRY,I am too late to comment.SORRY @hkais.
comment on: http://stackoverflow.com/q/24973381
score: 0
type: Comment

http://stackoverflow.com/comment/38994331
comment on: http://stackoverflow.com/a/25063225
type: Comment
has text: @Marco - Allow me to clarify in the answer (I'm clearly not doing a good enough job as-is)
score: 0
type: AnswerComment

http://stackoverflow.com/a/24910453
score: 2
upvote count: 2
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24910276
answers question: http://stackoverflow.com/q/24910276
type: Answer
has body: I would process each RGB component separately. You can parse the hex into a number using Long.valueOf(). Average your two values (rounding as needed) and then going to back to hex using Long.toString() padding out to two digits. Some example code that I havn't tested: String colour1 = "#FFFFFF"; String colour2 = "#000000"; StringBuilder result = new StringBuilder("#"); for (int i=0;i&lt;3;i++) { String h1 = colour1.substring(i*2+1, 3+(i*2)); String h2 = colour2.substring(i*2+1, 3+(i*2)); long l1 = Long.parseLong(h1, 16); long l2 = Long.parseLong(h2, 16); long mid = (l1 + l2) / 2; //truncating not rounding String midStr = Long.toString(mid, 16); if (midStr.length() == 1) { result.append("0"); } result.append(midStr.toUpperCase()); }

http://stackoverflow.com/q/24997927
type: AnsweredQuestion
upvote count: 0
tagged with: compiler-errors
tagged with: java
linked to: http://stackoverflow.com/q/4732544
type: Question
accepted answer: http://stackoverflow.com/a/24998226
score: -1
has answer: http://stackoverflow.com/a/24998226
has comment: http://stackoverflow.com/comment/38866524
answer count: 1
duplicate of: http://stackoverflow.com/q/4732544
downvote count: 1
has title: How do I get the program to compile?
tagged with: calculator
favorite count: 0
has comment: http://stackoverflow.com/comment/38866140
has body: I am trying to add an ActionListener to one of the buttons in my Java program, but its method causes an error to occur. This is my code : import javax.swing.*;//import the packages needed for gui import java.awt.*; import java.awt.event.*; public class Calculator { public static void main(String[] args) { JFrame window = new JFrame("Window");// makes a JFrame window.setSize(300, 350); window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JPanel panel = new JPanel(new FlowLayout());// makes the panel, // textfield and buttons JTextField textField = new JTextField(20); JButton openbracket = new JButton("("); JButton closebracket = new JButton(")"); JButton clearbutton = new JButton("C"); JButton arcsin = new JButton("arcsin"); JButton arccos = new JButton("arccos"); JButton arctan = new JButton("arctan"); JButton sin = new JButton("sin"); JButton cos = new JButton("cos"); JButton tan = new JButton("tan"); JButton log = new JButton("log"); JButton seven = new JButton("7"); JButton eight = new JButton("8"); JButton nine = new JButton("9"); JButton four = new JButton("4"); JButton five = new JButton("5"); JButton six = new JButton("6"); JButton one = new JButton("1"); JButton two = new JButton("2"); JButton three = new JButton("3"); JButton zero = new JButton("0"); JButton radixpoint = new JButton("."); JButton equal = new JButton("="); String values = null; class Listener implements ActionListener { public void actionPerformed(ActionEvent e) { values = values + "3"; textField.setText(values); } } panel.add(textField);// adding all the things window.add(panel); panel.add(openbracket); panel.add(closebracket); panel.add(clearbutton); panel.add(arcsin); panel.add(arccos); panel.add(arctan); panel.add(sin); panel.add(cos); panel.add(tan); panel.add(log); panel.add(nine); panel.add(eight); panel.add(seven); panel.add(six); panel.add(five); panel.add(four); panel.add(three); panel.add(two); panel.add(one); panel.add(zero); panel.add(radixpoint); panel.add(equal); window.setV…
has comment: http://stackoverflow.com/comment/38866578

http://stackoverflow.com/q/24987451
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/38847073
has body: I'm working on an application for Android and I'm having an AsyncTask connect to a server through a client socket in the doInBackground method. All variables that are being used have been set and I have checked in real time that they are valid before being used. The weird thing is that after trying to create the socket with the designated host/port, it immediately throws an IOException, which in itself is not a problem :P but the value ex is null. I have never seen anything like this and I found some similar cases on google, but none of them yielded a solution. The code that is throwing the exception,as well as the catch block: @Override protected Socket doInBackground(Void... params) { Socket sock = null; try { sock = new Socket("10.0.0.86", 44444); } catch (UnknownHostException ex) { ex.printStackTrace(); } catch(IOException ex) { ex.printStackTrace(); } return sock; } The rest of the code is nothing of help, it's just some getter/setters. Here's the log from the android device: 07-28 03:30:23.438 9514-9514/com.TestApplication.VEStudio.TestApplication I/System.out﹕ Sending WAIT chunk 07-28 03:30:23.438 9514-9520/com.TestApplication.VEStudio.TestApplication I/dalvikvm﹕ Debugger is active 07-28 03:30:23.438 9514-9514/com.TestApplication.VEStudio.TestApplication W/ActivityThread﹕ Application com.TestApplication.VEStudio.TestApplication is waiting for the debugger on port 8100... 07-28 03:30:23.638 9514-9514/com.TestApplication.VEStudio.TestApplication I/System.out﹕ Debugger has connected 07-28 03:30:23.638 9514-9514/com.TestApplication.VEStudio.TestApplication I/System.out﹕ waiting for debugger to settle... 07-28 03:30:23.838 9514-9514/com.TestApplication.VEStudio.TestApplication I/System.out﹕ waiting for debugger to settle... 07-28 03:30:24.038 9514-9514/com.TestApplication.VEStudio.TestApplication I/System.out﹕ waiting for debugger to settle... 07-28 03:30:24.238 9514-9514/com.TestApplication.VEStudio.TestApplication I/System.out﹕ waiting for debugger to settle... …
linked to: http://stackoverflow.com/q/8996957
tagged with: nullpointerexception
has comment: http://stackoverflow.com/comment/38847026
downvote count: 0
score: 1
favorite count: 0
tagged with: android-asynctask
has title: Android IOException is null, Throwing NullPointerException
has comment: http://stackoverflow.com/comment/38849112
has comment: http://stackoverflow.com/comment/38847117
has comment: http://stackoverflow.com/comment/38862586
tagged with: exception
type: UnansweredQuestion
tagged with: android
answer count: 0
tagged with: java

http://stackoverflow.com/comment/38982371
type: QuestionComment
comment on: http://stackoverflow.com/q/25059378
score: 0
has text: @Zhuinden I tried your suggestion, unfortuantely, `HashMap` is still underscored with the red squiggle and eclipse says: `The type HashMap is not generic; it cannot be parameterized with arguments <String, Integer>`
type: Comment

http://stackoverflow.com/a/25004446
has comment: http://stackoverflow.com/comment/38880607
score: 4
has body: If sounds like you want to use a TreeMap, where the key is the bottom of the range, and the value is the Range object. Then to identify the correct range, just use the floorEntry() method to very quickly get the closest (lesser or equal) Range, which should contain the key, like so: TreeMap&lt;Integer, Range&gt; map = new TreeMap&lt;&gt;(); map.put(1, new Range(1, 10)); map.put(11, new Range(11, 30)); map.put(31, new Range(31, 100)); // int key = 0; // null // int key = 1; // Range [start=1, end=10] // int key = 11; // Range [start=11, end=30] // int key = 21; // Range [start=11, end=30] // int key = 31; // Range [start=31, end=100] // int key = 41; // Range [start=31, end=100] int key = 101; // Range [start=31, end=100] // etc. Range r = null; Map.Entry&lt;Integer, Range&gt; m = map.floorEntry(key); if (m != null) { r = m.getValue(); } System.out.println(r); Since the tree is always sorted by the natural ordering of the bottom range boundary, all your searches will be at worst O(log(n)). You'll want to add some sanity checking for when your key is completely out of bounds (for instance, when they key is beyond the end of the map, it returns the last Range in the map), but this should give you an idea how to proceed.
has comment: http://stackoverflow.com/comment/38879625
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38879599
accepted answer of: http://stackoverflow.com/q/25003953
type: Answer
answers question: http://stackoverflow.com/q/25003953
upvote count: 4
downvote count: 0

http://stackoverflow.com/a/25007741
has comment: http://stackoverflow.com/comment/38913397
upvote count: 1
has comment: http://stackoverflow.com/comment/38915117
has comment: http://stackoverflow.com/comment/38913447
has comment: http://stackoverflow.com/comment/38905795
type: Answer
has comment: http://stackoverflow.com/comment/38915593
downvote count: 0
has comment: http://stackoverflow.com/comment/38915231
score: 1
answers question: http://stackoverflow.com/q/25006431
has body: Valid JSON (I think): [{"name" : "Zone1", "types" : ["datatype":"string","value":"int","url":"string"], "data" : "gucci",2,"www.whoami12345.com"}, {"name" : "Zone2", "types" : ["datatype":"string","value":"int","url":"string"], "data" : "nike", 23,"www.nike.com"} ] Nope -- wrong missing "object" brackets Try again: [{"name" : "Zone1", "types" : [{"datatype":"string","value":"int","url":"string"}], "data" : "gucci",2,"www.whoami12345.com"}, {"name" : "Zone2", "types" : [{"datatype":"string","value":"int","url":"string"}], "data" : "nike", 23,"www.nike.com"} ] Ah!! Much better!
has comment: http://stackoverflow.com/comment/38900743
has comment: http://stackoverflow.com/comment/38914427
has comment: http://stackoverflow.com/comment/38914567
has comment: http://stackoverflow.com/comment/38905699

http://stackoverflow.com/comment/38880795
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25002819
has text: Which version of Java are you using? Is your server set up with Server Name Indication (SNI)? Is it initial client cert authentication, or is it done via renegotiation? What happens when you connect with `openssl s_client -connect your.server.name:443`? Do the name in the server certificate match what you would expect? Do you get to see the list of CA certificates advertised? Could you put the relevant fragment of code in your question so that we know what you're talking about?
score: 0

http://stackoverflow.com/comment/38989377
has text: The problem ended up being a threading issue, and while the actual fix is going to be much more complicated, this was a step in the right direction. I want to wait on the dialogue to complete before taking any additional action, but invokeAndWait causes a deadlock. Going to accept this answer anyways since it solved the question I asked (how to prevent the dialog from freezing the program).
comment on: http://stackoverflow.com/a/25045542
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/25014080
upvote count: 2
accepted answer of: http://stackoverflow.com/q/25014003
type: AcceptedAnswer
downvote count: 0
has body: Netbeans 6.9.1 is not working on windows 8.1 You must have JDK 6.0 on your system to install and run NetBeans IDE 6.9.1. Source NetBeans IDE 6.9.1 Release Notes. To make Netbeans run on JDK 6, if you have more than one JDK do this: You can change the JDK for Netbeans by modifying the config file: Open netbeans.conf file available under etc folder inside the NetBeans installation. Modify the netbeans_jdkhome variable to point to new JDK path, and then Restart your Netbeans. Sample # Default location of JDK, can be overridden by using --jdkhome &lt;dir&gt;: #netbeans_jdkhome="C:\Program Files\Java\jdk1.8.0_45" netbeans_jdkhome="C:\Program Files\Java\jdk1.6.0_45"
answers question: http://stackoverflow.com/q/25014003
has comment: http://stackoverflow.com/comment/38898381
type: Answer
score: 2

http://stackoverflow.com/comment/38990330
score: 6
has text: sounds like you're out of luck, use a better mail sender
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25063653

http://stackoverflow.com/q/25049303
favorite count: 0
has title: FileRead in java with a >32 bit offset
accepted answer: http://stackoverflow.com/a/25049360
has comment: http://stackoverflow.com/comment/38964161
upvote count: 1
type: Question
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25049360
score: 1
tagged with: java
tagged with: inputstream
downvote count: 0
answer count: 1
has body: Both InputStream and FileReader in java the maximum offset value is (I assume) that of the max value of a signed 32bit int. But what If I'm trying to read contents beyond this 8GB limit?

http://stackoverflow.com/a/25010514
score: 1
accepted answer of: http://stackoverflow.com/q/24975343
answers question: http://stackoverflow.com/q/24975343
type: AcceptedAnswer
downvote count: 0
has body: I managed to figure out the problem here, finally. The public interface also needs to reference the server IP, not 127.0.1.1. The updated interface configuration is: <inet-address value="178.62.50.xxx"/> <inet-address value="178.62.50.xxx"/> <inet-address value="${jboss.bind.address.unsecure:127.0.1.1}"/>
type: Answer
upvote count: 1

http://stackoverflow.com/q/25008841
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25009553
tagged with: http://stackoverflow.com/tag/xml
has body: I am using Struts 1.x and jsp as view to display. Want to display the entire xml file as it is in a new pop-up window when a link is clicked in jsp. So far I have managed to open the pop-up window but I get a blank window and save/open/cancel links in browser(IE9). When clicking on save I get as 'url.do' but I just want to display the xml content as it is in browser, just don't want to save. Here is what I wrote in javascript function function viewXML(bcFileNo){ popupwin = window.open("about:blank", "popupwin", "toolbar=no, resizable=yes, menubar=no, scrollbars=yes, status=no, location=no, width=900 , height=400"); var form = document.forms['BirthCertificateForm']; form.action = "/Vista-Web/birthCertificateOverview.do?method=viewBirthCertificateDetails&amp;bCertFileNo="+bcFileNo; form.target = "popupwin"; form.submit(); form.target = "_self"; } Here is what I wrote in Action class String xmlContent = getXMLContent(); byte[] birthCertBytes = xmlContent.getBytes(); // set xml content response.setContentType("html/xml"); // write the content to the output stream BufferedOutputStream outStream = new BufferedOutputStream(response.getOutputStream()); outStream.write(birthCertBytes); outStream.flush(); outStream.close();
score: 0
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/5278975
tagged with: javascript
has answer: http://stackoverflow.com/a/25018421
tagged with: struts
has title: display raw xml in popup window using java when a link is clicked
answer count: 3
tagged with: jsp
has answer: http://stackoverflow.com/a/25009249

http://stackoverflow.com/q/25030022
favorite count: 0
has answer: http://stackoverflow.com/a/25039295
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/25040937
possible better answer: http://stackoverflow.com/a/25039295
upvote count: 3
tagged with: java
accepted answer: http://stackoverflow.com/a/25040937
tagged with: weblogic
has title: How to get the list of jms queues from Summary of Resources table of jms module in weblogic?
tagged with: jsp
type: AnsweredQuestion
score: 3
has body: I need to print the list of jms queues of the jms module. I use this code to look up the needed queue and get parameters but how to get the names of all queues and print them? Properties env = new Properties(); env.put(Context.PROVIDER_URL, "host:port"); env.put(Context.SECURITY_PRINCIPAL, "username"); env.put(Context.SECURITY_CREDENTIALS, "password"); env.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory"); InitialContext ctx = new InitialContext(env); Destination queue = (Destination) ctx.lookup("jms_queue"); JMSDestinationRuntimeMBean destMBean = JMSRuntimeHelper.getJMSDestinationRuntimeMBean(ctx, queue); out.println("count: " + destMBean.getMessagesCurrentCount());
downvote count: 0

http://stackoverflow.com/a/25073824
type: Answer
has body: Without exact source code to reproduce the problem it is obviously impossible to pinpoint the problem. But your diff shows, that you changed the way lists get processed. You also mention that a lot of simple math, like addition happens inside your application. Therefor my guess is that by the changes to the list you change the order in which stuff gets processed, which may be enough to change rounding errors. And yes, nothing should ever rely on the least significant bits of floating point variables, so the tests should need epsilons.
has comment: http://stackoverflow.com/comment/39009461
downvote count: 2
upvote count: 0
score: -2
answers question: http://stackoverflow.com/q/25047290

http://stackoverflow.com/comment/38775641
has text: @visakh_vijay[refer to this it will help](http://stackoverflow.com/questions/24848314/change-background-color-of-jtable-row-based-on-column-value/24849600#24849600)
comment on: http://stackoverflow.com/a/24948557
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/38774793
comment on: http://stackoverflow.com/q/24948791
score: 3
has text: Using `wait()/notify()` would be advantageous because once you `notify()`, (one of the) waiting threads are notified and starts execution. i.e, the thread from which `notify()` was called will not continue. In case you busy wait, even if the second thread sets the boolean flag on which the first thread is waiting, the second thread still executes until its time slice is complete and then the first thread starts. @others, please correct me if I am wrong..
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24921706
downvote count: 1
type: Question
has title: I dont know how can use this regex in java
has answer: http://stackoverflow.com/a/24921894
score: 0
answer count: 1
favorite count: 0
tagged with: android
has body: I have the next regex, that works when I test online in: http://www.regexr.com/ but not works on my java project: (?:function jo|[{;]jo\s*=\s*function)\((.*?[a-z,]+)\){(.*?[^}]+)} My code: Pattern p2 = Pattern.compile("(?:function "+funcname+"|[{;]"+funcname+"\\s*=\\s*function)\\((.*?[a-z,]+)\\){(.*?[^}]+)}"); My error: 07-23 23:43:17.608: E/AndroidRuntime(1724): (?:function jo|[{;]jo\s*=\s*function)\((.*?[a-z,]+)\){(.*?[^}]+)} 07-23 23:43:17.608: E/AndroidRuntime(1724): ^ My example test string: {return a.reverse()}};function jo(a){a=a.split("");a=io.aS(a,53);a=io.Y7(a,19);a=io.aS(a,9);a=io.km(a,2);a=io.Y7(a,29);a=io.km(a,1);return a.join("")};function ko(){};var lo I want extract this part: a=a.split("");a=io.aS(a,53);a=io.Y7(a,19);a=io.aS(a,9);a=io.km(a,2);a=io.Y7(a,29);a=io.km(a,1);return a.join("") Thanks a lot, I am coming crazy with regex.
upvote count: 1
tagged with: regex
accepted answer: http://stackoverflow.com/a/24921894
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/a/24964501
accepted answer of: http://stackoverflow.com/q/24964454
upvote count: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24964454
has comment: http://stackoverflow.com/comment/38804038
has comment: http://stackoverflow.com/comment/38803935
type: Answer
downvote count: 0
score: 1
has body: You use Arrays.toString if you want to print out a whole 1D array, because it convertes an array to a string. If you want to print out just one element of the array (like myArray[0][0] as you indicated), you would simply do this: System.out.println(myArray[0][0]); No need for the Arrays.toString there, because the elements of your jagged array are already Strings.
has comment: http://stackoverflow.com/comment/38803888

http://stackoverflow.com/comment/38853431
comment on: http://stackoverflow.com/q/24987801
type: QuestionComment
type: Comment
has text: @shalafi do you mean the odd element? I narrowed down the bug to be in the createItemRow method.
score: 0

http://stackoverflow.com/a/25177825
upvote count: 2
has body: You could also load the Flume Configuration file rather than writing it within the Java code.The same configuration could be used while starting your standalone Flume Agent. public static void main(String[] args) { String[] args = new String[] { "agent", "-nAgent", "-fflume.conf" }; Application.main(args); } Where "Agent" is the name of your Flume Agent. "flume.conf" is the configuration file which should be placed in the resources folder of your Java project.
has comment: http://stackoverflow.com/comment/39241771
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/39241706
accepted answer of: http://stackoverflow.com/q/25018800
type: Answer
answers question: http://stackoverflow.com/q/25018800
has comment: http://stackoverflow.com/comment/40104752
score: 2
has comment: http://stackoverflow.com/comment/39204998

http://stackoverflow.com/q/25013177
answer count: 1
downvote count: 0
favorite count: 0
has body: I am new to Selenium and TestNG I am not able to execute scripts in order. I have to perform CRUD operation on entities as Group,User,Location,Device,Profile,Role which have dependicies in between them. I have create a separate group for each operation (usin annotation) that I perform on each entity, as addGroup,editGroup,deleteGroup and so on for each entity above. Some of entities is dependent on other as ADD GROUP @Test(dependsOnGroups={"loginGroup"},groups="addGroup") public void AddGroup() {} EDIT GROUP editGroup is dependent on addGroup operation as follows @Test(dependsOnGroups = { "loginGroup","addGroup"}, groups = "editGroup") public void editGroup() {} DELETE GROUP @Test(dependsOnGroups={"loginGroup","addGroup","deleteLocation"},groups="deleteGroup") public void deleteGroup() {} ADD LOCATION AddLocation operation is dependent on AddGroup. @Test(dependsOnGroups = {"loginGroup", "addGroup" }, groups = "addLocation") public void addLocation() {} EDIT LOCATION editLocation is dependent on AddLocation @Test(dependsOnGroups = { "loginGroup","addLocation"}, groups = "editLocation") public void editLocation() {} DELETE LOCATION deleteLocation is dependent on addLocation operation @Test(dependsOnGroups={"loginGroup","addLocation"},groups="deleteLocation") public void deleteLocation(String locationId) {} ADD ROLE @Test(dependsOnGroups = { "loginGroup"}, groups = "addRole",dataProviderClass=AddNewRoleDataProvider.class) public void addRole() { } EDIT ROLE editRole is dependent on addRole @Test(dependsOnGroups = { "loginGroup","addRole"}, groups = "editRole") public void editRole() {} DELETE ROLE deleteRole is dependent on addLocation operation @Test(dependsOnGroups = { "loginGroup", "addRole", "deleteUser" }, groups = "deleteRole") public void deleteRole() { } ADD USER AddUser operation has dependency on AddLocation,AddGroup,AddRole Operations. @Test(dependsOnGroups = {"loginGroup", "addGroup", "addLocation","addRole"}, groups = "addUser") public void AddUser() { } E…
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25014935
tagged with: testng
tagged with: selenium-webdriver
has title: TestNG & Selenium: Perform CRUD operations on entities with depedencies
score: 1
tagged with: java
tagged with: selenium
upvote count: 1
type: Question
tagged with: automation

http://stackoverflow.com/comment/38822702
comment on: http://stackoverflow.com/a/24974610
score: 0
type: Comment
has text: 'Everyone else' doesn't have the same problem at all. Not understanding something might be a reason to avoid it, but it might more probably be said to be a reason to make the effort and learn to understand it.
type: AnswerComment

http://stackoverflow.com/comment/38887236
score: 0
type: Comment
type: QuestionComment
has text: Thanks, could you post it as ans. I will accept it
comment on: http://stackoverflow.com/q/25008082

http://stackoverflow.com/a/25010564
has comment: http://stackoverflow.com/comment/38891418
type: Answer
has comment: http://stackoverflow.com/comment/38904876
downvote count: 0
score: 3
has body: You just write the class you want: @SpringCache(putIt="I'm put", getIt="I'm get", c=TestSpringCache.class) public class TestSpringCache { public static void main(String[] args) { System.out.println(); } } You might have to add an import statement, if it is not in the same package.
has comment: http://stackoverflow.com/comment/38890121
answers question: http://stackoverflow.com/q/25010502
upvote count: 3
has comment: http://stackoverflow.com/comment/38891467

http://stackoverflow.com/q/24925204
has comment: http://stackoverflow.com/comment/38732241
has comment: http://stackoverflow.com/comment/38732949
has title: Android help, trying to get value moved from one class to another (android app)
type: Question
has comment: http://stackoverflow.com/comment/38730188
has comment: http://stackoverflow.com/comment/38729927
answer count: 1
tagged with: class
score: 0
has comment: http://stackoverflow.com/comment/38730145
has comment: http://stackoverflow.com/comment/38730871
has comment: http://stackoverflow.com/comment/38729760
tagged with: android
has comment: http://stackoverflow.com/comment/38730095
has body: I am trying to get a function and a int from Class B into Class A. Can someone please help me. I have been stuck here for multiple days now. Class B https://github.com/akballow/help-me-please/blob/master/nRFToolbox/src/no/nordicsemi/android/nrftoolbox/profile/BleProfileServiceReadyActivity.java Class A https://github.com/akballow/help-me-please/blob/master/nRFToolbox/src/no/nordicsemi/android/nrftoolbox/proximity/ProximityManager.java What I want to do is call function getRssi() from class A, to be called inside function onRecive() in Class B where I put the code "mble.getRssi();" then get the int rssilevel from Class A to B. Can somone please explain to me how I can accomplish this? I tried to "public PRoximityManager mble" inside class B, but it would ultimatly fail. I am so desperate that if someone can help me accomplish this I will send 5 bucks from paypal to you as a reward (only if that is legal, i dont want to get in trouble on here). Thanks
has comment: http://stackoverflow.com/comment/38729688
has comment: http://stackoverflow.com/comment/38729724
tagged with: transfer
has comment: http://stackoverflow.com/comment/38729801
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24925443
has comment: http://stackoverflow.com/comment/38729841
has comment: http://stackoverflow.com/comment/38729922
tagged with: java
has comment: http://stackoverflow.com/comment/38730026

http://stackoverflow.com/a/25014399
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/38899836
upvote count: 1
accepted answer of: http://stackoverflow.com/q/25014132
score: 1
has body: You can override the touch event in your view and check whether or not its distance from the center of the circle is less then its radius. This needs to be done like this, because views on Android are basically always rectangular.
answers question: http://stackoverflow.com/q/25014132
type: AcceptedAnswer

http://stackoverflow.com/comment/38977044
type: QuestionComment
has text: Sure.Here: <?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/xsd/maven-4.0.0.xsd"> 4.0.0 ... com.ning async-http-client 1.8.12
comment on: http://stackoverflow.com/q/25054601
score: 0
type: Comment

http://stackoverflow.com/q/24989279
tagged with: neo4j
favorite count: 0
has answer: http://stackoverflow.com/a/24993678
upvote count: 1
has title: Java with Neo4j
type: AnsweredQuestion
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/24993678
type: Question
answer count: 1
downvote count: 0
has body: I'm working with parametrized queries in Neo4j. I have started with the Hello world program taken from http://docs.neo4j.org/chunked/milestone/tutorials-java-embedded-hello-world.html. And I also tried with program from http://docs.neo4j.org/chunked/milestone/tutorials-cypher-java.html. And in the program they have specified the target path. What do I need to specify for that path. I have written the programs in Eclipse and want to run it but dnt find the way. Can anyone please help me out in the steps to execute the query and print Hello World and also to pass the parameters and see the graph in the second program. Thanks in advance...

http://stackoverflow.com/comment/38924501
comment on: http://stackoverflow.com/q/25028626
type: QuestionComment
has text: Please extend your question with the exact compile & running command.
score: 0
type: Comment

http://stackoverflow.com/q/25018477
tagged with: groovy
downvote count: 0
score: 1
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25030093
tagged with: java
upvote count: 1
answer count: 1
has body: I wanna create an Actor which keeps executing a task, then it can be stopped by an external call to stop, but got quite blocked. The actor should look the following myActor = actor { loop { react { message -&gt; if(message instanceof String &amp;&amp; "stop".equals(message)) { stop() } } } while(true) { // do some work } } After the creation, the actor can be started via in my test file, @BeforeMethod: myActor.start() And its handle can be kept by the main thread and stopped via below command in my test file, @AfterMethod: myActor.send "stop" However, I cannot get above approach working. First of all, I find I do not need to "myActor.start()", after the @BeforeMethod, it just runs automatically; Secondly, although I tried to call "myActor.send "stop" in my test file's @AfterMethod, it looks like the loop{} of myActor is never visited and keeps working with the while{}. I tried also to put the loop{} into while{}, but it is still not working and loop{} is still not called Did I miss anything? Thanks!
has title: How to create a groovy actor which keeps execution unless stopped
tagged with: gpars
type: UnansweredQuestion

http://stackoverflow.com/a/25125370
has comment: http://stackoverflow.com/comment/42525381
downvote count: 0
type: Answer
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/25011249
has body: The default stopAtShutdown seems to be true, see at http://git.eclipse.org/c/jetty/org.eclipse.jetty.project.git/tree/jetty-server/src/main/config/etc/jetty.xml?h=jetty-9.1.x, the timeout is also there, 5 seconds: true 5000 Additionally, you may configure a LifeCycle.Listener for more specific cases, e.g., I use one to remove a pid file (among other things) when shutting down the server, I attach the listener in the Connector using addLifeCycleListener on the ServerConnector, in jetty xml, it looks like: <Configure id="Server" class="org.eclipse.jetty.server.Server"> ... <New class="org.eclipse.jetty.server.ServerConnector"> ... <New class="com.acme.jetty.ConnectorListener"/> and ConnectorListener.java would begin with something like: package com.acme.jetty; import org.eclipse.jetty.util.component.LifeCycle; import org.eclipse.jetty.util.log.Log; import org.eclipse.jetty.util.log.Logger; public class ConnectorListener implements LifeCycle.Listener { private static final Logger LOG = Log.getLogger(ConnectorListener.class); ... public void lifeCycleStopped(LifeCycle event) { LOG.debug("lifeCycleStopped()"); } I know this does not address your questions directly, but maybe you could provide us more information.

http://stackoverflow.com/a/25019633
has comment: http://stackoverflow.com/comment/38908033
has comment: http://stackoverflow.com/comment/38909426
score: 0
answers question: http://stackoverflow.com/q/25019495
has body: You can download the classes at the location of your wish. There is no standard location. You just need to set the class path. Windows 7: From the desktop, right click the Computer icon. Choose Properties from the context menu. Click the Advanced system settings link. Click Environment Variables. In the section System Variables, find the PATH environment variable and select it. Click Edit. If the PATH environment variable does not exist, click New. In the Edit System Variable (or New System Variable) window, specify the value of the PATH environment variable. Click OK. Close all remaining windows by clicking OK. For other veersion of OS please see the Link
type: Answer
has comment: http://stackoverflow.com/comment/38907652

http://stackoverflow.com/q/25023915
has body: We developed a PDF reader desktop app using iTextSharp and we are now developing an android app. This is my C# code I want to know what can be use for StringComparison in Java public final void PDFReferenceGetter(String pSearch, StringComparison SC, String sourceFile, String destinationFile) { // } the full code public final void PDFReferenceGetter(String pSearch, String SC, String sourceFile, String destinationFile) { PdfStamper stamper = null; PdfContentByte contentByte; Rectangle refRectangle = null; int refPage = 0; //this.Cursor = Cursors.WaitCursor; if ((new java.io.File(sourceFile)).isFile()) { PdfReader pReader = new PdfReader(sourceFile); stamper = new PdfStamper(pReader, new FileOutputStream(destinationFile)); for (int page = 1; page &lt;= pReader.getNumberOfPages(); page++) { LocationTextExtractionStrategy strategy = new LocationTextExtractionStrategy(); contentByte = stamper.getUnderContent(page); //Send some data contained in PdfContentByte, looks like the first is always cero for me and the second 100, but i'm not sure if this could change in some cases strategy._UndercontentCharacterSpacing = contentByte.getCharacterSpacing(); strategy._UndercontentHorizontalScaling = contentByte.getHorizontalScaling(); //It's not really needed to get the text back, but we have to call this line ALWAYS, //because it triggers the process that will get all chunks from PDF into our strategy Object String currentText = PdfTextExtractor.getTextFromPage(pReader, page, strategy); //The real getter process starts in the following line java.util.ArrayList&lt;Rectangle&gt; matchesFound = strategy.GetTextLocations("References", SC); //Set the fill color of the shapes, I don't use a border because it would make the rect bigger //but maybe using a thin border could be a solution if you see the currect rect is not big enough to cover all the text it should cover contentByte.setColorFill(BaseColor.PINK); //MatchesFound contains all text with locations, so do whatever you want with i…
answer count: 3
has answer: http://stackoverflow.com/a/25023974
has title: StringComparison in java
tagged with: string-comparison
has answer: http://stackoverflow.com/a/25024202
has comment: http://stackoverflow.com/comment/38916281
favorite count: 0
downvote count: 2
has comment: http://stackoverflow.com/comment/38916105
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25098331
tagged with: java
type: Question
upvote count: 0
score: -2
accepted answer: http://stackoverflow.com/a/25098331
has comment: http://stackoverflow.com/comment/38916407
possible better answer: http://stackoverflow.com/a/25023974
linked to: http://stackoverflow.com/q/513832

http://stackoverflow.com/q/24969942
tagged with: java
possible better answer: http://stackoverflow.com/a/24969965
has answer: http://stackoverflow.com/a/24970011
type: Question
linked to: http://stackoverflow.com/q/19162331
has answer: http://stackoverflow.com/a/24969994
has title: Head First Java: Target Random number is always zero
accepted answer: http://stackoverflow.com/a/24969978
score: 0
duplicate of: http://stackoverflow.com/q/19162331
has comment: http://stackoverflow.com/comment/38813632
answer count: 5
has answer: http://stackoverflow.com/a/24970006
has body: I have been trying this code and the target number generated using math.random() always comes out to be zero. Is there any problem with the code? Please help. I tried a number of times, but every time i try the target random number is always zero. public class Player { int number; public void guess() { number = (int) (Math.random()*10); } } public class GuessGame { Player p1; Player p2; Player p3; public void startGame() { p1 = new Player(); p2 = new Player(); p3 = new Player(); int targetNumber; targetNumber = (int) Math.random() * 10 ; System.out.println("The target number is "+ targetNumber); while(true) { p1.guess(); p2.guess(); p3.guess(); int guessp1 = p1.number; int guessp2 = p2.number; int guessp3 = p3.number; System.out.println("Number guessed by player p1 is "+ guessp1); System.out.println("Number guessed by player p2 is "+ guessp2); System.out.println("Number guessed by player p3 is "+ guessp3); boolean isp1 = false; boolean isp2 = false; boolean isp3 = false; if(targetNumber==guessp1) isp1 = true; if(targetNumber==guessp2) isp2 = true; if(targetNumber==guessp3) isp3 = true; if(isp1||isp2||isp3) { System.out.println("player1 got it right? " + isp1); System.out.println("player2 got it right? " + isp2); System.out.println("player3 got it right? " + isp3); System.out.println("Game Over!!!"); break; } else { System.out.println("All Wrong!! Play Again.."); } } } } public class GameLauncher { public static void main(String[] args) { GuessGame game = new GuessGame(); game.startGame(); } }
has answer: http://stackoverflow.com/a/24969965
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24969978

http://stackoverflow.com/a/25025631
type: AcceptedAnswer
has body: Common mistake to make: setText() has an overload that takes an integer (which must be a string resource ID, e.g. R.string.my_string). When you receive the message: tvStopwatch.setText(msg.what); It's attempting to resolve msg.what as a string resource, and crashing when it can't be found. You should instead cast the timestamp to a string, and use that instead: tvStopwatch.setText(String.valueOf(msg.what));
accepted answer of: http://stackoverflow.com/q/25025589
answers question: http://stackoverflow.com/q/25025589
type: Answer
upvote count: 4
downvote count: 0
has comment: http://stackoverflow.com/comment/38919285
score: 4
has comment: http://stackoverflow.com/comment/38919517
has comment: http://stackoverflow.com/comment/38919352

http://stackoverflow.com/a/24936415
type: Answer
score: 2
answers question: http://stackoverflow.com/q/24909667
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24909667
type: AcceptedAnswer
has body: I have now solved my problem by remembering the names of the project jar files in copyJars and then excluding them in copyDeps: List&lt;String&gt; projectLibs = new ArrayList&lt;String&gt;() task copyJars(type: Copy, dependsOn: subprojects.jar) { eachFile { fileCopyDetails -&gt; projectLibs.add(fileCopyDetails.name) } from(subprojects.jar) into file('lib') } task copyDeps(type: Copy, dependsOn: copyJars) { eachFile { fileCopyDetails -&gt; if (fileCopyDetails.name in projectLibs){ fileCopyDetails.exclude() } } from (subprojects.configurations.runtime) into file('lib/ext') } If somebody has a nicer solution I would be really happy to hear it :-)
upvote count: 2

http://stackoverflow.com/comment/38712280
type: Comment
has text: I had the files in the web/web-inf/lib directory which was suggested in a tutorial I looked up for setting up log4j but now I've removed the two lines and am still getting errors on the import statements 'unused import' and 'cannot resolve symbol apache'. Does this mean that it's not finding the jar files where I put them? IntelliJ won't let me move the .jar files into the external directory, only the web-inf file
comment on: http://stackoverflow.com/a/24915766
type: AnswerComment
score: 0

http://stackoverflow.com/q/24918199
has comment: http://stackoverflow.com/comment/38719428
linked to: http://stackoverflow.com/q/8104364
has comment: http://stackoverflow.com/comment/38718496
has body: I'am trying to make libgdx game, adn i've got 2 problems now: 1. When im using camera.setToOrtho(false, GAME_WIDTH, GAME_HEIGHT); my textrure of player is distored, one eye is bigger than another. 2. Im using this camera and viweport: camera= new OrthographicCamera(GAME_WIDTH,GAME_HEIGHT); camera.setToOrtho(false, GAME_WIDTH, GAME_HEIGHT); viewport = new StretchViewport(GAME_WIDTH,GAME_HEIGHT,camera); and when i do : touchPos.set(Gdx.input.getX(1),Gdx.input.getY(1),0); game.camera.unproject(touchPos); System.out.println(touchPos.x+" "+ touchPos.y); I get 0 0 in right top corner but my character witch cords 0 0 is drawing in left bottom corner. When i use: game.camera = new OrthographicCamera(820,480); game.viewport = new FillViewport(820,480,game.camera); i must use game.batch.setProjectionMatrix(game.camera.combined); when i use this code i've got corectly working unproject method and coordinate system but i've got distored texture. When i use: camera = new PerspectiveCamera(); viewport = new StretchViewport(900, 470, camera); i've got distored texture and bad coords system. and i can 't use :game.batch.setProjectionMatrix(game.camera.combined);
has comment: http://stackoverflow.com/comment/38718575
answer count: 1
has comment: http://stackoverflow.com/comment/38718887
linked to: http://stackoverflow.com/q/24909056
has answer: http://stackoverflow.com/a/24920698
tagged with: android
tagged with: textures
has title: libgdx distorted texture when using camera.setToOrtho(false, GAME_WIDTH, GAME_HEIGHT);
type: AnsweredQuestion
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/38717778
has comment: http://stackoverflow.com/comment/38718692
type: Question
accepted answer: http://stackoverflow.com/a/24920698

http://stackoverflow.com/q/24940380
upvote count: 5
accepted answer: http://stackoverflow.com/a/24941061
has answer: http://stackoverflow.com/a/24940587
score: 2
has answer: http://stackoverflow.com/a/24940614
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24941061
tagged with: java
possible better answer: http://stackoverflow.com/a/24940562
has body: Are there any Java Web Frameworks that are very similar to Grails but use pure Java instead of Groovy? I really like the look of Grails, but at this moment want to focus solely on improving my Java skills, so do not want to use Groovy. I have looked at Spring MVC and Play Framework but I only plan to develop quite simple personal applications, which is why Grails appealed to me as these seem quite heavyweight.
has title: Similar web framework to Grails but that uses Java not Groovy?
tagged with: grails
type: Question
tagged with: web-frameworks
favorite count: 0
downvote count: 3
tagged with: groovy
has answer: http://stackoverflow.com/a/24940562
answer count: 4

http://stackoverflow.com/q/25009406
tagged with: android
has answer: http://stackoverflow.com/a/25011488
accepted answer: http://stackoverflow.com/a/25011488
downvote count: 1
type: AnsweredQuestion
tagged with: android-edittext
tagged with: java
score: -1
has title: Edittext: Error solved then enable the send button in android
type: Question
upvote count: 0
answer count: 1
has body: i have five edittext fields which is checking the fields and restricts some data when entered wrong as shown below code but now if i enter wrong data in edittext then it will enter the information into database so i want to disable the button if there are errors in any edittext . The error might be in 1 to 5 edittext it has to disable the send button. It has to only enable the send button when there are no errors in the edittext fields public class MaINActivity extends Activity { String result = null; InputStream is = null; String valid_email = null; String valid_name = null; String valid_last = null; String valid_age = null; String v5,v1,v2,v3,v4,v6; String valid_confirm = null; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_subscribe); final EditText editText = (EditText)findViewById(R.id.firstname); final EditText editText1 = (EditText)findViewById(R.id.lastname); final EditText editText2 = (EditText)findViewById(R.id.age1); final EditText editText3 = (EditText)findViewById(R.id.email); final EditText editText4 = (EditText)findViewById(R.id.confirm); editText2.addTextChangedListener(new TextWatcher(){ @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @Override public void onTextChanged(CharSequence s, int start, int before, int count) { } @Override public void afterTextChanged(Editable s) { Is_Valid_Age(editText2); } private void Is_Valid_Age(EditText editText2) { if(editText2.length() == 0 || editText2.equals("") || editText2 == null || "".equals(editText2.getText().toString())) { valid_age = null; }else { valid_age = editText2.getText().toString(); } } }); editText1.addTextChangedListener(new TextWatcher(){ @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @Override public void onTextChanged(CharSequence s, int start, int before, int count) { } @Override public void afterTextChanged(Editable s…
favorite count: 0

http://stackoverflow.com/comment/38845004
comment on: http://stackoverflow.com/q/24986101
type: Comment
has text: This discussion is too long for comments. Please take it to chat.
score: 0
type: QuestionComment

http://stackoverflow.com/q/24988020
tagged with: socket.io
has comment: http://stackoverflow.com/comment/38848070
type: AnsweredQuestion
has body: I am writing an Android app that connects to a server using socket.io (v1.0.4). Is there a socket.io Java client out there that works with socket.io v1.0? I was originally using the Gottox solution but it only seems to work with socket.io &lt;= v0.92. Some other libraries available https://github.com/koush/AndroidAsync https://github.com/nkzawa/socket.io-client.java nkzawa's claims to be supported for 1.0 but there seem to be some issues with it.
tagged with: java
linked to: http://stackoverflow.com/q/24386302
has comment: http://stackoverflow.com/comment/38848546
has title: Socket.io Java Client with support for 1.0.x
type: Question
has answer: http://stackoverflow.com/a/24988429
answer count: 1
tagged with: javascript
accepted answer: http://stackoverflow.com/a/24988429
score: 0
tagged with: android

http://stackoverflow.com/comment/38769375
type: Comment
type: QuestionComment
has text: {response=ok, versionname=dummy, extra=, package=dummy, devicename=dummy, versioncode=dummy, synclocation=null, deviceid=unknown-device-id}
comment on: http://stackoverflow.com/q/24946034
score: 0

http://stackoverflow.com/comment/38842221
has text: how about just `if (paused) drawString()`?
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/24984874

http://stackoverflow.com/comment/38863611
has text: the answer is below, i don't need more down-votes.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24995423

http://stackoverflow.com/q/24914525
favorite count: 0
has comment: http://stackoverflow.com/comment/38749088
possible better answer: http://stackoverflow.com/a/24920543
linked to: http://stackoverflow.com/q/926266
has comment: http://stackoverflow.com/comment/38709660
answer count: 9
has comment: http://stackoverflow.com/comment/38750975
has comment: http://stackoverflow.com/comment/38710830
has answer: http://stackoverflow.com/a/24920543
has comment: http://stackoverflow.com/comment/38712372
linked to: http://stackoverflow.com/q/22225333
linked to: http://stackoverflow.com/q/3664272
has comment: http://stackoverflow.com/comment/38710070
has comment: http://stackoverflow.com/comment/38753398
accepted answer: http://stackoverflow.com/a/24914586
has comment: http://stackoverflow.com/comment/38745396
has comment: http://stackoverflow.com/comment/38709926
has comment: http://stackoverflow.com/comment/38710289
has comment: http://stackoverflow.com/comment/38751181
tagged with: c++
has comment: http://stackoverflow.com/comment/38710560
has comment: http://stackoverflow.com/comment/38749378
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38723432
has comment: http://stackoverflow.com/comment/38788222
has comment: http://stackoverflow.com/comment/38926246
tagged with: java
has comment: http://stackoverflow.com/comment/38762114
has comment: http://stackoverflow.com/comment/38709974
has comment: http://stackoverflow.com/comment/38712393
has comment: http://stackoverflow.com/comment/38777149
has comment: http://stackoverflow.com/comment/38709715
has comment: http://stackoverflow.com/comment/38711234
type: Question
tagged with: performance
has body: I have always heard that C++ was way more efficient than Java (and that is why most games are developed in C++). I wrote a small algorithm to solve the "Eight queens puzzle" in both Java and C++, using the exact same algorithm, and then started to raise the number or squares. When reaching checkboards of 20*20 or even 22*22, it appears Java is much more effective (3 seconds vs 66 seconds for C++). I have no idea why, but I am pretty beginning with C++, so it is possible I made some huge performance mistakes, so I will gladly accept any information that would help me understand what is happening. Below is the code I use in Java: import java.awt.Point; import java.util.ArrayList; import java.util.List; public class HuitDames { /** * La liste des coordnnées des dames. */ private static List&lt;Point&gt; positions = new ArrayList&lt;&gt;(); /** * Largeur de la grille. */ private static final int LARGEUR_GRILLE = 22; /** * @param args the command line arguments */ public static void main(String[] args) { int i = 1; placerDame(i); for (Point point : positions) { System.out.println("(" + point.x + "; " + point.y + ")"); } } /** * Place une dame et return true si la position est bonne. * @param i le numéro de la dame. * @return si la position est bonne. */ private static boolean placerDame(int i) { boolean bonnePosition = false; for (int j = 1; j &lt;= LARGEUR_GRILLE &amp;&amp; bonnePosition == false; j++) { Point emplacement = new Point(i, j); positions.add(emplacement); if (verifierPrise(emplacement) &amp;&amp; (i == LARGEUR_GRILLE || placerDame(i + 1))) { bonnePosition = true; } else { positions.remove(i - 1); } } return bonnePosition; } /** * Vérifie que la nouvelle position n'est pas en prise avec une position déjà présente. * @param position la position de la nouvelle dame. * @return Si la position convient par rapport aux positions des autres dames. */ private static boolean verifierPrise(Point position) { boolean nonPrise = true; for (Point point : positions) { if (…
has comment: http://stackoverflow.com/comment/38739128
has answer: http://stackoverflow.com/a/25144680
has comment: http://stackoverflow.com/comment/38761974
tagged with: algorithm
downvote count: 9
has answer: http://stackoverflow.com/a/24914838
has comment: http://stackoverflow.com/comment/38749982
has comment: http://stackoverflow.com/comment/38709764
has comment: http://stackoverflow.com/comment/38788127
has comment: http://stackoverflow.com/comment/38751125
has comment: http://stackoverflow.com/comment/38709677
has comment: http://stackoverflow.com/comment/38711060
has comment: http://stackoverflow.com/comment/38710758
upvote count: 78
has comment: http://stackoverflow.com/comment/38709796
has answer: http://stackoverflow.com/a/24914586
has comment: http://stackoverflow.com/comment/38757352
has answer: http://stackoverflow.com/a/49944777
score: 69
has comment: http://stackoverflow.com/comment/38710381
has title: Performance issue: Java vs C++
has answer: http://stackoverflow.com/a/27413359
has answer: http://stackoverflow.com/a/24915470
has comment: http://stackoverflow.com/comment/38710191
has answer: http://stackoverflow.com/a/27163029
has answer: http://stackoverflow.com/a/24916557

http://stackoverflow.com/comment/38858022
type: Comment
comment on: http://stackoverflow.com/q/24993364
score: 0
has text: @user3721476 See my answers' second section for a possible explanation.
type: QuestionComment

http://stackoverflow.com/comment/39083672
has text: So basically, I'm trying to get an xslt out of that xml and return it to the caller. It's my first time using the oracle xml parser.
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25061459
type: Comment

http://stackoverflow.com/q/25002293
type: Question
has answer: http://stackoverflow.com/a/25006758
tagged with: cookbook
tagged with: java
score: 0
answer count: 2
tagged with: tomcat
has title: Installing Tomcat6 using Opscode cookbook on CentOS 5.10
type: UnansweredQuestion
tagged with: chef-infra
tagged with: yum
has body: I'm trying to install tomcat6 using opscode chef cookbook. I get following error. Recipe: tomcat::default * package[tomcat6] action install * No version specified, and no candidate version available for tomcat6 ================================================================================ Error executing action `install` on resource 'package[tomcat6]' ================================================================================ Chef::Exceptions::Package ------------------------- No version specified, and no candidate version available for tomcat6 Apparently there is no package named tomcat6 when I try yum install tomcat6. How to fix this ? I tried adding yum and yum-epel cookbooks but they are not a solution as they over-write my yum files. Is there a way I can source the tomcat package from a zip file in a URL and install using that by modifying opscode cookbook ?
has answer: http://stackoverflow.com/a/25002382

http://stackoverflow.com/a/25009680
has body: Let's ignore the String == String problem in your code to start with and go a different direction... Basically, all you want is all the text AFTER stop, for this we can use a combination of String#indexOf and String#substring String test = "this is a test test test stop 123 3.5"; test = test.substring(test.indexOf("stop") + "stop".length()).trim(); Once you have the text you want, you can simply split the remaining text on the " " delimiter and you should have all the numbers in an array... String parts[] = test.split(" "); for (String part : parts) { System.out.println(part); } Which outputs... 123 3.5 For the String compare problem, you should take a look at How do I compare strings in Java? for more details
upvote count: 1
answers question: http://stackoverflow.com/q/25009579
has comment: http://stackoverflow.com/comment/38888569
has comment: http://stackoverflow.com/comment/38888537
type: Answer
downvote count: 0
score: 1

http://stackoverflow.com/comment/38832065
has text: you're right but it was a mistake in text, i edited my question.and i'm using Unix S.C.O open server 5.0.7 and not windows,in windows there was no problem, but in unix ...
comment on: http://stackoverflow.com/a/24969457
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/44515700
type: Answer
has body: For future readers: https://stackoverflow.com/a/24740431/2039709 (include the facet fields as non-empty in your query)
score: 0
answers question: http://stackoverflow.com/q/24999450

http://stackoverflow.com/q/24946514
score: 0
has comment: http://stackoverflow.com/comment/38770725
has comment: http://stackoverflow.com/comment/39188643
linked to: http://stackoverflow.com/q/2137755
linked to: http://stackoverflow.com/q/24010109
has comment: http://stackoverflow.com/comment/39188714
has comment: http://stackoverflow.com/comment/39188938
has comment: http://stackoverflow.com/comment/38771791
linked to: http://stackoverflow.com/q/24986101
has comment: http://stackoverflow.com/comment/39188762
tagged with: mapping
has comment: http://stackoverflow.com/comment/38772202
has comment: http://stackoverflow.com/comment/39153163
has body: As far as I know, in Java 8, mapping works as follows for example: List&lt;String&gt; objList = Arrays.asList("1", "2", "3", "4", "5", "6", "7"); objList.stream().map( i -&gt; i ). forEach( i -&gt; System.out.print(" " + i)); output: 1 2 3 4 5 6 7 but my question is: how I can do the reverse mapping? like so output will be this 7 6 5 4 3 2 1 Or it is not possible to do so?
has comment: http://stackoverflow.com/comment/38844386
has comment: http://stackoverflow.com/comment/38770388
has comment: http://stackoverflow.com/comment/38770575
accepted answer: http://stackoverflow.com/a/24946714
has comment: http://stackoverflow.com/comment/38771767
has comment: http://stackoverflow.com/comment/38772042
tagged with: lambda
type: Question
type: AnsweredQuestion
has title: How to implement a reverse mapping Java using lambdas?
tagged with: java
has comment: http://stackoverflow.com/comment/39186931
has comment: http://stackoverflow.com/comment/38770554
possible better answer: http://stackoverflow.com/a/77744359
has comment: http://stackoverflow.com/comment/39188669
has comment: http://stackoverflow.com/comment/38770374
has answer: http://stackoverflow.com/a/77744359
has comment: http://stackoverflow.com/comment/38772740
answer count: 2
has comment: http://stackoverflow.com/comment/39153631
has comment: http://stackoverflow.com/comment/39153366
has comment: http://stackoverflow.com/comment/38770462
has comment: http://stackoverflow.com/comment/39153568
has answer: http://stackoverflow.com/a/24946714

http://stackoverflow.com/comment/38821073
has text: From what I cat tell from the log of the HTTP request you posted, you are using `Content-Type:text/plain`. Am I right?
type: Comment
score: 0
comment on: http://stackoverflow.com/q/24972437
type: QuestionComment

http://stackoverflow.com/q/24986376
tagged with: load
type: Question
tagged with: plugins
has body: I am new here and sorry for my bad english ;). I try to load plugin jars in java with this code: package testprogramm; import java.io.File; import java.net.URL; import java.net.URLClassLoader; import java.util.HashSet; import java.util.Set; public class TestProgramm { private static Set&lt;Plugin&gt; plugins = new HashSet&lt;Plugin&gt;(); private static TestProgramm instance = new TestProgramm(); public static void main(String[] args) { System.out.println("TestProgramm v0.1"); File pluginsDirectory = new File("plugins"); if (pluginsDirectory.exists() &amp;&amp; pluginsDirectory.isDirectory()) { for (File pluginFile : pluginsDirectory.listFiles()) { if (pluginFile.exists() &amp;&amp; pluginFile.isFile() &amp;&amp; pluginFile.getName().endsWith(".jar")) { try { URL[] urls = new URL[] {pluginFile.toURI().toURL()}; ClassLoader loader = new URLClassLoader(urls); Class c = loader.loadClass("src." + pluginFile.getName().toLowerCase().replace(".jar", "") + ".Main"); Object pluginObject = c.newInstance(); if (pluginObject instanceof Plugin) { Plugin plugin = (Plugin) pluginObject; plugins.add(plugin); plugin.init(instance); plugin.onEnable(); } } catch (Exception e) { e.printStackTrace(); } } } } while (true) { if (true) { //code break; } } for (Plugin plugin : plugins) { plugin.onDisable(); } } public int getInt() { return 5; } } Plugin class: package testprogramm; public abstract class Plugin { protected TestProgramm testProgramm; protected void init(TestProgramm testProgramm) { this.testProgramm = testProgramm; } public TestProgramm getTestProgramm() { return testProgramm; } public abstract void onEnable(); public abstract void onDisable(); public abstract void onEvent1(String eventInfo); public abstract void onEvent2(String eventInfo); public abstract void onEvent3(String eventInfo); } Class in plugin jar: package ownplugin; import testprogramm.Plugin; public class Main extends Plugin { @Override public void onEnable() { System.out.println("OwnPlugin enabled"); } @Overri…
accepted answer: http://stackoverflow.com/a/24986554
tagged with: java
score: 0
answer count: 1
has title: Java load plugin jar ClassNotFoundException
tagged with: classnotfoundexception
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24986554
tagged with: jar

http://stackoverflow.com/comment/38730778
type: Comment
comment on: http://stackoverflow.com/a/24923032
has text: I don't have any reference but I am using all String related functions directly(Can't say about wrapper & other classes) and it works fine.
type: AnswerComment
score: 0

searchactivity
tag name: searchactivity
type: Tag
tags question: http://stackoverflow.com/q/24928906

http://stackoverflow.com/comment/38994249
comment on: http://stackoverflow.com/q/25065431
has text: Even a bit disrespectful actually.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25040896
upvote count: 2
has body: use the ceil function in Oracle! select ceil(.625) from dual;
score: 2
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/25040826
answers question: http://stackoverflow.com/q/25040826

http://stackoverflow.com/comment/38816392
has text: I'm just creating the layout for a JFrame, nothing else.The code above is in an Action Listener. Between the two showTime() is a 5 second pause.
type: QuestionComment
comment on: http://stackoverflow.com/q/24971331
score: 0
type: Comment

http://stackoverflow.com/q/25002698
has answer: http://stackoverflow.com/a/25002778
has answer: http://stackoverflow.com/a/25002736
accepted answer: http://stackoverflow.com/a/25002729
possible better answer: http://stackoverflow.com/a/25002778
has body: In the code below I was wondering if an exception was thrown in the for loop and the error message was added to the JSON object in the catch block, will the program return to the next iteration of the for loop after the exception was thrown? Or will it break the for loop and return the object? JSONOBject obj = new JSONObject(); try { for(i=0; i&lt;10; i++) { //do things in here that may throw an exception obj.put("message","did not throw exception"); } { catch(Exception e) { obj.put("message",e.getMessage()); } return obj;
has comment: http://stackoverflow.com/comment/38875260
type: AnsweredQuestion
tagged with: java
upvote count: 1
downvote count: 1
type: Question
tagged with: try-catch
has title: Does surrounding try/catch break the forloop?
has answer: http://stackoverflow.com/a/25002729
score: 0
tagged with: for-loop
answer count: 3
favorite count: 0

http://stackoverflow.com/q/24967783
downvote count: 1
tagged with: parsing
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24968214
tagged with: reflection
tagged with: java
has comment: http://stackoverflow.com/comment/38809955
type: Question
has answer: http://stackoverflow.com/a/24967889
has comment: http://stackoverflow.com/comment/38809990
has title: When to use Java Reflection API and when not to
has body: I am trying to develop a parser in Java. It is for a game that will communicate with the parser via std in and std out. I am trying to create the parser to be very extendable and easy to use for anyone. The goal is to run a customizable "script" on a server. The parser will keep track of everything the server sends it, and can also respond whenever necessary. This means I will have to map many commands from the server to different events in the parser. In PHP, I know that you can easily call a variable function, which it seems is impossible to do in Java without using the Reflection API. Let me start with an example input to the parser. GAME_TIME 10 would be sent to the parser to update the current state of the game timer to 10. I plan on creating a library of sorts that would handle basic things about the server, such as, how many players are currently online. The goal of the library is to make scripting these customized servers easier for server administrators. Now when I approached this problem first, I had the idea to create a HashMap&lt;String, String[]&gt; that would map the name of the command to an array of the argument types. For example, map.put("GAME_TIME", new String[]{"time:int"}); The problem that arose with this is that after receiving the command in some form, how do I act upon the data? One solution I came up with was to simply have a large switch statement that would match the commands and then call a method from there, but that renders the map pointless and would be a lot messier. I know there is a way to use reflection to call a method from its name, but I am not sure if that is an appropriate solution here, it would definitely look prettier and make the code much shorter (unless I am missing something). Any help would be appreciated. Here is the switch method way I currently have (and dislike). public class Parser { public List&lt;ServerEventReceiver&gt; receivers = new ArrayList&lt;&gt;(); public void addReceiver(ServerEventReceiver ser) { rece…
score: 0
answer count: 2
upvote count: 1

http://stackoverflow.com/comment/38794325
type: Comment
has text: Sotirios, I've updated the code as you've suggested. Now, I'm getting a 400 status. If I remove the Valid annotation, I can submit, but the validation still doesn't work. I've also tried using Valid annotation as the first param.
score: 0
comment on: http://stackoverflow.com/a/24958441
type: AnswerComment

http://stackoverflow.com/q/25051554
has answer: http://stackoverflow.com/a/25051574
downvote count: 0
tagged with: string
has title: How to insert a string into a 2D string array in Java?
has answer: http://stackoverflow.com/a/25051561
favorite count: 0
has comment: http://stackoverflow.com/comment/38967490
has comment: http://stackoverflow.com/comment/38967564
has answer: http://stackoverflow.com/a/25051581
type: AnsweredQuestion
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/25051561
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/38967623
has comment: http://stackoverflow.com/comment/38967560
tagged with: arrays
has comment: http://stackoverflow.com/comment/38967614
has body: I'm new to Java. String[][] data = new String[][]; data[0][0] = "Hello"; This does not work, so can anyone explain why and how to make it work? Well, in C++/Cli this works perfectly but not in Java. It says: cannot find symbol: class data
has comment: http://stackoverflow.com/comment/38967518
linked to: http://stackoverflow.com/q/12231453
possible better answer: http://stackoverflow.com/a/25051574
answer count: 3

http://stackoverflow.com/comment/38975655
has text: don't write "UserPermission.systemId". Only write "systemId"
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25055892
score: 0

http://stackoverflow.com/q/24919027
has body: I have a java.util.Map inside an rx.Observable and I want to filter the map (remove an element based on a given key). My current code is a mix of imperative and functional, I want to accomplish this goal without the call to isItemInDataThenRemove. public static Observable&lt;Map&lt;String, Object&gt;&gt; filter(Map&lt;String, Object&gt; data, String removeKey) { return Observable.from(data).filter((entry) -&gt; isItemInDataThenRemove(entry,removeKey)); } private static boolean isItemInDataThenRemove(Map&lt;String, Object&gt; data, String removeKey) { for (Map.Entry&lt;String,Object&gt; entry : data.entrySet()) { if(entry.getKey().equalsIgnoreCase(removeKey)) { System.out.printf("Found element %s, removing.", removeKey); data.remove(removeKey); return true; } } return false; }
favorite count: 0
has comment: http://stackoverflow.com/comment/38719218
has comment: http://stackoverflow.com/comment/38718740
type: UnansweredQuestion
tagged with: rx-java
upvote count: 1
tagged with: java
has answer: http://stackoverflow.com/a/24919729
has answer: http://stackoverflow.com/a/24922277
type: Question
answer count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/38768336
has title: Remove Element From Map Using Filter
has comment: http://stackoverflow.com/comment/38718894
score: 1

http://stackoverflow.com/comment/38778140
comment on: http://stackoverflow.com/q/24950737
score: 0
type: QuestionComment
type: Comment
has text: That's easy. The exception is probably `NetworkOnMainThreadException` or what's-it-called. Btw: try to avoid catch-alls (`catch(Exception ex)`)

http://stackoverflow.com/q/24979519
tagged with: graph
tagged with: performance
tagged with: java
has body: I am so close to implementing this myself, but before I do I would still want to know if that wheel already has been invented: what I need is a library that allows me to represent a DAG (directed acyclic graph) and which will allow to make queries about directly or indirectly connected nodes with very high performance. I have compared two approaches so far. The graph will be a couple of millions of nodes in size with about 10-20 million edges. Most nodes will only have one or two edges but a couple of thousand nodes may have 10000 edges or more. The use case would be: does not really matter what the effort to create the graph is, and once it has been created it does not need to get updated, or updates need not be fast. However, finding direct connections or specific indirect connections of length 2 (one intermediate node) should be very fast and edges should be able to have labels (e.g. weights, counts etc.). Also, the memory footprint should be small and querying should be thread-safe. I have experimented with using some standard software packages for this, e.g. Neo4J or relational databases, but both are way too slow for some of the things: relational databases grind to a crawl for finding indirect relations when nodes with a lot of edges are involved (huge join sets). Neo4j handles that case much better, but the basic speed of just finding a direct connection is thousands of times slower than in relational database solutions. On a workstation, relational databases can return results for direct and many indirect queries in less then 5ms, but certain indirect queries can take up to a minute. With Neo4j on the same system, those indirect queries just take a few seconds, but the direct queries all take longer than 100ms. I want to be able to get my direct queries to under one ms and the worst indirect ones to under 1 second (on average). I think when done cleverly, this could all be represented and carried out in-memory with just a few gigs of heap space, and even fo…
has title: Libraries for high performance, low footprint graph queries?
has answer: http://stackoverflow.com/a/24984343
type: UnansweredQuestion
score: 1
favorite count: 0
tagged with: relational-database
type: Question
has answer: http://stackoverflow.com/a/24986277
upvote count: 2
answer count: 2
downvote count: 1

http://stackoverflow.com/q/24986287
upvote count: 1
has answer: http://stackoverflow.com/a/24986295
accepted answer: http://stackoverflow.com/a/24986295
favorite count: 0
type: AnsweredQuestion
has body: I have the need to transform (rotate) a Rectangle2D.Double. However, I don't just need to draw the shape, I also need to keep the transformed rectangle as an object so that I can use .intersects() and other methods. This is the current way I am transforming it private Rectangle2D.Double transform(Rectangle2D.Double rect) { // make a new transform AffineTransform transform = new AffineTransform(); // apply the transformation transform.rotate(Math.toRadians(theta), rect.x + rect.width / 2, rect.y + rect.height / 2); // get the resulting Shape Shape s = transform.createTransformedShape(hitbox); //return the finalized Rectangle // ? } Now, one would think that the following would work Rectangle2D.Double newRect = new Rectangle2D.Double(); newRect.setFrame(transform.createTransformedShape(rect).getBounds2D()); However, when drawn this appears to not rotate the rect at all, but instead scale it by very large amounts (140 times as large). So the question is: How do I get that Shape, which by the way when drawn appears to be transformed correctly, into the correct form, which is a Rectangle2D.Double? If it isn't possible then what is a good alternative that still has the .intersects() and similar methods?
downvote count: 0
has title: What is the correct way to convert a Shape to a Rectangle2D.Double?
has comment: http://stackoverflow.com/comment/38844877
score: 1
tagged with: java
type: Question
answer count: 1

http://stackoverflow.com/comment/55404280
has text: Spring will do that for you. Just add this where you want it - `@Autowired private SessionFactory sessionFactory`
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/29571677
type: Comment

http://stackoverflow.com/q/24971215
tagged with: load-time-weaving
type: Question
score: 3
has body: I use fabric8-karaf-1.1.0.CR5 which includes: .../system/org/apache/felix/org.apache.felix.framework/4.0.3.redhat-610379/org.apache.felix.framework-4.0.3.redhat-610379.jar .../org.apache.felix.framework-4.0.0/doc/changelog.txt contains: ** New Feature * [FELIX-2959] - [Framework] Implement OSGi R4.3 class loader byte-code weaving hook I added to .../etc/startup.properties: igb/igb.osgi.weaving/1.0.0/igb.osgi.weaving-1.0.0.jar=1 My bundle's activator: package igb.osgi.weaving; import java.util.Hashtable; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; import org.osgi.framework.hooks.weaving.WeavingHook; public class Activator implements BundleActivator { public void start( BundleContext bc ) throws Exception { System.out.println( "Starting " + Activator.class.getName() ); // this doesn't work //bc.registerService( Weaver.class, new Weaver(), new Hashtable&lt;String, Object&gt;() ); // this is the proper way, see BJ Hargrave's accepted answer below bc.registerService( WeavingHook.class, new Weaver(), new Hashtable&lt;String, Object&gt;() ); } public void stop( BundleContext bc ) throws Exception { System.out.println( "Stopping " + Activator.class.getName() ); } } // Activator My WeavingHook: package igb.osgi.weaving; import org.osgi.framework.hooks.weaving.WeavingHook; import org.osgi.framework.hooks.weaving.WovenClass; public class Weaver implements WeavingHook { synchronized public void weave( WovenClass wc ) { System.out.println( "Weaving " + wc.getClassName() ); } } // Weaver .../system/igb/igb.osgi.weaving/1.0.0/igb.osgi.weaving-1.0.0.jar/META-INF/MANIFEST.MF: Manifest-Version: 1.0 Bnd-LastModified: 1406380868073 Build-Jdk: 1.7.0_51 Built-By: Geri Bundle-Activator: igb.osgi.weaving.Activator Bundle-ManifestVersion: 2 Bundle-Name: IGB OSGi Weaving Bundle-SymbolicName: igb.osgi.weaving Bundle-Version: 1.0.0 Created-By: Apache Maven Bundle Plugin Export-Package: igb.osgi.weaving;uses:="org.osgi.framework,org.osgi.fram ework.hooks.…
accepted answer: http://stackoverflow.com/a/24973401
downvote count: 0
answer count: 1
favorite count: 0
tagged with: apache-felix
tagged with: osgi
has title: Apache Felix OSGi framework's WeavingHook.weave() method isn't invoked
type: AnsweredQuestion
upvote count: 3
tagged with: java
has answer: http://stackoverflow.com/a/24973401

http://stackoverflow.com/a/24927144
type: Answer
accepted answer of: http://stackoverflow.com/q/24923880
score: 0
answers question: http://stackoverflow.com/q/24923880
upvote count: 1
downvote count: 1
has body: Base on MadProgramer comment Runtime.getRuntime().exec(new String[] {"cmd", "/c", "start", accessLinux.bat, argument1});
type: AcceptedAnswer

http://stackoverflow.com/q/24969517
type: UnansweredQuestion
tagged with: android
tagged with: java
type: Question
score: 4
has answer: http://stackoverflow.com/a/39934710
upvote count: 4
has title: How to store and receive a profile picture in Parse.com?
answer count: 1
downvote count: 0
favorite count: 0
tagged with: parsing
tagged with: parse-platform
has body: I am very new at parse.com. I have searches for hours how to create for a user a profile picture and I came with no result. I am know how to upload an image to Parse.com but I am not know how to recieve it. this is how I upload the image: // Save new user data into Parse.com Data Storage ParseUser user = new ParseUser(); user.setUsername(usernametxt); user.setPassword(passwordtxt); ByteArrayOutputStream stream = new ByteArrayOutputStream(); // Compress image to lower quality scale 1 - 100 photo.compress(Bitmap.CompressFormat.PNG, 100, stream); byte[] image = stream.toByteArray(); // Create the ParseFile ParseFile file = new ParseFile(usernametxt + ".png", image); // Upload the image into Parse Cloud file.saveInBackground(); // Create a New Class called "ImageUpload" in Parse ParseObject imgupload = new ParseObject("ImageUpload"); // Create a column named "ImageName" and set the string imgupload.put("ImageName", usernametxt); // Create a column named "ImageFile" and insert the image imgupload.put("ImageFile", file); // Create the class and the columns imgupload.saveInBackground(); // Show a simple toast message Toast.makeText(RegisterActivity.this, "Image Uploaded", Toast.LENGTH_SHORT).show(); user.signUpInBackground(new SignUpCallback() { public void done(ParseException e) { if (e == null) { // Show a simple Toast message upon successful registration Intent intent = new Intent( RegisterActivity.this, Welcome.class); startActivity(intent); finish(); } else { Toast.makeText(getApplicationContext(), "Sign up Error", Toast.LENGTH_LONG) .show(); } } }); } } this is how I recieve the image (don't work, cause to an Exception): ParseQuery query = ParseQuery.getQuery("ImageUpload"); query.whereEqualTo("ImageName",currentUser.getUsername()); query.getFirstInBackground(new GetCallback() { public void done(ParseObject object, ParseException e) { if (object != null) { Toast.makeText(Welcome.this, currentUser.getUsername(), Toast.LENGTH_SHORT).show(); ParseFile file = (ParseFile)…

http://stackoverflow.com/q/24963084
has answer: http://stackoverflow.com/a/30252908
has title: Java Client to Connect to Stash Repository
type: Question
has comment: http://stackoverflow.com/comment/38802470
upvote count: 1
answer count: 1
tagged with: bitbucket-server
has comment: http://stackoverflow.com/comment/53318244
tagged with: maven-plugin
favorite count: 0
has comment: http://stackoverflow.com/comment/41223541
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38801163
tagged with: git
downvote count: 0
score: 1
tagged with: java
has body: I am trying to programatically connect to a STASH repository from a Java class. I have had a look and I cannot find any Java clients to do this. Has anyone come across any? The reason I want to connect to a STASH repository is that I am writing a Maven plugin that will go to a Git repository in STASH and return a list of commits and then Jiras for a given tag. Any help would be greatly appreciated.

http://stackoverflow.com/comment/39196427
comment on: http://stackoverflow.com/a/25173846
type: AnswerComment
has text: I have used Fused Location Provider in this code so you don't have to switch between Network or GPS provider . See https://developer.android.com/google/play-services/location.html
score: 0
type: Comment

http://stackoverflow.com/a/25052322
score: 0
type: Answer
has body: From Google App Engine Java Runtime Environment: The sandbox To allow App Engine to distribute requests for applications across multiple web servers, and to prevent one application from interfering with another, the application runs in a restricted "sandbox" environment. In this environment, the application can execute code, store and query data in the App Engine datastore, use the App Engine mail, URL fetch and users services, and examine the user's web request and prepare the response. An App Engine application cannot: write to the filesystem. Applications must use the App Engine datastore for storing persistent data. Reading from the filesystem is allowed, and all application files uploaded with the application are available. respond slowly. A web request to an application must be handled within a few seconds. Processes that take a very long time to respond are terminated to avoid overloading the web server. make other kinds of system calls.
answers question: http://stackoverflow.com/q/25051419

http://stackoverflow.com/comment/38981258
comment on: http://stackoverflow.com/q/25058763
score: 0
type: Comment
has text: I don't think ss. Show us some of your servlet (declaration of class and variables)
type: QuestionComment

http://stackoverflow.com/comment/38855026
type: QuestionComment
has text: For clarity, just tell in which order your interceptors are invoked if any.
score: 0
comment on: http://stackoverflow.com/q/24990948
type: Comment

http://stackoverflow.com/q/25017973
linked to: http://stackoverflow.com/q/18434889
type: Question
has answer: http://stackoverflow.com/a/25018089
answer count: 1
downvote count: 0
favorite count: 0
tagged with: android
score: 2
upvote count: 2
type: UnansweredQuestion
tagged with: webview
has title: Android webview - keep alive in background and create notification on page update?
has body: I have a webview that I would like to keep alive in the background. Basically, I want to detect page updates to that webview, and display a notification when this occurs. Is this possible at all? I don't recall any attributes for webview keep-alive, and how would I detect a webview change? Would a service be involved? I'm very confused as to how I'd implement such an idea. By the way, my entire application is set up and it works, I just need to now keep the webview alive.
tagged with: java

http://stackoverflow.com/q/24964915
tagged with: java
has answer: http://stackoverflow.com/a/24964967
type: Question
upvote count: 4
downvote count: 4
tagged with: intellij-idea
score: 0
has title: Stop IntelliJ from generating @Override on interface implementations?
answer count: 1
favorite count: 0
has body: Is it possible to stop IntelliJ Idea from generating the @Override annotation on generated interface implementations? I'm interested in not having to manually delete these annotations whenever they're generated because I generate them often and it's a pain.
type: UnansweredQuestion

http://stackoverflow.com/comment/38968270
type: AnswerComment
has text: I have tried it the other way too, that is, while(rsmo.next() || rsms.next()), the same exception occurs. Also, you do have a point, but it skips the resultset for oracle, even when i execute it separately. I thank you for pointing out the flaw in my logic. I fill fix it by doing 2 while loops, but the problem still persists!
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25051919

http://stackoverflow.com/q/24995088
has comment: http://stackoverflow.com/comment/38861358
tagged with: generics
tagged with: variadic-functions
favorite count: 0
has title: Why can't the annotation @SafeVarargs be applied to non-final instance methods?
has comment: http://stackoverflow.com/comment/38861473
score: 19
has answer: http://stackoverflow.com/a/24995281
accepted answer: http://stackoverflow.com/a/24995281
type: AnsweredQuestion
downvote count: 0
tagged with: java
linked to: http://stackoverflow.com/q/7728971
type: Question
has comment: http://stackoverflow.com/comment/38861835
upvote count: 19
has body: Why can't the annotation @SafeVarargs be applied to non-final instance methods?
answer count: 1

http://stackoverflow.com/q/25052263
has comment: http://stackoverflow.com/comment/38969629
accepted answer: http://stackoverflow.com/a/25052323
has comment: http://stackoverflow.com/comment/38968897
has comment: http://stackoverflow.com/comment/38968938
favorite count: 0
has title: Why is writing data to disk as fast as keeping it in-memory?
has answer: http://stackoverflow.com/a/25052323
tagged with: io
upvote count: 18
has comment: http://stackoverflow.com/comment/38970487
has comment: http://stackoverflow.com/comment/38968903
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/25052367
downvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/25052367
has comment: http://stackoverflow.com/comment/38969200
type: Question
has body: I have the following 10000000x2 matrix: 0 0 1 1 2 2 .. .. 10000000 10000000 Now I want to save this matrix to int[][] array: import com.google.common.base.Stopwatch; static void memory(int size) throws Exception { System.out.println("Memory"); Stopwatch s = Stopwatch.createStarted(); int[][] l = new int[size][2]; for (int i = 0; i &lt; size; i++) { l[i][0] = i; l[i][1] = i; } System.out.println("Keeping " + size + " rows in-memory: " + s.stop()); } public static void main(String[] args) throws Exception { int size = 10000000; memory(size); memory(size); memory(size); memory(size); memory(size); } The output: Keeping 10000000 rows in-memory: 2,945 s Keeping 10000000 rows in-memory: 408,1 ms Keeping 10000000 rows in-memory: 761,5 ms Keeping 10000000 rows in-memory: 543,7 ms Keeping 10000000 rows in-memory: 408,2 ms Now I want to save this matrix to disk: import com.google.common.base.Stopwatch; import java.io.BufferedOutputStream; import java.io.FileOutputStream; static void file(int size, int fileIndex) throws Exception { Stopwatch s = Stopwatch.createStarted(); FileOutputStream outputStream = new FileOutputStream("D:\\file" + fileIndex); BufferedOutputStream buf = new BufferedOutputStream(outputStream); for (int i = 0; i &lt; size; i++) { buf.write(bytes(i)); buf.write(bytes(i)); } buf.close(); outputStream.close(); System.out.println("Writing " + size + " rows: " + s.stop()); } public static void main(String[] args) throws Exception { int size = 10000000; file(size, 1); file(size, 2); file(size, 3); file(size, 4); file(size, 5); } The output: Writing 10000000 rows: 715,8 ms Writing 10000000 rows: 636,6 ms Writing 10000000 rows: 614,6 ms Writing 10000000 rows: 598,0 ms Writing 10000000 rows: 611,9 ms Shouldn't be saving to memory much faster?
score: 18
answer count: 2

http://stackoverflow.com/a/25055542
has comment: http://stackoverflow.com/comment/42431425
upvote count: 8
has comment: http://stackoverflow.com/comment/42431731
answers question: http://stackoverflow.com/q/25055375
score: 8
has body: Variables declared within a method are stored within the stack, while the actual objects are stored on the heap. Consider Integer a = new Integer(10); In this example, an object of type Integer is created on the heap and a reference (either 32 or 64bits) is returned and stored within the methods stack as variable 'a'. The JVM is free to keep variables like this within the CPU registers if it prefers as an optimization. Memory of an object is allocated when the new keyword is used. It is usually assigned within the TLAB (thread local allocation buffer) which is part of the eden heap reserved to the running thread. Thus reducing the overheads of object allocation to a simple 'bump of a pointer'. The two times when the TLAB is not used, is 1) when the object is too large for the space remaining, inwhich case it will be promoted straight to the old gen and 2) when a supporting JVM decides via escape analysis that it can avoid the object entirely and allocate directly on to the stack (or even break the object apart and only assign the fields required on the stack). The amount of memory reserved consists of an object header, usually 2 words (3 for an array) and then space for each of the fields declared in the object and its parent classes. The total size of those fields depends on the JVM and the underlying platform (eg 32 bit or 64 bit) and JVM configuration such as compressed references. ------------------+------------------+------------------ +-------------------------- | mark word | klass pointer | array size (opt) | padding and fields | ------------------+------------------+-------------------+-------------------------- Asking the JVM for sizes is not officially supported, but EHCache sizeOf is a very good 'best guess' that uses knowledge of different JVMs and access to the underlying pointers via the use of Java Unsafe. The starting place for understanding the size of each field is the size of primitives defined by the Java language, however this is only the minimu…
type: Answer
downvote count: 0

http://stackoverflow.com/comment/38939548
type: AnswerComment
score: 0
type: Comment
has text: @Frisbetarian Ok, but what is the most external layout in this xml file? Is it `RelativeLayout`? If so, please do `RelativeLayout v1 = (RelativeLayout)vi.inflate(R.layout.make_question, null);` instead of `View v1 = vi.inflate(R.layout.make_question, null);`. If it's `LinearLayout` or anything else, just change my `RelativeLayout` to whatever type your layout is.
comment on: http://stackoverflow.com/a/25035053

http://stackoverflow.com/comment/38928310
has text: My bad, I missed that getString is final. Feel free to add your comment as an answer in order you get the credits.
comment on: http://stackoverflow.com/q/25030576
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/38787015
comment on: http://stackoverflow.com/a/24955557
type: Comment
score: 0
type: AnswerComment
has text: you should add an answer yourself. so that people dont ask this same question again and again.@Sk4llsRPG

http://stackoverflow.com/comment/38956852
comment on: http://stackoverflow.com/q/25045561
has text: Why do you return when a value smaller than the first is found (second code)?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38871037
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25000316
has text: The other reason for such an error is that you're loading a 64-bit module while running as a 32-bit app.

http://stackoverflow.com/a/24988861
has comment: http://stackoverflow.com/comment/39072282
has body: Instead of registering a receiver in manifest, you can register and unregister it at runtime as follows: Also make sure you register your receiver with correct Action in Intent Filter. public class MyActivity extends Activity{ // used to listen for intents which are sent after a task was // successfully processed private BroadcastReceiver mUpdateReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { new UpdateUiTask().execute(); } }; @Override public void onResume() { registerReceiver(mUpdateReceiver, new IntentFilter( YOUR_INTENT_ACTION)); super.onResume(); } @Override public void onPause() { unregisterReceiver(mUpdateReceiver); super.onPause(); } // used to update the UI private class UpdateUiTask extends AsyncTask&lt;Void, Void, String&gt; { @Override protected void onPreExecute() { } @Override protected String doInBackground(Void... voids) { Context context = getApplicationContext(); String result = "test"; // Put the data obtained after background task. return result; } @Override protected void onPostExecute(String result) { // TODO: UI update } } } Hope it helps.
score: 6
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/24931776
has comment: http://stackoverflow.com/comment/39069768
upvote count: 6

http://stackoverflow.com/q/25001079
tagged with: java
has comment: http://stackoverflow.com/comment/38879405
type: Question
has title: Having multiple URL rewriting in one backend in HAProxy
has body: I have to implement a scenario where we will be having only one backend with 3 servers. Out of 3, for 2 servers will accept different URL pattern. So we are using "reqirep" to replace the string in incoming request and change it to the pattern acceptable by server 1&amp;2.And Server3 accepts only the original incoming request pattern. Now, the problem is that once the request comes it's been replaced by pattern given in "reqirep" so server3 is not accepting the request. How to have "reqirep" apply only to server1&amp;2 and original request apply to server3 inside single backend in haproxy?
score: 0
has comment: http://stackoverflow.com/comment/38880599
tagged with: high-availability
has comment: http://stackoverflow.com/comment/38886051
tagged with: linux
type: UnansweredQuestion
tagged with: haproxy
answer count: 0

http://stackoverflow.com/a/25028726
type: Answer
has comment: http://stackoverflow.com/comment/38924805
has body: Sounds like your image is corrupted. Delete it from the drawable folder and replace it with a new one. I've had a similar issue before. It was due to a corrupted image file. I don't know why android reported the ImageView class could not be found and I haven't had any desire to dig through the source code to find out but that's what it was for me.
accepted answer of: http://stackoverflow.com/q/25028669
answers question: http://stackoverflow.com/q/25028669
score: 0
type: AcceptedAnswer

http://stackoverflow.com/q/24957752
has body: public render(){ ... while (y &lt; Height){ while(x &lt; Width){ batch.draw(bg,x,y,bg.getWidth()/ratio,bg.getHeight()/ratio); x += bg.getWidth()/ratio; } y += bg.getHeight()/ratio; x = 0; } ... } I have a pattern texture(bg) which will repeat to make a repeated background, so i make it repeated in render function (code above). At first it works very well, but when the ratio get bigger (so the sprite get smaller to fit the background), it become very laggy. Can you tell me a right way to make repeated background like above code without affect performance.
score: 2
type: AnsweredQuestion
tagged with: opengl
tagged with: java
accepted answer: http://stackoverflow.com/a/24958703
type: Question
tagged with: graphics
tagged with: libgdx
has title: What is a right way to render repeated-background in libgdx?
answer count: 2
possible better answer: http://stackoverflow.com/a/24958758
downvote count: 0
has answer: http://stackoverflow.com/a/24958758
favorite count: 0
upvote count: 2
has answer: http://stackoverflow.com/a/24958703

http://stackoverflow.com/comment/38952442
has text: What if you had a smaller `String`?
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25043508

http://stackoverflow.com/comment/38826500
type: Comment
has text: I got the problem.. obviously, because I had many panels, I forgot to set the layout of the parent panel to borderlayout... now all is ok.. thanks.
comment on: http://stackoverflow.com/a/24976479
score: 0
type: AnswerComment

http://stackoverflow.com/comment/38773201
type: Comment
type: QuestionComment
has text: I guess `arr[1:]` starts from 1 and `arr[0:]` stars from 0 @markspace
score: 0
comment on: http://stackoverflow.com/q/24948099

http://stackoverflow.com/q/24910006
has answer: http://stackoverflow.com/a/45088499
has title: Bukkit nullpointer config
type: UnansweredQuestion
tagged with: java
type: Question
has body: I am making a bukkit plugin that uses a config to store data, but when I use plugin.getConfig() I get a NullPointer. Why? The NullPointer is in the Storage class. Main: http://pastebin.com/d3bFXbiR Storage: http://pastebin.com/wvQS3n57
has answer: http://stackoverflow.com/a/24910348
score: 0
answer count: 2

http://stackoverflow.com/comment/38751394
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24936775
type: Comment
has text: ServletContext (Application scope variable) is a good option.

http://stackoverflow.com/comment/39150548
type: Comment
has text: You are right. My point is that the implementor is free to implement in any way they see fit. So the question is like how do vehicles travel - some use wheels, some use wings. You are free to come up with new vehicle implementations.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25129834

http://stackoverflow.com/comment/38782393
has text: You need to provide the code where this is happening.
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/24953080

http://stackoverflow.com/a/25041611
downvote count: 0
has comment: http://stackoverflow.com/comment/38948737
upvote count: 2
has comment: http://stackoverflow.com/comment/38949068
has body: You can declare your class as follows: public class TrafficReportMapper&lt;T extends TrafficReport&gt; implements RowMapper&lt;TrafficReport&gt; ... assuming: interface RowMapper&lt;T&gt; { public T mapRow(ResultSet rs, int rowNum); ... } Then if you have: class TrafficReport{} ...and... class DayTrafficReport extends TrafficReport{} You can initialize as such: TrafficReportMapper&lt;DayTrafficReport&gt; trm = new TrafficReportMapper&lt;DayTrafficReport&gt;();
type: Answer
answers question: http://stackoverflow.com/q/25041520
score: 2
has comment: http://stackoverflow.com/comment/38949205

http://stackoverflow.com/q/25005122
has body: I am looking for a way to find out which one of these xterm, konsole, aterm, gnome-terminal terminal applications are present on Linux distro or a default one at runtime within a java program. It is required to execute certain commands from my java program and so need to know which terminal to use or at least if it is present and can be used. xterm can be used by default but would be good to know if there is something more advanced available to use. Even there is no guarantee if xterm is installed either.
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/38880046
has comment: http://stackoverflow.com/comment/38880176
favorite count: 0
has title: Get default terminal application on linux system using Java
tagged with: terminal
tagged with: linux
has answer: http://stackoverflow.com/a/27512427
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38880103
has comment: http://stackoverflow.com/comment/38880068
upvote count: 3
type: Question
has comment: http://stackoverflow.com/comment/38880209
score: 3
tagged with: java
has comment: http://stackoverflow.com/comment/38880364

http://stackoverflow.com/q/24982733
upvote count: 2
downvote count: 1
has title: Can not instantiate value of type from json string
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json
accepted answer: http://stackoverflow.com/a/24984374
type: Question
answer count: 1
tagged with: jax-rs
tagged with: jackson
has body: I have bidirection many to many relationship between users and groups . @Entity @Table(name = "UserTBL") public class User { @Id @SequenceGenerator(name = "user_generator", sequenceName = "user_seq", allocationSize = 1, initialValue = 1) @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "user_generator") private Long id; private String username; private String password; @ManyToMany private List&lt;Group&gt; groups; } @Entity @Table(name = "GroupTBL") public class Group { @Id @SequenceGenerator(name = "Group_generator", sequenceName = "group_seq", allocationSize = 1, initialValue = 1) @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "Group_generator") private Long id; private String name; private String description; @ManyToMany(mappedBy = "groups") private List&lt;User&gt; users; } I am developing angular js applicaton with java jax-rs web service and I am handling json binding using jackson but i am getting this exception : Can not instantiate value of type [simple type, class com.blog.models.Group] from JSON String; no single-String constructor/factory method (through reference chain: com.blog.models.User["groups"]) This is my json object sent to the server : { "groups":[ "{\"id\":1,\"name\":\"admin\",\"description\":null,\"users\":[]}", "{\"id\":2,\"name\":\"user\",\"description\":null,\"users\":[]}" ], "username":"hussien", "password":"ammar" } Resource : @Stateless @Path("/users") public class UserResource { @EJB private UserFacade userFacade; @POST @Consumes(MediaType.APPLICATION_JSON) public void createUser(User user) { userFacade.create(user); } }
favorite count: 0
has answer: http://stackoverflow.com/a/24984374

http://stackoverflow.com/q/24930274
has comment: http://stackoverflow.com/comment/38739223
has comment: http://stackoverflow.com/comment/38739056
has comment: http://stackoverflow.com/comment/38739889
type: Question
accepted answer: http://stackoverflow.com/a/24930422
tagged with: java
has body: Regular for-loop for (int i = 0; i &lt; 10; i++) { // ... if (iWantToRepeat) { i--; continue; } // ... } Enhanced for-loop for (Foo f : Bar) { // ... if (iWantToRepeat) { // What can I put here? } // ... } Is there any way to repeat an iteration of an enhanced for-loop? I get the feeling there might be because it's based on iterators and if I had access to them I could do it I think.
score: 4
possible better answer: http://stackoverflow.com/a/24930384
upvote count: 4
has answer: http://stackoverflow.com/a/24930422
tagged with: for-loop
has comment: http://stackoverflow.com/comment/38738976
downvote count: 0
has comment: http://stackoverflow.com/comment/38739011
has comment: http://stackoverflow.com/comment/38739916
has comment: http://stackoverflow.com/comment/38740032
favorite count: 0
has title: Repeat iteration in enhanced-for loop
answer count: 3
has comment: http://stackoverflow.com/comment/38739015
has answer: http://stackoverflow.com/a/24930395
has answer: http://stackoverflow.com/a/24930384
has comment: http://stackoverflow.com/comment/38739819
has comment: http://stackoverflow.com/comment/38739366
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38739973

http://stackoverflow.com/comment/38820691
has text: what is turn? I don't see it defined.
comment on: http://stackoverflow.com/a/24973584
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/24960934
tagged with: java
has body: I wondering that a Hashmap handle the value once the Key is same. I insert 2 element with same key using put method. if there is no value exist it return null otherwise it return the privous value shored. does hashMap does not store multiple value for same Key public class geekarray { HashMap&lt;Integer, String&gt; a ; geekarray(){ a= new HashMap&lt;Integer,String&gt;(10); System.out.println(a.put(1, "yogi")); System.out.println(a.put(1, "yogi2")); System.out.println(a.put(2, "yogi3")); } public static void main(String s[]){ geekarray a = new geekarray(); } } Output:- null yogi null
has answer: http://stackoverflow.com/a/24960950
favorite count: 0
score: 0
has answer: http://stackoverflow.com/a/24960979
has title: Collision is Hashmap collection in Java
duplicate of: http://stackoverflow.com/q/4956844
answer count: 4
type: UnansweredQuestion
upvote count: 1
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/24960988
tagged with: hashmap
has answer: http://stackoverflow.com/a/24960990
linked to: http://stackoverflow.com/q/4956844

http://stackoverflow.com/comment/38894621
has text: Well yes, except that the OP is actually using `static` methods here, so the "instance variable" needs to be a `static` variable.
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/25012674
type: Comment

http://stackoverflow.com/comment/39001702
has text: Assuming that the problem goes away if you switch to Twenty Fourteen, the next place would be `single-product.php` in the theme's folder. But since the `#left-area` div is the last thing to render you know the problem is in whatever comes immediately after that.
type: AnswerComment
comment on: http://stackoverflow.com/a/24973644
type: Comment
score: 1

http://stackoverflow.com/comment/77151287
type: AnswerComment
has text: Will a Servlet Filter run before the WebSocket Handshake or not even then?
type: Comment
comment on: http://stackoverflow.com/a/24919928
score: 0

http://stackoverflow.com/comment/38942074
comment on: http://stackoverflow.com/a/25037787
type: AnswerComment
type: Comment
score: 2
has text: Don't you want the first byte (most significant) to be 0? If you convert a 16-bit integer to a 24-bit integer by adding 0's to the end, you make the number bigger.

http://stackoverflow.com/comment/38925544
type: QuestionComment
comment on: http://stackoverflow.com/q/25023521
score: 0
has text: A similar problem: http://stackoverflow.com/questions/2478447/find-largest-rectangle-containing-only-zeros-in-an-n×n-binary-matrix
type: Comment

http://stackoverflow.com/q/24910610
possible better answer: http://stackoverflow.com/a/24911044
has comment: http://stackoverflow.com/comment/38701782
has comment: http://stackoverflow.com/comment/38701903
has answer: http://stackoverflow.com/a/24911044
has answer: http://stackoverflow.com/a/24910783
type: AnsweredQuestion
has body: I am new to hibernate, I now how to connect Local DB from hiibenate.cfg ,but now I want to access DB which is not local?? how can I can any one help me??
tagged with: java
tagged with: hibernate
has title: Hibernate:Connections could not be acquired from the underlying database
type: Question
accepted answer: http://stackoverflow.com/a/24910783
tagged with: sql-server-2008-r2
score: 0
answer count: 2

http://stackoverflow.com/q/25002513
type: Question
has title: Could not create file error in NetBeans/Ant
tagged with: java-8
has answer: http://stackoverflow.com/a/25002752
tagged with: build
tagged with: netbeans
has body: I am using NetBeans 8.0 and JDK 1.8 with MySQL driver 5.1.31. While clean and build output window shows error -> ant -f "E:\\under construction\\cps" -Dnb.internal.action.name=rebuild clean jar init: deps-clean: Updating property file: E:\under construction\cps\build\built-clean.properties Deleting directory E:\under construction\cps\build clean: init: deps-jar: Created dir: E:\under construction\cps\build E:\under construction\cps\nbproject\build-impl.xml:893: Could not create E:\under construction\cps\build\built-jar.properties BUILD FAILED (total time: 0 seconds) and that line 893 in xml file shows -> 891: &lt;target depends="init,-deps-jar-init" name="deps-jar" unless="no.deps"&gt; 892: &lt;mkdir dir="${build.dir}"/&gt; 893: &lt;touch file="${built-jar.properties}" verbose="false"/&gt; 894: &lt;property file="${built-jar.properties}" prefix="already.built.jar."/&gt; 895: &lt;antcall target="-warn-already-built-jar"/&gt; 896: &lt;propertyfile file="${built-jar.properties}"&gt; 897: &lt;entry key="${basedir}" value=""/&gt; 898: &lt;/propertyfile&gt; 899: &lt;/target&gt;
score: 0
tagged with: java
answer count: 3
has answer: http://stackoverflow.com/a/53225811
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/40388495
has answer: http://stackoverflow.com/a/25124251
has comment: http://stackoverflow.com/comment/38875082

http://stackoverflow.com/comment/38873351
type: AnswerComment
score: 0
type: Comment
has text: This is good it fixes the problem,however how would i put all of this information into a "table" on the JOptionPane in one display?
comment on: http://stackoverflow.com/a/25001541

http://stackoverflow.com/q/25012893
has comment: http://stackoverflow.com/comment/38897578
accepted answer: http://stackoverflow.com/a/25013037
downvote count: 0
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/38894679
tagged with: nullpointerexception
tagged with: android
has title: Set the value of a TextView, from an Alert
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/38894697
type: Question
has body: I've got a Fragment (ActionBar Activity with 3 tabs) with a TextView There is also a Button which open an Alert, in which there is Button and an EditText What i would like to do, is to set the value of the Fragment's TextView to the value of the Alert's EditText, when clicking on the Button. Here is what i tried to do (the method i show you is in the MAinActivity and not in the Fragment) : public void showTimePicker(Button but) { final Dialog dialog = new Dialog(this); final TimePicker t; dialog.setContentView(R.layout.alert_time); dialog.setTitle("Heure"); Button dialogButton = (Button) dialog.findViewById(R.id.dialogButtonOK); dialogButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { TimePicker t = (TimePicker) dialog.findViewById(R.id.time_cri); /* THIS LINE MAKE A NULLPOINTEREXCEPTION */ time.setText(getSelectedTime(t)); /* GET THE TIME FROM TIMEPICKER */ dialog.dismiss(); } }); CriFragment f = (CriFragment) mSectionsPagerAdapter.getItem(2); time = f.getTextView(); /* GETTER OF THE TEXTVIEW I'D LIKE TO SET */ dialog.show(); } The line i pointed out make a nullPointerException (at onClick()) Thank you for reading !
tagged with: android-fragments
has answer: http://stackoverflow.com/a/25013037
has comment: http://stackoverflow.com/comment/38894704

http://stackoverflow.com/comment/38973698
comment on: http://stackoverflow.com/q/25036039
has text: The jar has been generated using maven then it should have a standard structure. In the current case, the file is at the root of jar and there is no src/main folder. Only META-INF and x/y/z/*.class. Anyway, I tried to put it in META-INF and /resources in the jar. Still not working :S
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/38928306
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25030274
has text: The code you did type worked for me so i'm good. Anyways I'll see you around.
type: AnswerComment

http://stackoverflow.com/a/25044099
answers question: http://stackoverflow.com/q/25044052
type: Answer
has comment: http://stackoverflow.com/comment/38953582
has comment: http://stackoverflow.com/comment/38953492
has body: Not sure what this has to do with twitter, but anyway, the issue is that you do not have the correct class files. In other words, when you are running your fat JAR in the command prompt, you do not have any libraries exported with it (Or if you do, you don't have that specific one). Sometimes such an error can be because there is an incorrect version of java, however that is not the case here since java has got no "twitter" packages or classes in it. Using something like JarSplice would fix this.
has comment: http://stackoverflow.com/comment/38953547
has comment: http://stackoverflow.com/comment/38953523
score: 0
has comment: http://stackoverflow.com/comment/38953569
has comment: http://stackoverflow.com/comment/38953472

http://stackoverflow.com/a/24930997
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/38744646
has comment: http://stackoverflow.com/comment/38744007
type: Answer
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/38744811
has body: This is the spinnerinflate.xml In your code you can set the custom Layout for spinner as MyAdapter myAdapter = new MyAdapter(this, R.layout.spinnerinflate, arraylist); spinner.setAdapter(myAdapter); You can use SimpleAdapter as well if you don't need to have your own adapter as below ArrayAdapter<String> simpleadapter = new ArrayAdapter<String>(YourActivityName.this, R.layout.spinnerinflate, getResources().getStringArray(R.array.yourarray)); spinner.setAdapter(simpleadapter); By this inflate you can do whatever formatting you want. Please let me know if it helps.
answers question: http://stackoverflow.com/q/24930816
accepted answer of: http://stackoverflow.com/q/24930816

http://stackoverflow.com/comment/38919143
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25024729
has text: @brownEyes If the user is entering the address as a single string then you'll have to parse out the street address from the city, state, and zip, which is impossible in the general case if it was a foreign address. Better to ask the user to enter them separately.
score: 0

http://stackoverflow.com/q/25028669
has answer: http://stackoverflow.com/a/25029403
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38924657
possible better answer: http://stackoverflow.com/a/25029403
has comment: http://stackoverflow.com/comment/38924670
downvote count: 1
has comment: http://stackoverflow.com/comment/38924600
type: Question
accepted answer: http://stackoverflow.com/a/25028726
has body: When I run this code on my Nexus 5 it crashes on startup and I do not know why. Here is a screenshot of the preview window: My code: MainActivity.java: package com.example.coolfreewallpapers; import java.io.IOException; import java.io.InputStream; import android.app.Activity; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.os.Bundle; android.view.View; import android.view.View.OnClickListener; import android.view.Window; import android.view.WindowManager; import android.widget.Button; import android.widget.ImageView; public class MainActivity extends Activity implements OnClickListener { ImageView display; int toPhone; @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); // check if next two lines are necessary requestWindowFeature(Window.FEATURE_NO_TITLE); // gets rid of app title getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); if (android.os.Build.VERSION.SDK_INT>=11) { getWindow().setFlags( WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED, WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED); } setContentView(R.layout.wallpaper); toPhone = R.drawable.one; display = (ImageView) findViewById(R.id.IVdisplay); ImageView one = (ImageView) findViewById(R.id.IVimage1); ImageView two = (ImageView) findViewById(R.id.IVimage2); ImageView three = (ImageView) findViewById(R.id.IVimage3); ImageView four = (ImageView) findViewById(R.id.IVimage4); ImageView five = (ImageView) findViewById(R.id.IVimage5); ImageView six = (ImageView) findViewById(R.id.IVimage6); ImageView seven = (ImageView) findViewById(R.id.IVimage7); ImageView eight = (ImageView) findViewById(R.id.IVimage8); ImageView nine = (ImageView) findViewById(R.id.IVimage9); ImageView ten = (ImageView) findViewById(R.id.IVimage10); ImageView eleven = (ImageView) findViewById(R.id.IVimage11); ImageView twelve = (ImageView) findViewById(R.…
has comment: http://stackoverflow.com/comment/38924633
tagged with: java
has comment: http://stackoverflow.com/comment/38924798
score: -1
tagged with: eclipse
answer count: 2
upvote count: 0
has comment: http://stackoverflow.com/comment/38924608
favorite count: 0
has comment: http://stackoverflow.com/comment/38925048
has answer: http://stackoverflow.com/a/25028726
tagged with: android
has title: Android App Crashes on Startup unknown reason

http://stackoverflow.com/comment/38814275
score: 0
type: AnswerComment
type: Comment
has text: The problems comes when I want to download HTML as it would be if I were Logged in (But of course I'm not, it just downloads the login page). And I don't know how to kind of progmatically login, so that I can download the HTML as it would be after I've logged in
comment on: http://stackoverflow.com/a/24970205

http://stackoverflow.com/a/24967451
has comment: http://stackoverflow.com/comment/38809224
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/24967444
downvote count: 0
has body: You can create various Java code templates in Eclipse via the Window->Preferences->Java -> Editor -> Templates

http://stackoverflow.com/comment/38918004
comment on: http://stackoverflow.com/q/25024923
type: Comment
has text: @immibis No I didn't. Added it to the question.
score: 0
type: QuestionComment

http://stackoverflow.com/q/25027957
downvote count: 1
has title: BouncyCastle Library in ColdFusion 10
has comment: http://stackoverflow.com/comment/38959126
favorite count: 0
tagged with: bouncycastle
has comment: http://stackoverflow.com/comment/39002768
type: UnansweredQuestion
tagged with: coldfusion-10
has comment: http://stackoverflow.com/comment/39037063
has body: I've been trying to get RSA Private Key Encryption working in ColdFusion 10 and installed the BouncyCastle library since it supports the encryption mode that my application requires. Trying to load the library with JavaLoader resulted in errors ("Class is on the bootclasspath" and "JCE cannot authenticate the provider BC") so I had to install it statically... Copy the jar to %CF_ROOT%/jre/lib/ext/ and add the following to %CF_ROOT%/jre/lib/security/java.security: security.provider.&lt;N&gt;=org.bouncycastle.jce.provider.BouncyCastleProvider Without realizing it at the time, I had also removed the library from the code but statements that use the library still worked: var privateKey = createObject("java", "org.bouncycastle.util.io.pem.PemReader").init( createObject("java", "java.io.FileReader").init(LOCAL.privateKeyPath) ).readPemObject().getContent(); So either I permanently installed BouncyCastle in my ColdFusion install, or it comes included in ColdFusion. I've since removed the static provider installation and encryption using the "BC" provider continues to work without modification. If BouncyCastle is bundled with CF then that's great, but on another machine running an equally updated version of ColdFusion (CF10 update 13), the createObject statement is failing because it can't find the PemReader class. I've googled my eyes bloody and cannot find any documentation on BouncyCastle being included in any version of CF - except for a clause about BouncyCastle in the CF10 EULA. The question is this: Is BouncyCastle included in CF10 and if so, how do I make sure it's enabled?
tagged with: coldfusion
score: 2
tagged with: java
type: Question
upvote count: 3
has answer: http://stackoverflow.com/a/25066887
answer count: 1

http://stackoverflow.com/comment/38965291
score: 0
comment on: http://stackoverflow.com/q/25050210
type: QuestionComment
has text: If `newList` is updated after calling the method, it could change the value of `list` as well (if you use `replaceListB`). Depending on the situation, you might want that to happen or you might not.
type: Comment

http://stackoverflow.com/comment/38873674
type: AnswerComment
comment on: http://stackoverflow.com/a/24998576
has text: Servlets! Ok, maybe that is the magic thing that connects the two. Thank you. I will order and read that book. I looked over the page you linked to and that sounds like it is related.
type: Comment
score: 0

http://stackoverflow.com/comment/38931583
comment on: http://stackoverflow.com/a/25026095
has text: I added some explanation.
score: 0
type: Comment
type: AnswerComment

dining-philosopher
type: Tag
tag name: dining-philosopher
tags question: http://stackoverflow.com/q/25050574

http://stackoverflow.com/comment/38978986
type: Comment
type: QuestionComment
has text: Print value of uid/account name+password for sd card & local storage. I think it treats as a different app while moving app between local to sd & vice versa
score: 1
comment on: http://stackoverflow.com/q/24926812

http://stackoverflow.com/a/24952127
upvote count: 1
downvote count: 0
type: Answer
has body: Check this below tutorials, it will help you. http://soasecurity.org/2012/05/29/configure-shibboleth-as-saml2-idp/ http://soasecurity.org/2014/12/04/federatation-shibboleth/ Best of luck!!!
answers question: http://stackoverflow.com/q/24926098
score: 1

http://stackoverflow.com/comment/69535779
type: Comment
has text: You got this working using in-memory broker or remote JMS broker?
type: AnswerComment
comment on: http://stackoverflow.com/a/25021358
score: 0

http://stackoverflow.com/a/24998327
type: Answer
upvote count: 6
has comment: http://stackoverflow.com/comment/38866856
answers question: http://stackoverflow.com/q/24998237
has body: May I suggest project Lombok? One of its features is creating trivial default getters and setters unless you explicitly override them with your own.
downvote count: 0
score: 6

http://stackoverflow.com/comment/38995485
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25065061
score: 0
has text: In squareMultiply, you are introducing double z in an algorithm dealing with integers. Why, and: is this numerically "safe"?

http://stackoverflow.com/comment/38933998
type: QuestionComment
comment on: http://stackoverflow.com/q/25033896
has text: seems like the parent table doesn't has entry for TRACK_ID that you'r trying to ref in the child table
score: 0
type: Comment

http://stackoverflow.com/comment/38955877
type: Comment
type: QuestionComment
score: 2
has text: This is java not JavaScript.
comment on: http://stackoverflow.com/q/25045237

http://stackoverflow.com/comment/38863843
type: Comment
has text: 1. It's binary. But it contains lines with information i need as non binary values. 2. I get the data from a webserver.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24996180

http://stackoverflow.com/comment/38737832
type: QuestionComment
score: 0
has text: Try http://stackoverflow.com/questions/6179621/eclipse-dynamic-web-project-not-picking-up-changes-in-jsp-or or http://stackoverflow.com/questions/4952347/why-isnt-eclipse-deploying-my-dynamic-web-project-correctly
comment on: http://stackoverflow.com/q/24929072
type: Comment

opennlp
type: Tag
tags question: http://stackoverflow.com/q/25017076
tags question: http://stackoverflow.com/q/24999186
tag name: opennlp
tags question: http://stackoverflow.com/q/25035486

http://stackoverflow.com/comment/38808511
comment on: http://stackoverflow.com/q/24967089
score: 0
type: Comment
type: QuestionComment
has text: post an example please

http://stackoverflow.com/comment/38835202
type: QuestionComment
has text: I'm not sure what it means either! I think I'll reply to that question in the hope of getting an update. In the meantime, I managed to get the fat jar to run the report, but then the fonts are not showing! But they are in the normal jar. Must be some kind of bug. Thanks for your help anyway.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/24961180

http://stackoverflow.com/a/25084996
answers question: http://stackoverflow.com/q/24918802
has body: The only way to resolve this situation is change JAAS by Spring Security :)
accepted answer of: http://stackoverflow.com/q/24918802
type: AcceptedAnswer
score: 0
type: Answer

http://stackoverflow.com/comment/80509382
type: QuestionComment
has text: For Java 8 drop the slash on the JDK INSTALLDIR parameter: CALL D:\Installer\JAVA8\jdk-8u144-windows-x64.exe /s ADDLOCAL="ToolsFeature" INSTALLDIR="D:\Prereqs\Java-64\jdk" /L "C:\Users\Desktop\JAVA_64_SDK_INSTALL_Logs.txt"
score: 1
comment on: http://stackoverflow.com/q/25017551
type: Comment

http://stackoverflow.com/comment/39091339
comment on: http://stackoverflow.com/a/24933429
type: AnswerComment
score: 0
type: Comment
has text: I tried to work with your above suggested solution. But it has changed my output from [IMG]http://i62.tinypic.com/swrepc.png[/IMG] to [IMG]http://i62.tinypic.com/fvlq37.png[/IMG].

http://stackoverflow.com/comment/38863721
comment on: http://stackoverflow.com/q/24995617
type: Comment
has text: FileInputStream(File file) will be called anyway, so no there is no difference. Just use which one is more convenient for you case.
score: 0
type: QuestionComment

http://stackoverflow.com/a/25066995
type: Answer
answers question: http://stackoverflow.com/q/25066970
downvote count: 1
upvote count: 5
score: 4
type: AcceptedAnswer
has body: It is quite easy: a+=b is the same as a = a+(b) =+ simply does not exist. However, you might see a =+ b. You should read it as a = (+b). I.e., the parser will never parse =+ as a single token, it will parse it as = and +, so the following expression may start with a plus. The same goes for =-: int a =-b; // a = -b int a =+b; // a = +b
has comment: http://stackoverflow.com/comment/38998718
accepted answer of: http://stackoverflow.com/q/25066970

http://stackoverflow.com/q/25041767
type: UnansweredQuestion
tagged with: java
type: Question
answer count: 1
has answer: http://stackoverflow.com/a/25041915
score: 0
has title: How to get the session id after log in using java
has body: i try to get the session after log in in a webpage, because i want to download some files after cliking in a button like download. So i tried the Post and Get method but i don't know how to get the session id. Thank you for your help POST import org.apache.http.client.ClientProtocolException; import org.apache.http.client.HttpClient; import org.apache.http.client.methods.HttpPost; import org.apache.http.entity.StringEntity; import org.apache.http.impl.client.DefaultHttpClient; public class Post { public static void main(String[] args) throws ClientProtocolException, IOException { HttpClient client = new DefaultHttpClient(); HttpPost post = new HttpPost("https://mysite.com/new/api/login"); StringEntity input = new StringEntity("{\"username\":\"john\",\"password\":\"doe\"}"); input.setContentType("application/json"); post.setEntity(input); HttpResponse response = client.execute(post); BufferedReader rd = new BufferedReader(new InputStreamReader(response .getEntity().getContent())); String line = ""; while ((line = rd.readLine()) != null) { System.out.println(line); } System.out.println(client); } } GET package post; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import org.apache.http.HttpResponse; import org.apache.http.client.ClientProtocolException; import org.apache.http.client.HttpClient; import org.apache.http.client.methods.HttpGet; import org.apache.http.impl.client.DefaultHttpClient; public class Get { public static void main(String[] args) throws ClientProtocolException, IOException { HttpClient client = new DefaultHttpClient(); HttpGet request = new HttpGet("https://mysite.com/new/api/login"); HttpResponse response = client.execute(request); BufferedReader rd = new BufferedReader(new InputStreamReader(response .getEntity().getContent())); String line = ""; while ((line = rd.readLine()) != null) { System.out.println(line); } System.out.println("client"); } }

http://stackoverflow.com/q/24996635
has body: im trying to design a calculator app the way it should work, unlike the conventional ones that ask for first number and second number, then the operator. i have designed mine to take input from the user as typed and then process. My problem is if i want to perform a division such that either operator is a float/double how do i set the initial type of the variables and once input different from the initial type how do i change the type to accommodate new variable static int initVal = 0; static int finalVal = 0; .. .. .. work.screen.setText(work.screen.getText() ); String keyPressed = Integer.toString(initVal); initVal = Integer.parseInt(keyPressed); On the interface, if I keypress numbers that includes a decimal place or my answer is a decimal place it doesnt type cast correctly. I have tried making everything Double instead of integer but then if i keypress numbers without decimal place it becomes converted into fractions. confused. a solution will be appreciated.
tagged with: double
has comment: http://stackoverflow.com/comment/38871677
has title: Fix the type casting in Java calcuator application
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38889607
tagged with: java
accepted answer: http://stackoverflow.com/a/24996797
type: Question
has comment: http://stackoverflow.com/comment/38870219
has comment: http://stackoverflow.com/comment/38864618
has comment: http://stackoverflow.com/comment/38865221
has comment: http://stackoverflow.com/comment/38864057
score: 0
tagged with: casting
answer count: 1
has answer: http://stackoverflow.com/a/24996797
tagged with: calculator

android-wallpaper
tags question: http://stackoverflow.com/q/24970051
tag name: android-wallpaper
type: Tag

http://stackoverflow.com/comment/38890246
has text: That's because your result map is of type `HashMap<String, List<String>>`, but it should be `HashMap<String, Set<Object>>` now.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25004036

http://stackoverflow.com/comment/38931641
has text: Check out my ans here : http://stackoverflow.com/questions/24954285/edittext-value-not-save-in-listview-dynamically/24956887#24956887
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25032577

http://stackoverflow.com/comment/38956070
type: Comment
comment on: http://stackoverflow.com/q/25044098
score: 0
has text: Well... that just came into my mind typing my last comment. :) Did that and it's working like a charm! Thanks for the help!
type: QuestionComment

http://stackoverflow.com/comment/38838547
comment on: http://stackoverflow.com/q/24979557
score: 0
type: QuestionComment
type: Comment
has text: @owlstead I knew about the other answer as I used some code from it in something I was playing around with some time ago. So I could search for "Cipher" to find it.

http://stackoverflow.com/comment/38729040
comment on: http://stackoverflow.com/a/24924462
type: AnswerComment
has text: @NickMiller Generally, I'd prefer to let the caller dispose of it. Once this method completes you know the password is valid only as a password (not a correct password per se), you haven't actually done anything with it yet (as far as this method knows anyway).
score: 0
type: Comment

http://stackoverflow.com/comment/116340233
type: AnswerComment
score: 0
type: Comment
has text: True but making a profile for every plugin like this is using a sledgehammer for a finishing nail. It would be easy to just bind it to the none phase.
comment on: http://stackoverflow.com/a/64027964

websphere
tags question: http://stackoverflow.com/q/25051294
tags question: http://stackoverflow.com/q/25009365
tags question: http://stackoverflow.com/q/25050181
tags question: http://stackoverflow.com/q/24952403
tags question: http://stackoverflow.com/q/25006537
tags question: http://stackoverflow.com/q/24933819
tag name: websphere
tags question: http://stackoverflow.com/q/25038908
type: Tag
tags question: http://stackoverflow.com/q/24979280
tags question: http://stackoverflow.com/q/24915281
tags question: http://stackoverflow.com/q/24917853

http://stackoverflow.com/comment/38713081
comment on: http://stackoverflow.com/q/24916011
has text: Yep, we were all typing up answers at the same time. Camickr's is correct, but don't forget the safety issues my answer raises.
type: QuestionComment
type: Comment
score: 2

http://stackoverflow.com/q/25039249
type: Question
answer count: 3
downvote count: 0
possible better answer: http://stackoverflow.com/a/73770253
favorite count: 0
has body: I use spring boot 1.2.1.RELEASE and noticed that spring automatically changes my log4j configuration on startup. Here are my (spring) dependencies: org.springframework.boot spring-boot-dependencies 1.1.2.RELEASE pom import org.springframework.boot spring-boot-starter-web 1.1.2.RELEASE org.springframework.boot spring-boot-starter-tomcat org.springframework.boot spring-boot-starter-logging org.springframework.boot spring-boot-starter-jetty 1.1.2.RELEASE de.komoot.wanderwalter wanderwalter-api-models 1.26-SNAPSHOT de.komoot.wanderwalter wanderwalter-routing 1.26-SNAPSHOT com.graphhopper graphhopper 0.3-kmt org.springframework spring-webmvc ${spring.version} org.springframework spring-test ${spring.version} test org.springframework spring-jdbc ${spring.version} commons-logging commons-logging 1.1.3 commons-codec commons-codec 1.8 When I start my application with -Dlog4j.configuration=log4j-live.xml -Dlog4j.debug I can see that first my log4j config is used, then spring cleans it and installs its own config and then (this is what I guess) adds the default log4j.xml from the classpath. How can I use only the default log4j behavior or how can I define which of my files spring shall use for configuration? Cheers, Jan
has answer: http://stackoverflow.com/a/79499266
has answer: http://stackoverflow.com/a/25049307
tagged with: log4j
accepted answer: http://stackoverflow.com/a/25049307
has title: Disable automatic logging configuration in spring boot
upvote count: 3
has answer: http://stackoverflow.com/a/73770253
tagged with: spring
type: AnsweredQuestion
score: 3
tagged with: spring-boot
tagged with: java

http://stackoverflow.com/a/24966667
accepted answer of: http://stackoverflow.com/q/24966611
answers question: http://stackoverflow.com/q/24966611
type: AcceptedAnswer
downvote count: 0
has body: I would use a PreparedStatment and I would increase the default ResultSet fetchSize, and I would limit the query to the three columns (note id != Number) - String query = "select Number, Name, Progress from system"; stmt = conn.prepareStatement(query); rs = stmt.executeQuery(); rs.setFetchSize(250); Finally, establishing a Connection like that is probably the wrong way to go for performance. You should look for a Connection pool like BoneCP or c3p0 or HikariCP.
type: Answer
has comment: http://stackoverflow.com/comment/38808674
upvote count: 1
has comment: http://stackoverflow.com/comment/38811146
has comment: http://stackoverflow.com/comment/38808696
has comment: http://stackoverflow.com/comment/38846854
score: 1

http://stackoverflow.com/comment/38831203
has text: @barakmanos If you "go over the bytes" or nibbles or bit pairs or bits of an int or a long you still can't avoid a loop with a shift/division and mask/remainder. The only scenario where such a loop to convert from a 2^n base to a digit string is not necessary would be when it can be done 1:1, e.g., byte[] to base 256, etc. Nobody needs that anyway. - See my modification of "any other base" in the answer.
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24978551

http://stackoverflow.com/comment/38762801
score: 1
type: Comment
type: QuestionComment
has text: You should use a IDE like Eclipse or Netbeans, to name those 2. That would help you with the scope problems as they would have both told you about it.
comment on: http://stackoverflow.com/q/24942495

http://stackoverflow.com/comment/38766134
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24944204
has text: @PeterLawrey: If two threads call `getClientA()` at the same time, both can perform the null check and create different instance of `ClientA`. There is then a race condition to determine which instance will be returned/stored internally.
score: 0

http://stackoverflow.com/a/51751398
has body: Answer from official documentation: For a standalone server, you have to pass in the JVM settings either as command line arguments when executing the $JBOSS_HOME/bin/standalone.sh script, or by declaring them in $JBOSS_HOME/bin/standalone.conf. (For Windows users, the script to execute is %JBOSS_HOME%/bin/standalone.bat while the JVM settings can be declared in %JBOSS_HOME%/bin/standalone.conf.bat) ** Restart server to make this change effective.
upvote count: 3
score: 3
answers question: http://stackoverflow.com/q/24959128
downvote count: 0
type: Answer

http://stackoverflow.com/comment/38941731
type: AnswerComment
score: 0
type: Comment
has text: Both Math.min and Math.max use conditionals.
comment on: http://stackoverflow.com/a/25037655

http://stackoverflow.com/a/24985915
has body: I rebooted my computer and it worked again. My program does not properly shut down and gets stuck in memory as a Listener. It seems that the program only works until there are about 8 other of the same application in memory running. I do not understand how this happen, but after I fix my shutdown precedure everything should be fine again.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/24975079

http://stackoverflow.com/comment/38741901
has text: A `Date` does not have a timezone. When you print its string form, you see the timezone returned by [TimeZone.getDefault()](http://docs.oracle.com/javase/8/docs/api/java/util/TimeZone.html#getDefault--).
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24912908
score: 1

http://stackoverflow.com/comment/38852977
score: 1
type: AnswerComment
type: Comment
has text: `frame.setOpacity(i/10.0);` should be inside `publish/process` or `setProcess` (done on EDT), instead of wrong doInBackground(by default never notified EDT), :-) sorry more in API :-)
comment on: http://stackoverflow.com/a/24987286

http://stackoverflow.com/q/24950119
has body: I have 4 JLabels. upon first click: I changed the background color to red and removed JLabel's MouseListener that I have clicked. upon second click: I change the background color to green, but the JLabel that I clicked previously shouldn't change from red to green since I had already removed the MouseListener. upon third click: I want to add back the MouseListener to the JLabel MouseListener that has been removed at first click and change the background color to black but I not sure how can I add back. I tried to use addMouseListener method in my addbackMouseListener(JLabel label) but it's seems that I cannot pass in "this" in the parameter and I don't know what to pass in the parameter of the addMouseListener. public void addbackMouseListener(JLabel label) { label.addMouseListener(this); &lt;-- can't pass in this, what can I do? } Codes: import java.awt.Color; import java.awt.FlowLayout; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.SwingUtilities; @SuppressWarnings("serial") public class rMouseListener extends JFrame { private JLabel[] jLabel = {new JLabel(), new JLabel(), new JLabel(), new JLabel()};; private JPanel panel = new JPanel(new FlowLayout()); private int clickCount = 0; private boolean mouseRemoved = false; public rMouseListener() { for(int i = 0; i&lt; 4; i++) { jLabel[i].setText(i + " "); panel.add(jLabel[i]); jLabel[i].addMouseListener(new MouseAdapter() { @Override public void mousePressed(MouseEvent e) { JLabel label =(JLabel) e.getSource(); clickCount++; /*remove the mouseListener for the label that is clicked*/ if(clickCount == 1) { label.setBackground(Color.red); label.setOpaque(true); label.removeMouseListener(this); mouseRemoved = true; } /* to verify that the mouseListener for that label is removed after first click.*/ else if(clickCount == 2) { label.setBackground(Color.green); label.setOpaque(true); } /*check if the m…
type: AnsweredQuestion
score: 0
tagged with: java
accepted answer: http://stackoverflow.com/a/24950156
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/24950213
has title: Java removing and adding back MouseListener later
possible better answer: http://stackoverflow.com/a/24950213
has answer: http://stackoverflow.com/a/24950156
tagged with: jlabel
tagged with: mouselistener
tagged with: swing

shell
tags question: http://stackoverflow.com/q/25060813
tags question: http://stackoverflow.com/q/24941193
tag name: shell
tags question: http://stackoverflow.com/q/25002244
tags question: http://stackoverflow.com/q/24911012
tags question: http://stackoverflow.com/q/25024280
tags question: http://stackoverflow.com/q/24996664
type: Tag
tags question: http://stackoverflow.com/q/24951059
tags question: http://stackoverflow.com/q/24927587

http://stackoverflow.com/q/24988901
type: Question
tagged with: jakarta-ee
has title: Convert dynamic web project to JPA project?
tagged with: jpa
has comment: http://stackoverflow.com/comment/38850028
answer count: 1
downvote count: 0
favorite count: 0
has body: I have a dynamic web project in eclipse luna EE. I am supposed to use EclipseLink and JPA to manage the persistence. I want to create the entity classes for each of these classes from database tables in a mysql server. I saw the steps for this at : Generating entities from tables (help.eclipse.org) The steps in the above tutorial are applicable only to a JPA project. So, I right click my project > configure and see convert to JPA project, convert to plugin project, convert to maven project. There is another way to convert a project to JPA. Right click project > JPA tools etc.. But I do not see the JPA tools option there. I was thinking of converting it to a JPA project. But, I am not confident if I should do it. Will my dynamic web app continue to work properly if I do it ? What is the meaning of those 3 configuration options ? I'd like to know before I proceed. Thank you.
has answer: http://stackoverflow.com/a/24989175
has comment: http://stackoverflow.com/comment/38849913
type: AnsweredQuestion
score: 2
upvote count: 2
tagged with: java
tagged with: eclipse
accepted answer: http://stackoverflow.com/a/24989175

http://stackoverflow.com/comment/40384926
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25079200
has text: Thanks that helped. I am now able to call "Java" from Objective C via JNI. Maybe I should point out that the bc.c main is called because I could not remove the main method as the robovm compiler would be unhappy with a "missing _main symbol in crt0" exception. Now I needed to turn off my native iOS Apps main method and let Robovm main method start my AppDelegate. Currently I am struggling to get back the Objc object from the jobject. The Java object is annotated with @NativeClass... but that's a new Stack Overflow question I guess.
type: AnswerComment

http://stackoverflow.com/q/24965600
has comment: http://stackoverflow.com/comment/38805757
type: UnansweredQuestion
downvote count: 2
has comment: http://stackoverflow.com/comment/38805791
has comment: http://stackoverflow.com/comment/38805866
has body: This is a alpha code for a calculator that I'm making, and I want it to be that when I press "1" the calculator inputs 1 in my array but it isn't even triggering the keyPressed and that. package ws1; import java.applet.*; import java.awt.*; import java.awt.event.*; import java.util.ArrayList; public class ws41 extends Applet implements ActionListener, KeyListener{ Button equals,zero,one,two,three,four,five,six,seven,eight,nine,divide,times,plus,minus,u2s,s2u,period; Label show; double total; double dot; double left=0; double right=0; String tots = ""; String sign = ""; ArrayList&lt;Integer&gt; Calc = new ArrayList&lt;Integer&gt;(); public void init(){ setSize(30,200); show = new Label(""); period = new Button(" . "); u2s = new Button(" Usd to Sek"); s2u = new Button("Sek to Usd"); zero = new Button(" 0 "); one = new Button(" 1 "); two = new Button(" 2 "); three = new Button(" 3 "); four = new Button(" 4 "); five = new Button(" 5 "); six = new Button(" 6 "); seven = new Button(" 7 "); eight = new Button(" 8 "); nine = new Button(" 9 "); plus = new Button(" + "); minus = new Button(" - "); times = new Button(" * "); divide = new Button(" / "); equals = new Button(" = "); this.addKeyListener(this); zero.addActionListener (this); one.addActionListener (this); two.addActionListener (this); three.addActionListener (this); four.addActionListener (this); five.addActionListener (this); six.addActionListener (this); seven.addActionListener (this); eight.addActionListener (this); nine.addActionListener (this); plus.addActionListener (this); times.addActionListener (this); minus.addActionListener (this); times.addActionListener (this); divide.addActionListener (this); equals.addActionListener (this); u2s.addActionListener (this); s2u.addActionListener (this); period.addActionListener(this); //add(show); add(one); add(two); add(three); add(four); add(five); add(six); add(seven); add(eight); add(nine); add(zero); add(period); add(plus); add(minus); add(times); add(divide); add(eq…
has comment: http://stackoverflow.com/comment/38805778
has comment: http://stackoverflow.com/comment/38805759
tagged with: java
has title: KeyListener doesn't trigger
tagged with: keylistener
type: Question
has answer: http://stackoverflow.com/a/24965645
upvote count: 0
score: -2
answer count: 1
favorite count: 0

http://stackoverflow.com/q/24985762
has answer: http://stackoverflow.com/a/24985783
has title: Java: Array Index Out of Bounds Exception 2
has answer: http://stackoverflow.com/a/24985875
has answer: http://stackoverflow.com/a/24985822
has answer: http://stackoverflow.com/a/24985801
has comment: http://stackoverflow.com/comment/38843590
has comment: http://stackoverflow.com/comment/38843519
upvote count: 1
has comment: http://stackoverflow.com/comment/38843507
has comment: http://stackoverflow.com/comment/38843540
downvote count: 1
type: Question
type: AnsweredQuestion
tagged with: java
tagged with: indexoutofboundsexception
has answer: http://stackoverflow.com/a/24985819
accepted answer: http://stackoverflow.com/a/24985801
score: 0
has comment: http://stackoverflow.com/comment/38843522
favorite count: 0
has body: I'm writing a simple Java program that asks the user to input a string, and then counts and displays the number of times each letter in the alphabet appears in that string. When I compile, I get this error: Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: -25 at StringLetters.countLetters(StringLetters.java:43) at StringLetters.main(StringLetters.java:23) I have looked at other solutions to problems similar to mine, but none of them helped. Does anyone have any ideas? Thank you. import java.util.Scanner; public class StringLetters { public static void main(String[]args) { Scanner scan = new Scanner(System.in); System.out.println("Please enter a string of words."); String s = scan.nextLine(); int[] counts = countLetters(s.toUpperCase()); for(int i = 0; i &lt; counts.length; i++) { if (counts[i] != 0) { System.out.println((char)('a' + i) + " appears " + counts[i] + ((counts[i] == 1) ? "time" : " times")); } } } public static int[] countLetters(String s) { int[] counts = new int[26]; for (int i = 0; i &lt; s.length(); i++) { if(Character.isLetter(s.charAt(i))) { counts[s.charAt(i) - 'a']++; } } return counts; } }
answer count: 5
possible better answer: http://stackoverflow.com/a/24985783

oauth-2.0
tags question: http://stackoverflow.com/q/24932158
tag name: oauth-2.0
tags question: http://stackoverflow.com/q/24912099
tags question: http://stackoverflow.com/q/24926166
type: Tag
tags question: http://stackoverflow.com/q/25015561

http://stackoverflow.com/q/24970176
tagged with: joptionpane
has comment: http://stackoverflow.com/comment/38814365
tagged with: swing
has answer: http://stackoverflow.com/a/24970251
has comment: http://stackoverflow.com/comment/38814407
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38814266
has answer: http://stackoverflow.com/a/24970232
tagged with: java
possible better answer: http://stackoverflow.com/a/24970251
type: Question
upvote count: 4
accepted answer: http://stackoverflow.com/a/24970232
has comment: http://stackoverflow.com/comment/38814371
has comment: http://stackoverflow.com/comment/38814573
downvote count: 0
has title: JOptionPane handling ok, cancel and x button
score: 4
has body: There is one problem I am facing with my JOptionPane if I don't key in anything,no matter what I press(the ok,cancel or the x button(the top right button in the JOptionPane)), it will prompt me until the I key in a positive value. but I only want the prompt to happen when i pressed ok. If I click on cancel or the x button(the top right button in the JOptionPane), it will close the JOptionPane How can I do this? import javax.swing.JOptionPane; public class OptionPane { public static void main(final String[] args) { int value = 0; boolean isPositive = false , isNumeric = true; do { try { value = Integer.parseInt(JOptionPane.showInputDialog(null, "Enter value?", null)); } catch (NumberFormatException e) { System.out.println("*** Please enter an integer ***"); isNumeric = false; } if(isNumeric) { if(value &lt;= 0) { System.out.println("value cannot be 0 or negative"); } else { System.out.println("value is positive"); isPositive = true; } } }while(!isPositive); } }
answer count: 3
has comment: http://stackoverflow.com/comment/38814319
has answer: http://stackoverflow.com/a/24970254
favorite count: 0

http://stackoverflow.com/a/25042952
has body: So what you are doing is, you are populating a listview of installed apps using package manager. Add a plus button in place of the checkbox. Now get installed apps similar to this - List&lt;PackageInfo&gt; packageList1 = packageManager.getInstalledPackages(0); final PackageItemInfo.DisplayNameComparator comparator = new PackageItemInfo.DisplayNameComparator(packageManager); Collections.sort(packageList1, new Comparator&lt;PackageInfo&gt;() { @Override public int compare(PackageInfo lhs, PackageInfo rhs) { return comparator.compare(lhs.applicationInfo, rhs.applicationInfo); } }); for (int i = 0; i &lt; packageList1.size(); i++) { PackageInfo PackInfo = packageList1.get(i); if (((PackInfo.applicationInfo.flags &amp; ApplicationInfo.FLAG_SYSTEM) != 0) != true) { //Add to adapter } } } Now, create a public string array in the activity which is holding the tabs. When you click on the plus button add the packagename to the array. Now on the other tab use the same adapter, but here before adding it to the adapter check if it is found in the string array using the index. Something like - List&lt;PackageInfo&gt; packageList1 = packageManager.getInstalledPackages(0); final PackageItemInfo.DisplayNameComparator comparator = new PackageItemInfo.DisplayNameComparator(packageManager); Collections.sort(packageList1, new Comparator&lt;PackageInfo&gt;() { @Override public int compare(PackageInfo lhs, PackageInfo rhs) { return comparator.compare(lhs.applicationInfo, rhs.applicationInfo); } }); for (int i = 0; i &lt; packageList1.size(); i++) { PackageInfo PackInfo = packageList1.get(i); if (((PackInfo.applicationInfo.flags &amp; ApplicationInfo.FLAG_SYSTEM) != 0) != true) { if (Mainactivity.array contains String PackageName= PackInfo.packageName) { //Add to adapter } } } } To persist the selected apps, add their package name to shared_preferences. edit : In your fragment's LoadApplications class, you retrieve a list of installed apps. On the second fragment use the same code, but jus…
has comment: http://stackoverflow.com/comment/38952938
upvote count: 1
has comment: http://stackoverflow.com/comment/38954381
has comment: http://stackoverflow.com/comment/38955299
has comment: http://stackoverflow.com/comment/38952037
has comment: http://stackoverflow.com/comment/38955175
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/25042663
type: Answer
has comment: http://stackoverflow.com/comment/38952680
has comment: http://stackoverflow.com/comment/38951578

http://stackoverflow.com/a/25020778
type: Answer
answers question: http://stackoverflow.com/q/25020718
has comment: http://stackoverflow.com/comment/38911034
has body: your CalendarFragment is not actually a Fragment but an Activity since you extended Activity public class CalendarFragment extends Activity but the changeFragment method takes a parameter a Fragment, causing a compile time error,
score: 0
has comment: http://stackoverflow.com/comment/38910351

http://stackoverflow.com/comment/38946307
has text: Why is this migrated **from** code review?
score: 5
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25040459

http://stackoverflow.com/comment/38962597
type: Comment
has text: It is not valid Java to have anything after the return including break. though Netbeans will run it, it will not compile under normal circumstances.
comment on: http://stackoverflow.com/q/25048769
score: 0
type: QuestionComment

eclipse
tags question: http://stackoverflow.com/q/25022680
tags question: http://stackoverflow.com/q/24932105
tags question: http://stackoverflow.com/q/24999649
tags question: http://stackoverflow.com/q/25025524
tag name: eclipse
tags question: http://stackoverflow.com/q/24929072
tags question: http://stackoverflow.com/q/25057589
tags question: http://stackoverflow.com/q/24967722
tags question: http://stackoverflow.com/q/24973560
tags question: http://stackoverflow.com/q/24910515
tags question: http://stackoverflow.com/q/25038694
tags question: http://stackoverflow.com/q/25001624
tags question: http://stackoverflow.com/q/24998592
tags question: http://stackoverflow.com/q/25062764
tags question: http://stackoverflow.com/q/25030837
tags question: http://stackoverflow.com/q/25016396
tags question: http://stackoverflow.com/q/24928548
tags question: http://stackoverflow.com/q/24915233
tags question: http://stackoverflow.com/q/24945515
tags question: http://stackoverflow.com/q/24910524
tags question: http://stackoverflow.com/q/24980390
tags question: http://stackoverflow.com/q/25009140
tags question: http://stackoverflow.com/q/24981528
tags question: http://stackoverflow.com/q/25033594
tags question: http://stackoverflow.com/q/25028669
tags question: http://stackoverflow.com/q/24930062
tags question: http://stackoverflow.com/q/24942045
tags question: http://stackoverflow.com/q/25057281
tags question: http://stackoverflow.com/q/24969845
tags question: http://stackoverflow.com/q/25007443
tags question: http://stackoverflow.com/q/25022936
tags question: http://stackoverflow.com/q/25026600
tags question: http://stackoverflow.com/q/25043917
tags question: http://stackoverflow.com/q/24993956
tags question: http://stackoverflow.com/q/24981640
tags question: http://stackoverflow.com/q/24968881
tags question: http://stackoverflow.com/q/24934826
tags question: http://stackoverflow.com/q/25018996
tags question: http://stackoverflow.com/q/24910595
tags question: http://stackoverflow.com/q/24963259
tags question: http://stackoverflow.com/q/24925915
tags question: http://stackoverflow.com/q/24990639
tags question: http://stackoverflow.com/q/25013103
tags question: http://stackoverflow.com/q/25023296
tags question: http://stackoverflow.com/q/24926526
tags question: http://stackoverflow.com/q/24974586
tags question: http://stackoverflow.com/q/24930710
tags question: http://stackoverflow.com/q/24912730
tags question: http://stackoverflow.com/q/24993736
tags question: http://stackoverflow.com/q/24999292
tags question: http://stackoverflow.com/q/24954299
tags question: http://stackoverflow.com/q/25025347
tags question: http://stackoverflow.com/q/24928481
tags question: http://stackoverflow.com/q/24934558
tags question: http://stackoverflow.com/q/24984313
tags question: http://stackoverflow.com/q/24972091
tags question: http://stackoverflow.com/q/24947753
tags question: http://stackoverflow.com/q/24975169
tags question: http://stackoverflow.com/q/24971856
tags question: http://stackoverflow.com/q/24968622
tags question: http://stackoverflow.com/q/25016546
tags question: http://stackoverflow.com/q/24944568
tags question: http://stackoverflow.com/q/24999791
tags question: http://stackoverflow.com/q/24949028
tags question: http://stackoverflow.com/q/24967957
tags question: http://stackoverflow.com/q/24925615
tags question: http://stackoverflow.com/q/24964591
tags question: http://stackoverflow.com/q/24914089
tags question: http://stackoverflow.com/q/24995191
tags question: http://stackoverflow.com/q/24966336
tags question: http://stackoverflow.com/q/24975324
tags question: http://stackoverflow.com/q/25053616
tags question: http://stackoverflow.com/q/24997128
tags question: http://stackoverflow.com/q/25020205
tags question: http://stackoverflow.com/q/25021336
tags question: http://stackoverflow.com/q/25031417
tags question: http://stackoverflow.com/q/25004209
tags question: http://stackoverflow.com/q/25032250
tags question: http://stackoverflow.com/q/24950391
tags question: http://stackoverflow.com/q/24949842

http://stackoverflow.com/q/24937042
has comment: http://stackoverflow.com/comment/38752049
type: AnsweredQuestion
tagged with: android-fragments
has comment: http://stackoverflow.com/comment/38751923
score: 1
tagged with: java
type: Question
has body: I've created a new activity and I'm showing it using an intent. In onCreate I'm trying to replace the placeholder fragment with my class but it's throwing an error - cannot resolve method. @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_edit_viewer); if (savedInstanceState == null) { getFragmentManager().beginTransaction() .add(R.id.container, new ViewerEditFragment()) .commit(); } ViewerEditFragment class: public class ViewerEditFragment extends Fragment { public ViewerEditFragment() { } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.edit_viewer, container, false); return rootView; } } activity_edit_viewer.xml <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/container" android:layout_width="match_parent" android:layout_height="match_parent" tools:context="com.lightfootsolutions.sfnviewer.app.EditViewerActivity" tools:ignore="MergeRootFrame" /> edit_viewer.xml <?xml version="1.0" encoding="utf-8"?> <TextView style="?android:attr/listSeparatorTextViewStyle" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="sfn Credentials"/> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/username" android:paddingLeft="10dp" /> <EditText android:id="@+id/username" android:hint="Admin" android:layout_width="match_parent" android:layout_height="wrap_content" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/password" android:paddingLeft="10dp" /> <EditText android:id="@+id/entry" android:inputType="textPassword" android:hint="Password" android:minWidth="100dip" android:layout_width="match_parent" android:layout_height="wrap_content"/> <TextView style="?android:attr/…
has title: Creating and showing new Activity, can't use my fragment?
answer count: 1
downvote count: 0
accepted answer: http://stackoverflow.com/a/24937575
has comment: http://stackoverflow.com/comment/38751938
has comment: http://stackoverflow.com/comment/38752607
has comment: http://stackoverflow.com/comment/38752171
upvote count: 1
tagged with: android
has answer: http://stackoverflow.com/a/24937575
tagged with: android-activity
favorite count: 0
has comment: http://stackoverflow.com/comment/38752485
has comment: http://stackoverflow.com/comment/38752283

http://stackoverflow.com/q/24971852
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/24972681
tagged with: android
has comment: http://stackoverflow.com/comment/38817507
has body: My phone - rooted Android 4.2. Popular file managers work well with directory like "/config" or "/data". But in my program I can't observe this directories. I use library RootTools if (RootTools.isRootAvailable()) { if (RootTools.isAccessGiven()) { new File("/config").listFiles();//null } } I see window with confirm "get root access" and push "yes". And I add in manifest &lt;uses-permission android:name="android.permission.ACCESS_SUPERUSER" /&gt;
tagged with: root
has title: Root access not work in Android! new File("/config").listFiles() return null
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24972681
tagged with: java
has comment: http://stackoverflow.com/comment/38817568
type: Question

http://stackoverflow.com/comment/38747582
comment on: http://stackoverflow.com/q/24934777
type: Comment
type: QuestionComment
score: 0
has text: Inspect NewJFrame.java very closely at line 180. Something there is null that you weren't expecting

http://stackoverflow.com/q/24978388
score: 3
has comment: http://stackoverflow.com/comment/38830195
accepted answer: http://stackoverflow.com/a/24978738
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has title: how to parse a JSON string into ObjectNode in Jackson?
type: Question
upvote count: 4
answer count: 1
tagged with: jackson
has comment: http://stackoverflow.com/comment/38830244
favorite count: 0
has comment: http://stackoverflow.com/comment/38830056
has body: First of all could anyone explain to me What are differences between ObjectNode and JsonNode, and where they used? Then if I want to convert a JSON string into ObjectNode what can I do?
has answer: http://stackoverflow.com/a/24978738
linked to: http://stackoverflow.com/q/3653996
has comment: http://stackoverflow.com/comment/38830036
has comment: http://stackoverflow.com/comment/38829560
downvote count: 1
type: AnsweredQuestion

http://stackoverflow.com/comment/38720187
comment on: http://stackoverflow.com/q/24919760
score: 0
type: QuestionComment
has text: @pixel-THere must be some condition for encountering `+` symbol.Why someone will add in between a `+` symbol just for the sake of it???Please clarify about + symbol!
type: Comment

http://stackoverflow.com/comment/38767423
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24944844
has text: Data Structures And Algorithms In Java! @KickButtowski any suggestions regarding the question i posted?:)

http://stackoverflow.com/a/58235946
upvote count: 2
has body: I use Eclipse IDE for Enterprise Java Developers version: 2019-03 (4.11.0). I fixed it by follow steps. Go to Help -> Eclipse Marketplace Find m2e-apt Install and restart Eclipse
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/24928338
score: 2

http://stackoverflow.com/q/24934267
tagged with: java
has answer: http://stackoverflow.com/a/24934462
has comment: http://stackoverflow.com/comment/38785617
has title: Nothing showing up after I run Applet
type: Question
linked to: http://stackoverflow.com/q/5621338
has body: I am very new to Java and am working on a simple applet as a homework project... I compile it without any syntax errors, but it doesn't show up in Main as anything but a blank screen and the words "applet started". Could I please have some proofreading/advice on how to fix it? Thanks import java.applet.*; import java.awt.*; import javax.swing.*; public class Module6Project extends JApplet { public static void main (String[] args) { JFrame f=new JFrame("Module6Project"); f.setBackground(Color.blue); f.getContentPane().setLayout(null); f.setSize(500,500); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JTextField first = new JTextField("First name", 150); JTextField second = new JTextField("Last name", 200); JTextField third = new JTextField("DoB", 75); JTextField fourth = new JTextField("Address", 350); JTextField fifth = new JTextField("Additional comments", 250); JButton OK = new JButton("OK"); JButton Cancel = new JButton("Cancel"); }}
tagged with: bluej
score: 0
tagged with: japplet
accepted answer: http://stackoverflow.com/a/24934462
answer count: 1
tagged with: applet
tagged with: xcode
has comment: http://stackoverflow.com/comment/38785604
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/17874717

http://stackoverflow.com/comment/38873233
type: Comment
has text: Pat - I'm running a standalone executable JAR
score: 0
comment on: http://stackoverflow.com/q/24984274
type: QuestionComment

http://stackoverflow.com/comment/38833517
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24948169
has text: I am using Spring MVC
score: 0

download
tags question: http://stackoverflow.com/q/24999186
type: Tag
tags question: http://stackoverflow.com/q/24983596
tag name: download
tags question: http://stackoverflow.com/q/24975455
tags question: http://stackoverflow.com/q/24936566
tags question: http://stackoverflow.com/q/25045003
tags question: http://stackoverflow.com/q/25027884

http://stackoverflow.com/comment/38984847
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/25039266
has text: @Kao - as i said in my answer, you _must_ use two threads. the BufferedOOutputStream only bought you a little more file size before you will block again.
type: Comment

fonts
tags question: http://stackoverflow.com/q/25007475
tags question: http://stackoverflow.com/q/24928501
tags question: http://stackoverflow.com/q/24971336
tags question: http://stackoverflow.com/q/24925940
tags question: http://stackoverflow.com/q/24963437
type: Tag
tags question: http://stackoverflow.com/q/25054203
tags question: http://stackoverflow.com/q/24914099
tag name: fonts
tags question: http://stackoverflow.com/q/24971180

http://stackoverflow.com/comment/38899737
score: 0
type: AnswerComment
has text: Okay I am assuming it needs more debugging. What I am assuming is you are not able to find the correct element. So do these: A. Use: *Driver.FindElements(By.Xpath("Your Xpath")).Count*; and if it returns more than one elements try using B. selenium IDE and see what selector it's using at least it would give you some idea.
type: Comment
comment on: http://stackoverflow.com/a/25007410

http://stackoverflow.com/q/24924542
has title: How to upload image in database using Jsp page And how to retrieve image from Database and show another in page
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/38728503
tagged with: jsp
has answer: http://stackoverflow.com/a/24924862
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24924673
linked to: http://stackoverflow.com/q/15829367
has body: I'm new to jsp So I want to learn How to save Image In DB and How to retrieve from DB
has comment: http://stackoverflow.com/comment/38728500
tagged with: java
tagged with: web-applications
type: Question

http://stackoverflow.com/a/49638528
upvote count: 1
has body: Ok so there are error codes that commonly appear during content negotiation 1) 406 - Not acceptable 2) 415 - Unsupported Media Type 406 is when the server doesn't accept the content type that is being sent under the ACCEPT header of the request. 415 is the client is sending a content-type in the request header and so server straightforwardly rejects saying unsupported media type to overcome 406 - we must include the appropriate dependent jars say a client wants an XML input to be understood by the server, then the server needs to have XML related dependencies. to overcome 415 - understand the media types that are supported by the server and pass the correct media type in the content-type header of the request
answers question: http://stackoverflow.com/q/24932080
downvote count: 0
score: 1
type: Answer
has comment: http://stackoverflow.com/comment/86284834

http://stackoverflow.com/q/25060251
has body: Following, is a very simple example. Why do I need to use casting at (String)classA.getOut(); Compiler should now that type is String. Thanks ITest classA = new CLASSA(); String str = classA.getOut(); //Casting error class CLASSA implements ITest&lt;String&gt; { public String getOut() { return "X"; } } interface ITest&lt;T&gt; { public T getOut(); }
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/25060322
has answer: http://stackoverflow.com/a/25060341
type: Question
has title: Generic Interface polymorphism casting error
has answer: http://stackoverflow.com/a/25060318
accepted answer: http://stackoverflow.com/a/25060322
answer count: 3
tagged with: generics
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/25060341

http://stackoverflow.com/comment/38710644
has text: Same as you, I would not use managed bean but I'm not responsible for the technical solutions unfortunatly...
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/24912664
type: Comment

http://stackoverflow.com/a/24967345
has body: You confused the base with the exponent. The power method should be defined like this: public static int power(int base, int exponent) { if(exponent == 0) { System.out.println(1); // for display return 1; } else { int rem = power(base, exponent-1); if (rem &gt; 1) { System.out.println(rem); // for display } return base * rem; } } USAGE public static void main(String[] args) { System.out.println(power(4,2)); // prints 16 }
has comment: http://stackoverflow.com/comment/38808973
has comment: http://stackoverflow.com/comment/38843651
has comment: http://stackoverflow.com/comment/38809042
score: 4
upvote count: 4
answers question: http://stackoverflow.com/q/24967320
has comment: http://stackoverflow.com/comment/38809010
downvote count: 0
type: Answer

http://stackoverflow.com/comment/38711223
has text: Seems to be related to incompatible layout attribute.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24915233

http://stackoverflow.com/comment/38799776
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24962242
has text: setContentView should be used with a value from R.layout. You can't use R.raw with it.

http://stackoverflow.com/q/24955350
score: 0
answer count: 1
tagged with: glassfish-4
has answer: http://stackoverflow.com/a/25378130
type: AnsweredQuestion
tagged with: java
type: Question
has body: I have a weird problem with my Glassfish-Web application. Most of the time, my index.jsp site loads really fast. But sometimes (especially after updating a new version of the application), I get a bunch of TimeOutExceptions in Glassfish. In the Chrome developer console, all JavaScript files are on state 'Pending', the .jsp and .css files however, are loaded very quickly. After exactly 1 minute (or sometimes 1.5 minutes) most of the JavaScript files are on state '200'. Some of them remain on state 'Failed'. After reloading the page again, everything works fine. See screenshots from Chrome. Pending state: http://s30.postimg.org/ngr85kuk1/pending.png Done state: http://s17.postimg.org/dvdgxmppr/done.png These errors appear on glassfish: [#|2014-07-25T13:51:12.321+0200|WARNING|glassfish 4.0|javax.enterprise.web._vs.server|_ThreadID=27;_ThreadName=Thread-7;_TimeMillis=1406289072321;_LevelValue=900;|StandardWrapperValve[default]: Servlet.service() for servlet default threw exception java.io.IOException: java.util.concurrent.TimeoutException at org.glassfish.grizzly.utils.Exceptions.makeIOException(Exceptions.java:81) at org.glassfish.grizzly.http.io.OutputBuffer.blockAfterWriteIfNeeded(OutputBuffer.java:958) at org.glassfish.grizzly.http.io.OutputBuffer.write(OutputBuffer.java:682) at org.apache.catalina.connector.OutputBuffer.writeBytes(OutputBuffer.java:355) at org.apache.catalina.connector.OutputBuffer.write(OutputBuffer.java:342) at org.apache.catalina.connector.CoyoteOutputStream.write(CoyoteOutputStream.java:161) at org.apache.catalina.servlets.DefaultServlet.copy(DefaultServlet.java:2069) at org.apache.catalina.servlets.DefaultServlet.serveResource(DefaultServlet.java:1092) at org.apache.catalina.servlets.DefaultServlet.doGet(DefaultServlet.java:518) at javax.servlet.http.HttpServlet.service(HttpServlet.java:687) at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1682) at org.apac…
accepted answer: http://stackoverflow.com/a/25378130
tagged with: jsp
tagged with: javascript
tagged with: glassfish
has title: Glassfish loads JavaScript files really slow (> 1 minute)

http://stackoverflow.com/a/24956911
accepted answer of: http://stackoverflow.com/q/24956532
answers question: http://stackoverflow.com/q/24956532
has body: Use the Activity's method setTitle(String) to set your custom title as follows: @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); setTitle("Custom Action Bar Title"); } Good luck..
upvote count: 1
type: AcceptedAnswer
type: Answer
downvote count: 0
score: 1

http://stackoverflow.com/a/24966772
answers question: http://stackoverflow.com/q/24966712
score: 2
has body: if comma is decimal separator: double d = Double.parseDouble(s.substring(s.lastIndexOf(' ') + 1).replace(",", ".")); if comma is grouping separator: long d = Long.parseLong(s.substring(s.lastIndexOf(' ') + 1).replace(",", ""));
downvote count: 0
has comment: http://stackoverflow.com/comment/38808055
type: Answer
upvote count: 2

http://stackoverflow.com/a/24966903
has comment: http://stackoverflow.com/comment/38808184
has comment: http://stackoverflow.com/comment/38808251
has comment: http://stackoverflow.com/comment/38808397
score: 0
type: AcceptedAnswer
has body: Use SupportMapFragment when calling your map Fragment instead, that is the name of the class that you have declared on your layout, like this: googleMap = ((SupportMapFragment) getSupportFragmentManager().findFragmentById( R.id.map)).getMap(); Do not forget to import the SupportMapFragment class. Edit:use SupportFragmentManager also, that is the support version of FragmentManager. Edit2: You must make your Activity extend FragmentActivity, so you can use getSupportFragmentManager.
has comment: http://stackoverflow.com/comment/38808327
has comment: http://stackoverflow.com/comment/38808232
type: Answer
answers question: http://stackoverflow.com/q/24966753
accepted answer of: http://stackoverflow.com/q/24966753
has comment: http://stackoverflow.com/comment/38808365
has comment: http://stackoverflow.com/comment/38808376

http://stackoverflow.com/comment/38898779
type: Comment
has text: i tried SET PATH=%path%;C:\Program Files\Java\jdk1.6.0_38 but netbeans still crashes
score: 0
comment on: http://stackoverflow.com/a/25014168
type: AnswerComment

http://stackoverflow.com/a/25035709
score: 16
upvote count: 16
accepted answer of: http://stackoverflow.com/q/25035523
has comment: http://stackoverflow.com/comment/38937342
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/25035523
has body: Please take a look at a session from Google I/O 2014: https://www.youtube.com/watch?v=sha_w3_5c2c#t=1241 &lt;- 20:42 Justin talks there about android:keepScreenOn="true" attribute to prevent the timeout and "back to homescreen" behavior. Please read more info about keeping screen on here: https://developer.android.com/training/scheduling/wakelock.html#screen
type: Answer

http://stackoverflow.com/a/25059192
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25042317
type: Answer
upvote count: 1
has body: Criteria criteria = getSession().createCriteria(Car.class); criteria.createAlias("vignettes", "V"); criteria.add(Restrictions.or( Restrictions.lt("V.vignetteDateFin", dateDebut), Restrictions.isNull("V")) ); If this does not do what you want you may need a subquery. See this related question: Hibernate Criteria: adding additional restriction to Restrictions.isEmpty
score: 1
accepted answer of: http://stackoverflow.com/q/25042317
downvote count: 0

http://stackoverflow.com/comment/38851534
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24990015
type: Comment
has text: seems your `driver` is initialized only inside try block, its null at time you use in catch.

http://stackoverflow.com/q/24943552
has answer: http://stackoverflow.com/a/24944472
has body: Let's say I have an array of integers int timeouts [] = {1000 , 2000 , 3000 , 3500}; and I want to create a timer which counts up to 3.5 second and calls the same function if the milisecond count equals to one of the elements of the array. Is there a way to do this shortly without making multiple timers ?
type: AnsweredQuestion
has title: Java timer with multiple timeouts
downvote count: 0
has comment: http://stackoverflow.com/comment/38765212
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/38765272
type: Question
has answer: http://stackoverflow.com/a/24944326
accepted answer: http://stackoverflow.com/a/24944326
has comment: http://stackoverflow.com/comment/38764816
answer count: 3
upvote count: 1
has answer: http://stackoverflow.com/a/24944561
favorite count: 0
tagged with: timer
possible better answer: http://stackoverflow.com/a/24944472
has comment: http://stackoverflow.com/comment/38765726
has comment: http://stackoverflow.com/comment/38764796

android-viewpager
tag name: android-viewpager
tags question: http://stackoverflow.com/q/24919806
type: Tag

http://stackoverflow.com/comment/38807729
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24964247
has text: I debugged and watched what fills findWord and it is exactly whatever is entered. If I enter: of my and step through I can see findWord filled with: of my --- I have tried other multiword strings and some are found and some are not. Like: For mom was found the 1 time I know it appears in the text however: and dad was searched separately and was not found although it appears in the same line as For mom.

http://stackoverflow.com/a/25028337
upvote count: 1
has body: Mac, As you asked for something like String ValueDate = "\/Date(1440959400000+0530)\/"; The above one is not possible in java string, As it shows as invalid escape sequence, So replace the slash '\' as double slash '\' as below, String ValueDate = "\\/Date(1440959400000+0530)\\/"; If am not clear of our question, pls describe it clearly Regards, Hari
has comment: http://stackoverflow.com/comment/38924183
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/25028249

http://stackoverflow.com/q/25027423
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/25029073
score: 2
has title: Libgdx bullet show collision objects
upvote count: 2
tagged with: bullet
has body: Alright so I would like to know why when i run this i cannot see the bullet collision objects Prob. a rookie mistake public static PerspectiveCamera cam; static btCollisionWorld collisionWorld; DebugDrawer debugDrawer; public ModelBatch modelBatch; btCollisionConfiguration collisionConfig; static btDispatcher dispatcher; btBroadphaseInterface broadphase; public static btCollisionShape voxelShape; public static Model model; public static ModelInstance test; public static btCollisionShape collisiontest; public static btCollisionObject collisiontestobject; @Override public void create () { Bullet.init(); collisionConfig = new btDefaultCollisionConfiguration(); dispatcher = new btCollisionDispatcher(collisionConfig); broadphase = new btDbvtBroadphase(); collisionWorld = new btCollisionWorld(dispatcher, broadphase, collisionConfig); cam = new PerspectiveCamera(67, 1280, 720); cam.position.set(10f,10f,10f); cam.lookAt(0,0,0); cam.near = 1f; cam.far = 300f; cam.update(); modelBatch = new ModelBatch(); ModelBuilder modelBuilder = new ModelBuilder(); model = modelBuilder.createBox(3f, 3f, 3f, new Material(ColorAttribute.createDiffuse(Color.BLUE)), Usage.Position | Usage.Normal); test = new ModelInstance(model); test.transform.setTranslation(0,0,0); collisiontest = new btBoxShape(new Vector3 (6f,6f,6f)); collisiontestobject = new btCollisionObject(); collisiontestobject.setCollisionShape(collisiontest); collisiontestobject.setWorldTransform(new Matrix4()); debugDrawer = new DebugDrawer(); debugDrawer.setDebugMode(btIDebugDraw.DebugDrawModes.DBG_MAX_DEBUG_DRAW_MODE); collisionWorld.setDebugDrawer(debugDrawer); } @Override public void render () { cam.update(); Gdx.gl.glViewport(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT | GL20.GL_DEPTH_BUFFER_BIT); debugDrawer.begin(cam); collisionWorld.debugDrawWorld(); debugDrawer.end(); //modelBatch.begin(cam); //modelBatch.render(test); //modelBatch.end(); } When i run this I expected t…
type: AnsweredQuestion
tagged with: bulletphysics
tagged with: libgdx
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/25029073
answer count: 1

eclipse-adt
tags question: http://stackoverflow.com/q/24984116
tag name: eclipse-adt
type: Tag
tags question: http://stackoverflow.com/q/24975324

http://stackoverflow.com/a/24948543
accepted answer of: http://stackoverflow.com/q/24948522
has body: There's no guarantee to the compiler that the loop is ever entered. Thus the variable may not be initialized.
upvote count: 1
type: AcceptedAnswer
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/24948522

http://stackoverflow.com/a/24949675
has body: If your application is packaged in a jar file, you can use the "SplashScreen-Image" option in a manifest file to show a splash screen. Place the image in the jar archive and specify the path in the option. The path should not have a leading slash. The splash screen is displayed as an undecorated window containing an image. You can use GIF, JPEG, or PNG files for the image. Animation is supported for the GIF format, while transparency is supported both for GIF and PNG. The window is positioned at the center of the screen. The position on multi-monitor systems is not specified. It is platform and implementation dependent. The splash screen window is closed automatically as soon as the first window is displayed by Swing/AWT Your code will show the splash screen till SPLASH_TIME_OUT is called. which start the MainActivity after the splash screen .(consider your splash screen as a screen saver.) If the Java implementation provides the command-line interface and you run your application by using the command line or a shortcut, use the Java application launcher option to show a splash screen. The Oracle reference implementation allows you to specify the splash screen image location with the -splash: option. For example: java -splash:filename.gif Test
type: Answer
answers question: http://stackoverflow.com/q/24949587
score: 0

http://stackoverflow.com/comment/38988375
type: AnswerComment
type: Comment
score: 0
has text: No, any GUI component, like JTextField, holds a reference to its parent, and that can only be one. You can add a change listener, and pass the new value to a controller object holding both GUI classes, and passing that new value to the other class. This is the so-called MVC, Model-Vieew-Controller, pattern. Best hold the JFrames and provide them with `public void updateText(String newValue);`.
comment on: http://stackoverflow.com/a/25062361

http://stackoverflow.com/comment/38997330
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25066824
has text: I'm sure Preferences will be fine.
score: 0

http://stackoverflow.com/comment/38892326
type: Comment
score: 0
comment on: http://stackoverflow.com/q/25011439
type: QuestionComment
has text: i am telling that if i want to convert integer 4 to binary, then i can do it using java.lang.Integer.toString(4,2) method but it shows up "100"in binary but i want the answer as "000100"

http://stackoverflow.com/a/24938267
type: Answer
answers question: http://stackoverflow.com/q/24938123
has comment: http://stackoverflow.com/comment/38756450
has comment: http://stackoverflow.com/comment/38755640
has body: Put your jar file in the libs folder of your project in the project explorer it should be under -project name-/app/libs/ if it doesn't exist create it. Then simply put this catch all in your build.gradle. dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) } You could also try updating to gradle 1.12 change distributionUrl=http\://services.gradle.org/distributions/gradle-1.11-all.zip to distributionUrl=http\://services.gradle.org/distributions/gradle-1.12-all.zip
has comment: http://stackoverflow.com/comment/38756323
has comment: http://stackoverflow.com/comment/38755953
score: 0

http://stackoverflow.com/a/25041869
accepted answer of: http://stackoverflow.com/q/25041520
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 2
upvote count: 2
has body: If you create TrafficReportMapper&lt;DayTrafficReport&gt; your method will become: @Override public DayTrafficReport mapRow(ResultSet rs, int rowNum) { return new TrafficReport(....); } (not really since generics get erased, but it's a good way to think about it.) But TrafficReport is not a subtype of DayTrafficReport, so you can't return it like this.
answers question: http://stackoverflow.com/q/25041520

http://stackoverflow.com/comment/38778182
score: 2
has text: I think his question is more of "why do I sometimes get lucky" rather than "why did the Exception occur at all?"
comment on: http://stackoverflow.com/a/24950802
type: AnswerComment
type: Comment

http://stackoverflow.com/q/25058024
has comment: http://stackoverflow.com/comment/38979384
tagged with: mobile
has comment: http://stackoverflow.com/comment/38997045
has comment: http://stackoverflow.com/comment/38984887
downvote count: 0
has comment: http://stackoverflow.com/comment/39023040
tagged with: tomcat
favorite count: 0
has comment: http://stackoverflow.com/comment/38984909
has title: Session timeout when switching Network
has comment: http://stackoverflow.com/comment/38997018
has body: We have a Java application that runs on Tomcat 6. In most cases we leave the session inactive timeout to the default value of 30 minutes. In some cases we extend inactive timeout to two hours based on what user ask for at login. Say I sign into the application from the laptop and wired (connected to LAN) and stay the same the inactive session timeout works perfectly the way it is supposed to. But if I go wireless by taking off from the LAN cable and connect to the wireless hotspot my session becomes invalid and I would have to re-login. So switching the IP address seems to invalidate the session. Is this a normal behavior? Is there a way I could preserve the session when switching from one network to another? I am not that of an expert in Tomcat so any direction will be helpful. Thank you so much!
answer count: 0
upvote count: 3
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/14902533
has comment: http://stackoverflow.com/comment/38980043
score: 3
tagged with: session
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/38985249

http://stackoverflow.com/q/24953683
answer count: 0
score: 1
tagged with: java
has body: I have noticed that the private messaging portlet uses MBMessageLocalServiceUtil method getMBMessage(long id) where id is mbThreadId which is a property of private messaging portlet basic entity(UserThread). So, when there is no record in message boards entries with id that corresponds to mbThreadId an exception is thrown 10:15:06,232 ERROR [RuntimePageImpl-2][render_portlet_jsp:132] null com.liferay.portlet.messageboards.NoSuchMessageException: No MBMessage exists with the primary key 111020 at com.liferay.portlet.messageboards.service.persistence.MBMessagePersistenceImpl.findByPrimaryKey(MBMessagePersistenceImpl.java:19490) at com.liferay.portlet.messageboards.service.persistence.MBMessagePersistenceImpl.findByPrimaryKey(MBMessagePersistenceImpl.java:19508) at com.liferay.portlet.messageboards.service.base.MBMessageLocalServiceBaseImpl.getMBMessage(MBMessageLocalServiceBaseImpl.java:291) at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:115) at com.liferay.portal.spring.transaction.DefaultTransactionExecutor.execute(DefaultTransactionExecutor.java:62) ... Is this a normal behavior? Can these 2 portlets work together?
type: Question
tagged with: jakarta-ee
tagged with: liferay
has comment: http://stackoverflow.com/comment/38783594
downvote count: 0
has comment: http://stackoverflow.com/comment/38785851
favorite count: 0
has comment: http://stackoverflow.com/comment/38784579
type: UnansweredQuestion
has title: Liferay private messaging portlet along with message boards portlet
upvote count: 1
tagged with: liferay-6
has comment: http://stackoverflow.com/comment/38784498

http://stackoverflow.com/q/25051291
has comment: http://stackoverflow.com/comment/38967176
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/38967196
has comment: http://stackoverflow.com/comment/38967237
has comment: http://stackoverflow.com/comment/38967063
has answer: http://stackoverflow.com/a/25051470
has comment: http://stackoverflow.com/comment/38967108
score: 0
tagged with: java
tagged with: eclipse
type: Question
linked to: http://stackoverflow.com/q/2471935
has comment: http://stackoverflow.com/comment/38967125
has answer: http://stackoverflow.com/a/25051834
has title: Downloading an image into internal storage and reading it in android
has comment: http://stackoverflow.com/comment/38967097
answer count: 2
has body: I am trying to download an image from url and i want to display it in an imageview.My code is as follows: package com.example.imageinternalstorage; import java.io.BufferedInputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.InputStream; import java.net.URL; import java.net.URLConnection; import android.os.Bundle; import android.app.Activity; import android.content.Context; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.view.Menu; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.ImageView; import android.widget.Toast; public class MainActivity extends Activity { Button btnstoreinternal,btnloadfrominternal; ImageView iv_category; boolean download_success; String URL_image="http://footballultimate.com/storelocator/resource/uploads/"; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); btnstoreinternal=(Button) findViewById(R.id.btnstoreinternal); btnloadfrominternal=(Button) findViewById(R.id.btnloadfrominternal); iv_category=(ImageView) findViewById(R.id.iv_category); btnstoreinternal.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { download_success=downloadFile(URL_image+"Hospital.png"); if(download_success==true) { Toast.makeText(getApplicationContext(),"Download success",Toast.LENGTH_LONG).show(); } else { Toast.makeText(getApplicationContext(),"Download failed",Toast.LENGTH_LONG).show(); } } }); btnloadfrominternal.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { iv_category.setImageBitmap(getImageBitmap(MainActivity.this,"Hospital.png")); } }); } public boolean downloadFile(final String path) { try { URL url = new URL(path); URLConnection ucon = url.openConnection(); ucon.setReadTimeout(5000); ucon.setConnectTimeout(10000); InputStream is = uc…

http://stackoverflow.com/q/25062726
tagged with: jersey
upvote count: 9
linked to: http://stackoverflow.com/q/5079367
downvote count: 0
tagged with: asynchronous
favorite count: 0
linked to: http://stackoverflow.com/q/17554233
tagged with: rest
type: UnansweredQuestion
tagged with: multithreading
has answer: http://stackoverflow.com/a/49801764
has body: I try to understand the way asynchronous responses work with Jersey. I read chapter 10 of the Jersey documentation (https://jersey.java.net/documentation/latest/async.html) but it doesn't help with my problem. Also research here on stackoverflow didn't result in satisfying answers (that I can understand). What I'm trying to do is similar to the one question in this post (Use http status 202 for asynchronous operations). I want to upload a large file to the server using a HTML form document. After the request is send to the server the web service should immediately response with status 202 and a URI where the file can be found after the request has finished. After reading the post abive it seems possible but sadly no hints how to implement such a behavior where given. I wrote a small web service to test the functionality: @Path("/test/async/") public class TestAsyncResponse { @GET @Path("get") public Response asyncGet(@Suspended final AsyncResponse response) { new Thread(new Runnable() { @Override public void run() { DateFormat df = new SimpleDateFormat("dd/MM/yy HH:mm:ss"); System.out.println("#### thread started: " + df.format(new Date()) + " ####"); String result = veryExpensiveOperation(); System.out.println("#### thread finished: " + df.format(new Date()) + " ####"); response.resume(result); } private String veryExpensiveOperation() { try { Thread.sleep(10000); } catch (InterruptedException e) { e.printStackTrace(); } return "Woke up!"; } }).start(); return Response.status(202).entity("Request accepted. " + "Long running operation started") .build(); } } The service works but as a response I get the "Woke Up!" message after the 10 second wait rather than the 202 response which seems logical because the AsyncResponse is the one that handles the response (as I understand it). After reading the documentation I got the impression that this is suppose to happen because all Jersey does with the asynchronous server response is to outsource the thread from the response …
tagged with: java
has comment: http://stackoverflow.com/comment/58063319
has answer: http://stackoverflow.com/a/30037006
score: 9
type: Question
answer count: 2
has title: Jersey: immediate Response after asynchronous request

pdfbox
tag name: pdfbox
tags question: http://stackoverflow.com/q/24952437
tags question: http://stackoverflow.com/q/24954281
tags question: http://stackoverflow.com/q/25043720
tags question: http://stackoverflow.com/q/25066497
tags question: http://stackoverflow.com/q/25052255
tags question: http://stackoverflow.com/q/25021777
tags question: http://stackoverflow.com/q/24991474
type: Tag

http://stackoverflow.com/a/25022339
downvote count: 1
answers question: http://stackoverflow.com/q/25022027
has comment: http://stackoverflow.com/comment/38913129
type: Answer
upvote count: 0
has comment: http://stackoverflow.com/comment/38918606
has comment: http://stackoverflow.com/comment/38924769
has comment: http://stackoverflow.com/comment/38913847
score: -1
has body: I expect you are looking for the ternary operator, which lets you compress conditional statements down into a single expression like so: // returns the nth number in the fibonacci sequence public static int fib(int n) { return (n &lt; 2) ? n : fib(n-1) + fib(n-2); } P.S. This should work for both standard seed conditions of F1 = 1 F2 = 1 or F0 = 0 F1 = 1 See the Wikipedia article for a complete discussion of the math.
has comment: http://stackoverflow.com/comment/38918927
accepted answer of: http://stackoverflow.com/q/25022027
type: AcceptedAnswer

http://stackoverflow.com/a/24977609
downvote count: 0
score: 1
has body: As Eran mentions, try to avoid circular dependencies. The following web page from google guice's best practices describes how to avoid circular dependencies and resolve them: https://github.com/google/guice/wiki/CyclicDependencies
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24977174
type: Answer
answers question: http://stackoverflow.com/q/24977174

spring
tags question: http://stackoverflow.com/q/25052457
tags question: http://stackoverflow.com/q/25008359
tags question: http://stackoverflow.com/q/24948882
tags question: http://stackoverflow.com/q/25058112
tags question: http://stackoverflow.com/q/24925056
tags question: http://stackoverflow.com/q/24980364
tags question: http://stackoverflow.com/q/24975869
tags question: http://stackoverflow.com/q/24953168
tags question: http://stackoverflow.com/q/24939901
tags question: http://stackoverflow.com/q/25068699
tags question: http://stackoverflow.com/q/24953288
tags question: http://stackoverflow.com/q/25059684
tags question: http://stackoverflow.com/q/25024694
tags question: http://stackoverflow.com/q/25020239
tags question: http://stackoverflow.com/q/24955537
tags question: http://stackoverflow.com/q/25002834
tags question: http://stackoverflow.com/q/24917378
tags question: http://stackoverflow.com/q/24959658
tags question: http://stackoverflow.com/q/24931248
tags question: http://stackoverflow.com/q/24939401
tags question: http://stackoverflow.com/q/24952131
tags question: http://stackoverflow.com/q/24939581
tags question: http://stackoverflow.com/q/25055756
tags question: http://stackoverflow.com/q/25039992
tags question: http://stackoverflow.com/q/25004905
tags question: http://stackoverflow.com/q/25044012
tags question: http://stackoverflow.com/q/24955679
tags question: http://stackoverflow.com/q/25011420
tags question: http://stackoverflow.com/q/24996483
tags question: http://stackoverflow.com/q/25047751
tags question: http://stackoverflow.com/q/24932926
tags question: http://stackoverflow.com/q/24974990
tags question: http://stackoverflow.com/q/24917194
tags question: http://stackoverflow.com/q/24929623
tags question: http://stackoverflow.com/q/25035009
tags question: http://stackoverflow.com/q/25060027
tags question: http://stackoverflow.com/q/24956809
tags question: http://stackoverflow.com/q/25056533
tags question: http://stackoverflow.com/q/24957458
tags question: http://stackoverflow.com/q/24925053
tags question: http://stackoverflow.com/q/25053215
tags question: http://stackoverflow.com/q/25037568
tags question: http://stackoverflow.com/q/24937441
tags question: http://stackoverflow.com/q/25056966
tags question: http://stackoverflow.com/q/24942105
tags question: http://stackoverflow.com/q/24970969
tags question: http://stackoverflow.com/q/25045264
tags question: http://stackoverflow.com/q/24909904
type: Tag
tags question: http://stackoverflow.com/q/24950411
tags question: http://stackoverflow.com/q/25001857
tags question: http://stackoverflow.com/q/25000434
tags question: http://stackoverflow.com/q/25009894
tags question: http://stackoverflow.com/q/25018814
tags question: http://stackoverflow.com/q/25044725
tags question: http://stackoverflow.com/q/25065036
tags question: http://stackoverflow.com/q/25065473
tags question: http://stackoverflow.com/q/25020305
tags question: http://stackoverflow.com/q/24936636
tags question: http://stackoverflow.com/q/24913541
tags question: http://stackoverflow.com/q/24960172
tags question: http://stackoverflow.com/q/24967080
tags question: http://stackoverflow.com/q/25007286
tags question: http://stackoverflow.com/q/24985832
tags question: http://stackoverflow.com/q/25039249
tags question: http://stackoverflow.com/q/24909935
tags question: http://stackoverflow.com/q/25063674
tags question: http://stackoverflow.com/q/24912165
tags question: http://stackoverflow.com/q/25020331
tags question: http://stackoverflow.com/q/24931583
tags question: http://stackoverflow.com/q/24927437
tags question: http://stackoverflow.com/q/24985177
tags question: http://stackoverflow.com/q/25062239
tags question: http://stackoverflow.com/q/24946322
tags question: http://stackoverflow.com/q/24924932
tags question: http://stackoverflow.com/q/24947876
tags question: http://stackoverflow.com/q/24935192
tags question: http://stackoverflow.com/q/24984965
tags question: http://stackoverflow.com/q/25047673
tags question: http://stackoverflow.com/q/25007881

http://stackoverflow.com/q/24938554
type: AnsweredQuestion
upvote count: 2
possible better answer: http://stackoverflow.com/a/24938799
has answer: http://stackoverflow.com/a/24938799
has comment: http://stackoverflow.com/comment/38755008
type: Question
tagged with: c#
tagged with: timestamp-with-timezone
has comment: http://stackoverflow.com/comment/39038403
has title: C# DateTime in Java
tagged with: java
has comment: http://stackoverflow.com/comment/38755322
has answer: http://stackoverflow.com/a/24939110
answer count: 3
linked to: http://stackoverflow.com/q/2883576
downvote count: 0
accepted answer: http://stackoverflow.com/a/24939110
favorite count: 0
has body: I am trying to convert millseconds to time in Java. when I do this in C# DateTime EpochOrigin = new DateTime(1970, 1, 1, 0, 0, 0, 0); Console.WriteLine("1406205185123 = " + EpochOrigin.AddMilliseconds(1406205185123)); result 24/07/2014 12:33:05 when I do same in Java Calendar cc = new GregorianCalendar(); cc.setTimeInMillis(1406205185123L); result Thu Jul 24 13:33:05 BST 2014 The Java result add 1 more hour than C# . Any suggestion how can I fix this?
has answer: http://stackoverflow.com/a/25089176
score: 2

http://stackoverflow.com/q/24913206
accepted answer: http://stackoverflow.com/a/24918727
downvote count: 0
answer count: 1
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
tagged with: http-redirect
upvote count: 1
tagged with: http
type: Question
score: 1
has body: I'm currently working on a third-party-program for a website using its public XML API. I don't want to go into deeper matters about what the program is actually doing or whatsoever because there seems to be a problem right at the beginning. The website's API expects a client to follow redirects and to set a proper user agent to verify the application itself, but the JDOM2 library, which I use for this project, doesn't seem to do any of these things. Neither the SAXBuilder (org.jdom2.input) integrated in the package nor the native HTTPURLConnection (java.net) class seem to do a proper job. I'm very confused and don't know where to start at all. Is there any way to make the JDOM2 library follow redirects or am I just missing a simple method call?
has title: JDOM2 - Follow Redirects (HTTP Error 301)
tagged with: java
tagged with: jdom-2
has answer: http://stackoverflow.com/a/24918727

http://stackoverflow.com/q/24963117
tagged with: linux
has comment: http://stackoverflow.com/comment/38801267
has comment: http://stackoverflow.com/comment/38801576
accepted answer: http://stackoverflow.com/a/24965545
score: 1
has comment: http://stackoverflow.com/comment/38801791
has comment: http://stackoverflow.com/comment/38801893
has comment: http://stackoverflow.com/comment/38801931
has comment: http://stackoverflow.com/comment/38802138
upvote count: 1
has comment: http://stackoverflow.com/comment/38802826
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38802025
linked to: http://stackoverflow.com/q/9639080
has comment: http://stackoverflow.com/comment/38801493
tagged with: java
has answer: http://stackoverflow.com/a/24965545
type: Question
answer count: 2
has title: Tomcat Realm forms: login always fails
downvote count: 0
tagged with: jdbcrealm
tagged with: tomcat
possible better answer: http://stackoverflow.com/a/24963380
has body: The Tomcat Realm (Forms) authentification in my JSP project worked well before i changed OS to linux, now it doesn't: login is always fails. IDE is IDEA. The project uses: 8.0.9 Tomcat JDBCRealm PostgreSql 9.3 Postgres JDBC driver is in /WEB-INF/lib dir and visible by Hibernate as org.postgresql.Driver Postgres login&amp;pass are correct and table names are correct too Changes in server.xml: &lt;Host name="localhost" appBase="webapps" unpackWARs="true" autoDeploy="true"&gt; &lt;Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" prefix="localhost_access_log" suffix=".txt" pattern="%h %l %u %t &amp;quot;%r&amp;quot; %s %b" /&gt; &lt;Realm className="org.apache.catalina.realm.LockOutRealm"&gt; &lt;Realm className="org.apache.catalina.realm.UserDatabaseRealm" resourceName="UserDatabase"/&gt; &lt;Realm className="org.apache.catalina.realm.JDBCRealm" driverName="org.postgresql.Driver" connectionURL="jdbc:postgresql://localhost:5432/postgres?user=postgres&amp;amp;password=123" userTable="users" userNameCol="name" userCredCol="pass" userRoleTable="user_roles" roleNameCol="role"/&gt; &lt;/Realm&gt; ... actually, I changed nothing there except moving LockOutRealm to &lt;Host&gt; tag and adding JDBCRealm block into. The web.xml is correct, because it worked well before... Why doesn't it work? Maybe it's about linux user's privilege? pg_hba.conf: # TYPE DATABASE USER ADDRESS METHOD # "local" is for Unix domain socket connections only local all all md5 # IPv4 local connections: host all all 127.0.0.1/32 md5 # IPv6 local connections: host all all ::1/128 md5 # Allow replication connections from localhost, by a user with the # replication privilege. #local replication postgres md5 #host replication postgres 127.0.0.1/32 md5 #host replication postgres ::1/128 md5 Postgres log: 2014-07-25 19:52:17 MSK LOG: database system was shut down at 2014-07-25 19:52:07 MSK 2014-07-25 19:52:17 MSK LOG: database system is ready to accept connections 2014-07-25 19:52:17 …
has comment: http://stackoverflow.com/comment/38802488
favorite count: 0
has answer: http://stackoverflow.com/a/24963380
tagged with: postgresql

http://stackoverflow.com/comment/38699308
has text: Are you not missing single quotation marks around the timestamp?
comment on: http://stackoverflow.com/q/24909275
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/comment/38773643
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24947467
has text: @Mike'Pomax'Kamermans Sir, I can't use the database approach.

http://stackoverflow.com/a/24977408
downvote count: 1
type: Answer
score: 2
answers question: http://stackoverflow.com/q/24976037
has body: a "main" method is the starting point of every java program. What is going on with this class is that its not a java program by itself, is executed inside some type of framework (karel robot java implementation in this case), this frameworks off course have a "main" method but not this class, the framework knows how to load this class and execute his run method. This "programs" are frameworks designed to do a specialized type of programs, i don't know this "karel framework", but for example, when you program a java web application you write a "servlet" but you don't write a "main" method. There are some programs called "application servers" that off course have a "main" method and take this servlet class and execute for response to some http message.
upvote count: 3

http://stackoverflow.com/comment/38736646
has text: Have you tried `gradle build`?
type: Comment
comment on: http://stackoverflow.com/q/24928673
score: 0
type: QuestionComment

http://stackoverflow.com/q/25023296
type: Question
tagged with: autocomplete
answer count: 1
has answer: http://stackoverflow.com/a/25061606
has title: Custom Eclipse editor: auto-complete brackets
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/38914853
type: UnansweredQuestion
upvote count: 1
tagged with: jface
tagged with: editor
score: 1
tagged with: java
has body: I've created a custom editor for eclipse but I'm having trouble setting up an auto-complete feature (when a developer enters an opening bracket the editor auto-generates the closing bracket). I've looked at the java example and spent some time googling but I'm having trouble finding any information. Any help is greatly appreciated.
has comment: http://stackoverflow.com/comment/38914804
tagged with: eclipse

http://stackoverflow.com/a/24963651
has body: ArrayList is a list implementation that's backed by an Object[]. It supports random access and dynamic resizing. LinkedList is a list implementation that uses references to head and tail to navigate it. It has no random access capabilities, but it too supports dynamic resizing. Bear in mind that both support the get(int index) signature, but the difference between the two implementations is performance: with an ArrayList, that's a matter of going to the index position, whereas with a LinkedList, you have to walk down the object chain (either from the front or the rear, depending on what you've indexed into).
type: Answer
upvote count: 7
score: 7
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24963620
downvote count: 0
answers question: http://stackoverflow.com/q/24963620

http://stackoverflow.com/q/24967669
has comment: http://stackoverflow.com/comment/38809650
has title: data communication with multiple clients on a single port
has comment: http://stackoverflow.com/comment/38810632
answer count: 0
type: UnansweredQuestion
tagged with: multithreading
upvote count: 1
downvote count: 1
type: Question
tagged with: java
has body: I have created a java server which uses one port for listening to new connections and creates another port when one client attach to it. This another port is used for data communication with client for which it is created. Each time new user connects , server creates new port. But as we know No. of Ports are limited. So is it possible for server to communicate with multiple clients through single port ? Thanks, Arpit
score: 0
has comment: http://stackoverflow.com/comment/38809543
favorite count: 0

ray-picking
tags question: http://stackoverflow.com/q/24944576
type: Tag
tag name: ray-picking

http://stackoverflow.com/q/24974849
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24974890
has answer: http://stackoverflow.com/a/24975262
tagged with: java
type: Question
has title: Taking in a File as a parameter
possible better answer: http://stackoverflow.com/a/24974890
score: 0
answer count: 3
has body: public fillVal(File s) throws FileNotFoundException{ Scanner kb = new Scanner(s); while(kb.hasNextDouble()){ //etc... } So say my file name is "file1.txt". When I go to enter that text ("file1.txt") int BlueJ's "create object tab" I get something that says incompatible types. I have the txt file in the file with the class. Is this not a valid way to take in a file and take values from it? Let me know if this is wrong. Thanks
has answer: http://stackoverflow.com/a/24974904
accepted answer: http://stackoverflow.com/a/24974904

http://stackoverflow.com/comment/38723260
type: Comment
type: QuestionComment
has text: I tried doing that but I got this error: "void cannot be dereferenced"
comment on: http://stackoverflow.com/q/24920916
score: 0

http://stackoverflow.com/comment/38851140
type: QuestionComment
comment on: http://stackoverflow.com/q/24989790
score: 3
has text: what is the line number of NPE ?
type: Comment

http://stackoverflow.com/q/24912908
has answer: http://stackoverflow.com/a/24913524
downvote count: 0
has title: Get only TimeZone field from new Date() in java
has answer: http://stackoverflow.com/a/24913000
has body: Requirement : I want to get only TimeZone field from new Date(), As of now from new Date() ,I am getting result as Wed Jul 23 19:37:20 GMT+05:30 2014,But I want only GMT+05:30,Is there any way to get only this? PS:I dont want to use split for getting timezone field.because this is my final option for achieving above requirement.
has answer: http://stackoverflow.com/a/24913094
answer count: 4
favorite count: 0
type: UnansweredQuestion
tagged with: timezone
upvote count: 1
has comment: http://stackoverflow.com/comment/38741901
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/24918885
tagged with: date
type: Question

http://stackoverflow.com/a/24972985
score: 0
answers question: http://stackoverflow.com/q/24972402
type: Answer
has comment: http://stackoverflow.com/comment/38819651
has body: Please Find a very easy solution.. import java.io.BufferedReader; import java.io.FileReader; public class FileReader1 { static public void main( String args[] ) throws Exception { try(BufferedReader br = new BufferedReader(new FileReader("E:\\Software\\Jyoti_WorkSpace\\Test\\src\\sample4.txt"))) { String line = br.readLine(); while (line != null) { line = br.readLine(); if (line!=null){ String output[]= line.split(":"); if(output.length&gt;1) System.out.println(output[0] +"--&gt; "+ output[1]); } } } } } OUTPUT Message-ID--&gt; &lt;4129F3CA.2020509@dc.edu&gt; Date--&gt; Mon, 23 Aug 2005 11 From--&gt; Taylor Evans &lt;example_from@dc.edu&gt; User-Agent--&gt; Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv X-Accept-Language--&gt; en-us, en MIME-Version--&gt; 1.0 To--&gt; Jon Smith &lt;example_to@mail.dc.edu&gt; Subject--&gt; Business Development Meeting Content-Type--&gt; text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding--&gt; 7bit'

http://stackoverflow.com/comment/38872959
has text: App crashes see logcat in question, I think it needs some sort of '_id' ? But nothing in my database exists '_id' nor in my code, any reason ?
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25000591
type: AnswerComment

http://stackoverflow.com/comment/38914427
type: Comment
comment on: http://stackoverflow.com/a/25007741
has text: First get a pointer to the outermost object containing the data (a JSONArray/List in this case). Access that object (write a loop to index through the array) and operate on each object contained therein (a JSONObject/Map in this case). Access *that* object to obtain whatever your next goal is. Etc. Peel it like an onion, a layer at a time. You may end up with several nested loops, of course, but that's what the data asks for.
score: 0
type: AnswerComment

http://stackoverflow.com/q/25017691
downvote count: 0
possible better answer: http://stackoverflow.com/a/33830156
has answer: http://stackoverflow.com/a/33830156
score: 19
has answer: http://stackoverflow.com/a/25018161
type: Question
has comment: http://stackoverflow.com/comment/125725018
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/77133196
linked to: http://stackoverflow.com/q/21791853
tagged with: scheduled-tasks
accepted answer: http://stackoverflow.com/a/25018161
favorite count: 0
has comment: http://stackoverflow.com/comment/126222079
has answer: http://stackoverflow.com/a/71407966
has title: Accessing scheduled tasks in Spring
has body: I have a couple of tasks scheduled within Spring's task scheduler: &lt;task:scheduled-tasks&gt; &lt;task:scheduled ref="task1" method="run" cron="0 0 */0 * * *" /&gt; &lt;task:scheduled ref="task2" method="run" cron="0 0 */30 * * *" /&gt; &lt;/task:scheduled-tasks&gt; &lt;task:scheduler id="scheduler" pool-size="10" /&gt; How can I access a list of scheduled tasks and retrieve meta-information (e.g the next execution time) from within the application context? ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("context.xml"); ThreadPoolTaskScheduler scheduler = (ThreadPoolTaskScheduler)context.getBean("scheduler"); //... how to continue from here?
tagged with: spring
upvote count: 19
tagged with: java
answer count: 4

http://stackoverflow.com/comment/38897752
type: QuestionComment
comment on: http://stackoverflow.com/q/25014535
has text: Please do not ask multiple diverse questions. Please read [How do I ask a good question?](http://stackoverflow.com/help/how-to-ask).
score: 0
type: Comment

http://stackoverflow.com/q/24985027
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/38862758
has title: Inserting joinpoint inside methods with AspectJ?
upvote count: 1
type: Question
tagged with: aspectj
downvote count: 0
favorite count: 0
type: UnansweredQuestion
has body: I need to write a code coverage program for test using AspectJ plugin for Eclipse. At the moment i know, using pointcuts, what methods are executed by JUnit test-case and how many times they are called but my problem is that I want to insert a joinpoint inside a method (for example before an if-else condition or a for loop) to catch the execution of a block-code with a pointcut. According to AspectJ documentation Pointcuts pick out arbitrarily large numbers of join points of a program. But they pick out only a small number of kinds of join points. Those kinds of join points correspond to some of the most important concepts in Java. Here is an incomplete list: method call, method execution, exception handling, instantiation, constructor execution, and field access. Each kind of join point can be picked out by its own specialized pointcut that you will learn about in other parts of this guide. but I need to know when a code-branch is reached inside a method. Is there any possible solution, maybe an extension of aspectJ? Thanks in advance
answer count: 0

http://stackoverflow.com/q/25001180
tagged with: playframework
answer count: 1
has body: I tried to import jquery ui support into a very simple java application. My first goal is to get the example jquery ui site (http://jqueryui.com/themeroller/) that comes with each jquery installation running. My problem is that http://localhost:9000/ returns me the file, but without working javascripts (Accordion is e.g. just displaying the text but not displaying the accordion). Once this works my next step would be to fill the components with data from controllers.Applicaiton. Suggestions on how this works (e.g. for the accordion) are also highly welcome. Thank you in advance! My public directory: public images javascripts jquery-ui.js jquery.js stylesheets jquery-ui.css jquery-ui.structure.css jquery-ui.theme.css My conf/routes file: GET / controllers.Application.index() My controllers.Application class has just one method: public static Result index() { return ok(index.render("Your new application is ready.")); } My main.scala.html (EDIT: Order of imports changed after comment below.) @(title: String)(content: Html) @title @content And finally my index.scala.html (shortended). @(message: String) @main("NuMap") { Welcome to jQuery UI! This page demonstrates the widgets and theme you selected in Download Builder. Please make sure you are using them with a compatible jQuery version. YOUR COMPONENTS: Accordion First Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet. Second Phasellus mattis tincidunt nibh. Third Nam dui erat, auctor a, dignissim quis. ... all the other components from sample file... } My generated HTML has the following header: NuMap So everything looks ok, but still jquery-ui is not working...
has answer: http://stackoverflow.com/a/25002040
type: UnansweredQuestion
has title: Integrate JQuery UI into Play Framework
type: Question
tagged with: jquery-ui
tagged with: java
score: 0

http://stackoverflow.com/comment/38924670
type: Comment
has text: As in OutOfMemoryException?
comment on: http://stackoverflow.com/q/25028669
score: 0
type: QuestionComment

http://stackoverflow.com/q/25051031
has comment: http://stackoverflow.com/comment/38966855
has answer: http://stackoverflow.com/a/48181047
favorite count: 0
has comment: http://stackoverflow.com/comment/38966621
has comment: http://stackoverflow.com/comment/38966702
has comment: http://stackoverflow.com/comment/38966929
downvote count: 1
upvote count: 4
has comment: http://stackoverflow.com/comment/38966715
answer count: 4
has answer: http://stackoverflow.com/a/25051078
accepted answer: http://stackoverflow.com/a/25051078
tagged with: multithreading
linked to: http://stackoverflow.com/q/2690207
type: AnsweredQuestion
score: 3
possible better answer: http://stackoverflow.com/a/25051394
tagged with: java
has comment: http://stackoverflow.com/comment/38966712
has comment: http://stackoverflow.com/comment/38966800
has body: I was trying to test/learn a few basic things in threading(Java) and came across a simple but confusing output. Following are my classes public class CopyMaster implements Runnable{ @Override public void run() { System.out.println("Run called from Copy Master for thread "+Thread.currentThread().getName()); } } Main Class from where I am invoking threads public class Main { public static void main(String[] args) { Thread[] threadArray = new Thread[4]; for(int i=0; i&lt;threadArray.length; i++){ threadArray[i] = new Thread(new CopyMaster()); } for(Thread t : threadArray){ //[Line of intrest]System.out.println("Starting Thread "+t.getName()); t.start(); } } } OP(With Line of Interest un-commented) Starting Thread Thread-0 Starting Thread Thread-1 Run called from Copy Master for thread Thread-0 Starting Thread Thread-2 Run called from Copy Master for thread Thread-1 Starting Thread Thread-3 Run called from Copy Master for thread Thread-2 Run called from Copy Master for thread Thread-3 OP(With Line of Interest commented) Run called from Copy Master for thread Thread-2 Run called from Copy Master for thread Thread-3 Run called from Copy Master for thread Thread-0 Run called from Copy Master for thread Thread-1 I have tried running the code multiple times and observed that the sequence of print-outs are random in commented line of interest and in un-commented one its proper(in sequence)... Why is it behaving like that?//EDITED as this confuses what i want to mean EDIT: I understand that threads behaves unpredictably but my main question is why it maintains oredr ALWAYS in one case and why random behavior is there in other case?
has answer: http://stackoverflow.com/a/25051394
has comment: http://stackoverflow.com/comment/38966788
type: Question
has comment: http://stackoverflow.com/comment/38983178
has title: Why Thread execution is giving different output?
has answer: http://stackoverflow.com/a/25051087

http://stackoverflow.com/a/24990829
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/24990108
has body: != compares a single value, so it takes only the first row of the subquery. To compare with a all values in a set, use IN: select Email_Address from eloqua_export where Email_Address not in (select Email_Address from eloqua_export_duplicate); select Email_Address from eloqua_export_duplicate where Email_Address not in (select Email_Address from eloqua_export);
downvote count: 0
answers question: http://stackoverflow.com/q/24990108
has comment: http://stackoverflow.com/comment/38853033
score: 1
has comment: http://stackoverflow.com/comment/38863210
upvote count: 1

http://stackoverflow.com/comment/39047745
has text: Which code? I posted two snippets, and the second is only needed if you still want to launch your activity with a action string (that again, I don't see the point of doing it this way...). Please add the error you got in Logcat. "Root Help was stopped" does not help to diagnose anything. If you get something like "No Activity found to handle Intent" you messed up something in the action name
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25089345
type: Comment

http://stackoverflow.com/q/24923910
has body: I have a very simple solution but I have not yet learned how to do it and cannot figure out how to solve the problem. I have an Interface class: public interface Analyzable { double getAverage(); GradedActivity getHighest(); GradedActivity getLowest(); } This was given to me by my professor. I changed his code from the two GradedActivity to doubles and had no problem returning them in this code. However I am having trouble returning them as GradedActivity's public GradedActivity getHighest() { double highest = grades[0].getScore(); for(int i = )...... //Code works and returns correct number (tested) return highest; this code gives me this error "Double cannot be converted to GradedActivity" this is my GradedActivity code public class GradedActivity { private double score; public GradedActivity() { } public void setScore(double s) { score = s; } public double getScore() { return score; } public char getGrade() { char letterGrade; if(score &gt;= 90) letterGrade = 'A'; else if(score &gt;= 80) letterGrade = 'B'; else if(score &gt;= 70) letterGrade = 'C'; else if(score &gt;= 60) letterGrade = 'D'; else letterGrade = 'F'; return letterGrade; } } this is the CourseGrades code enter code here public class CourseGrades extends GradedActivity implements Analyzable { private GradedActivity[] grades = new GradedActivity[4]; public CourseGrades() { } public void setLab(GradedActivity lab) { grades[0] = lab; } public void setPassFailExam(PassFailExam passFailExam) { grades[1] = passFailExam; } public void setEssay(GradedActivity essay) { grades[2] = essay; } public void setFinalExam(FinalExam finalExam) { grades[3] = finalExam; } public String toString() { String str; str = "Lab Score: " + grades[0].getScore() + "\t\t\tGrade: " + grades[0].getGrade() + "\nP/F Exam Score: " + grades[1].getScore() + "\t\tGrade: " + grades[1].getGrade() + "\nEssay Score: " + grades[2].getScore() + "\t\tGrade: " + grades[2].getGrade() + "\nFinal Exam Score: " + grades[3].getScore() + "\t\tGrade: " + …
type: UnansweredQuestion
tagged with: superclass
tagged with: java
has title: Returning an object in java with a double?
has answer: http://stackoverflow.com/a/24923965
has answer: http://stackoverflow.com/a/24924031
type: Question
tagged with: inheritance
score: 0
answer count: 3
tagged with: subclass
tagged with: interface
has answer: http://stackoverflow.com/a/24923952

http://stackoverflow.com/comment/38960913
comment on: http://stackoverflow.com/q/25047627
has text: i am kind of new to programming so i dont know how i would go about doing it. Can you provie an example?
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/a/24937895
has comment: http://stackoverflow.com/comment/38754051
type: Answer
has comment: http://stackoverflow.com/comment/38798477
score: 5
answers question: http://stackoverflow.com/q/24937618
has comment: http://stackoverflow.com/comment/56486604
has body: I wouldn't worry about it, you would need millions of Objects for this to really make a difference on a server. But if you really want to know, you can look at the implementations to see the fields of each object, and the fields of each parent object etc and the fields of each referenced object). You can add up the number bytes used by each field + the size of an object reference (4 or 8 bytes depending on JVM) plus padding described in the Java spec. Or you can use 3rd party libraries such as java.sizeOf which will do this for you. But taking a quick look at the code of the classes you asked about, here are the fields: Date: private transient long fastTime; /* * If cdate is null, then fastTime indicates the time in millis. * If cdate.isNormalized() is true, then fastTime and cdate are in * synch. Otherwise, fastTime is ignored, and cdate indicates the * time. */ private transient BaseCalendar.Date cdate; long + reference to other class which has its own fields etc. However, after lots of code reading, cdate is almost alwasy null so we only have to count the size of the object reference (to null) which I think won't bloat up the size of the object beyond the padding of 24 bytes when using a 32-bit or if on 64 bit, using compressed Ops which tries to use 4 byte references instead of 8 when possible. (I think this is default on Java 8) so we can ignore it. LocalDate: /** * The year. */ private final int year; /** * The month-of-year. */ private final short month; /** * The day-of-month. */ private final short day; So int+short+short takes the same size as long but you have to account for the memory of each LocalDate reference you keep around. Datetime: private long iMillis; private Chronology iChronology; Which is also long + object ref to other object that takes up memory. Using SizeOf When I created an instance of each object and used java.sizeOf on them on my 64bit Java 8 JVM I got the following memory sizes (in bytes): javaDate = 24 localDate = 24 dateTime = 16928…
downvote count: 2
accepted answer of: http://stackoverflow.com/q/24937618
upvote count: 7
type: AcceptedAnswer

http://stackoverflow.com/q/25024086
has body: While solving a UVa question, I got this String and I need to split it an array of String removing # and @ Brazil#2@1#Scotland I was getting a ArrayOutOfBounds exception when I used, matchSummary.split("#@"); after researching solutions for this UVa question, I found that other experienced competitive programmers have done it like this, string.split("[#@]"); and this passes the verdict of online judge. I cant get this String split for this aforementioned String My complete solution for this question is available here- see Can anybody explain to me why my code worked with split("[#@]");?
tagged with: regex
answer count: 4
has comment: http://stackoverflow.com/comment/38916355
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38916420
possible better answer: http://stackoverflow.com/a/25024180
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/25024209
score: 0
has title: java string.split() issue
has answer: http://stackoverflow.com/a/25024210
has answer: http://stackoverflow.com/a/25024180
accepted answer: http://stackoverflow.com/a/25024210
has answer: http://stackoverflow.com/a/25024165

http://stackoverflow.com/a/24952383
accepted answer of: http://stackoverflow.com/q/24952055
type: AcceptedAnswer
type: Answer
has body: The converter it will show you the date in this format on the page (in the jsp/html page). What it does, is converting the date in a string in the format dd-mm-yyyy. When you pass the calue in the validate function, it is not converted in the string in the format dd-MM-yyyy. it is a date, dueDate is a date, so by printing value.toString() is just converts the date value to a string. So the object is a date and just by casting to Date is should work. if you want in the code to print it in the format dd-MM-yyyy try this Date date = (Date) value; SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy"); String strDate = sdf.format(date); System.out.println(strDate );
answers question: http://stackoverflow.com/q/24952055
score: 0

http://stackoverflow.com/q/24981344
score: 0
has comment: http://stackoverflow.com/comment/38838638
has comment: http://stackoverflow.com/comment/38838751
answer count: 1
has title: How to get around the static reference in a fragment class?
has body: I'm trying to reference a linearLayout, and use a sharedpreference in the onViewCreated of a fragment class, yet this creates 3 syntax errors saying "cannnot make a static reference to a non-static method." I understand why this is happening, but I can't figure out a way around it. I tried deleting the static identifier to the fragment class, but that just lead from one problem to the next. And, I can't put this code in the onCreate() because I'm referencing views in the fragment. The lines of code with the static error are: getApplicationContext() findViewById() FillInInfo(v); I can fix the FillInInfo(v) one easily by making it static, but I still posted it just in case I don't have to make it static. Here's the fragment class: public static class PlaceholderFragment extends Fragment { /** * The fragment argument representing the section number for this * fragment. */ private static final String ARG_SECTION_NUMBER = "section_number"; /** * Returns a new instance of this fragment for the given section number. */ public static PlaceholderFragment newInstance(int sectionNumber) { PlaceholderFragment fragment = new PlaceholderFragment(); Bundle args = new Bundle(); args.putInt(ARG_SECTION_NUMBER, sectionNumber); fragment.setArguments(args); return fragment; } public PlaceholderFragment() { } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_manage_day, container, false); TextView textView = (TextView) rootView .findViewById(R.id.section_label); textView.setText(Integer.toString(getArguments().getInt( ARG_SECTION_NUMBER))); return rootView; } public void onViewCreated(View v, Bundle savedInstanceState) { super.onViewCreated(v, savedInstanceState); SharedPreferences activitiesFile = getApplicationContext().getSharedPreferences("Activities", 0); Set&lt;String&gt; keylist = activitiesFile.getAll().keySet(); for (String s : keylist) { String active = activitiesFile…
has comment: http://stackoverflow.com/comment/38881904
has comment: http://stackoverflow.com/comment/38838602
has comment: http://stackoverflow.com/comment/38881833
tagged with: android
has comment: http://stackoverflow.com/comment/38838824
has answer: http://stackoverflow.com/a/24983386
has comment: http://stackoverflow.com/comment/38838701
type: AnsweredQuestion
tagged with: android-fragments
tagged with: java
has comment: http://stackoverflow.com/comment/38881770
type: Question
accepted answer: http://stackoverflow.com/a/24983386
has comment: http://stackoverflow.com/comment/38881883

http://stackoverflow.com/comment/38924769
comment on: http://stackoverflow.com/a/25022339
has text: @azurefrog OP: "program [...] as output **the Fibonacci sequence** (until N member)". Where is the loop for the output of the sequence?
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/24941686
tagged with: java
type: Question
has body: So I downloaded JNativeHook 1.1.4 from Link for JNativeHook And then I added it to my build path and compiled the program. I tested the program on my Linux VPS and get this error. [root@nl ~]# java -jar file.jar Exception in thread "main" java.lang.UnsatisfiedLinkError: /tmp/libJNativeHook_468389387164048348.so: libXt.so.6: cannot open shared object file: No such file or directory The program was compiled using Java 1.6 and my VPS is running. [root@nl ~]# java -version java version "1.7.0_65" OpenJDK Runtime Environment (rhel-2.5.1.2.el6_5-x86_64 u65-b17) OpenJDK 64-Bit Server VM (build 24.65-b04, mixed mode) How can I get my program to work on Linux?. The program is working fine on Windows. When i run yum whatprovides '*/libXp.so.6 I get this. libXp-1.0.0-15.1.el6.x86_64 : X.Org X11 libXp runtime library Repo : base Matched from: Filename : /usr/lib64/libXp.so.6
has comment: http://stackoverflow.com/comment/38762182
has title: java.lang.UnsatisfiedLinkError: on Linux but not Windows
has comment: http://stackoverflow.com/comment/38761819
has comment: http://stackoverflow.com/comment/38761217
has comment: http://stackoverflow.com/comment/38798374
has comment: http://stackoverflow.com/comment/38762317
favorite count: 0
has comment: http://stackoverflow.com/comment/38763556
tagged with: linux
answer count: 0
has comment: http://stackoverflow.com/comment/38762613
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/17355863
downvote count: 2
has comment: http://stackoverflow.com/comment/38762397
score: 1
upvote count: 3

http://stackoverflow.com/a/24957540
score: 1
upvote count: 1
has body: If what you want is a more meaningful exception text, you'll need to catch the original exception and throw your own: int parseInt(String str) { try { Integer.parseInt(str); } catch(NumberFormatException e) { throw new NumberFormatException("Invalid number: " + str); } } Not that I'd advise such a thing.
answers question: http://stackoverflow.com/q/24957317
downvote count: 0
type: Answer

keystroke
type: Tag
tags question: http://stackoverflow.com/q/24932009
tag name: keystroke

http://stackoverflow.com/comment/99416434
type: AnswerComment
type: Comment
has text: @SomeoneSomewhere thanks - replaced it with the new location of the javadocs
comment on: http://stackoverflow.com/a/25059947
score: 0

http://stackoverflow.com/comment/38942930
type: Comment
type: QuestionComment
has text: @morpheus05 it is a client application running on desktop, but my question was more in general. Because i bumped into this problem with a few other projects.
comment on: http://stackoverflow.com/q/25038117
score: 0

http://stackoverflow.com/comment/38918131
comment on: http://stackoverflow.com/q/25025031
has text: Why not inf/Inf/INF ?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38843834
type: QuestionComment
comment on: http://stackoverflow.com/q/24983812
score: 0
has text: your questions had made me nuts, wanna talk about it?
type: Comment

http://stackoverflow.com/a/24989679
score: 3
downvote count: 0
has body: Take a look at How to use Actions public abstract class AbstractNumberValueAction extends AbstractAction { private NumberModel model; private JTextField numberField; private int delta; public ValueAction(NumberModel model, JTextField numberField, int delta) { this.model = model; this.numberField = numberField; this.delta = delta; } public void actionPerformed(ActionEvent evt) { int value1000 = model.updateValue(delta); if(value1000&gt;0) { numberField.setText(value1000+""); } if(value1000==0) { numberField.setText(value1000+""); setEnabled(false); } } } public class UpAction extends AbstractNumberValueAction { public ValueAction(NumberModel model, JTextField numberField) { this(model, numberField, 1); putValue(SMALL_ICON, new ImageIcon("more_buttons\\up3.png")); } } public class DownAction extends AbstractNumberValueAction { public ValueAction(NumberModel model, JTextField numberField) { this(model, numberField, -1); putValue(SMALL_ICON, new ImageIcon("more_buttons\\down3.png")); } } Which could then simply be applied as up = new JButton(new UpAction(model, number)); down = new JButton(new DownAction(model, number)); For example... (ps- NumberModel would be a simple class that controlled the underlying value to make is simpler to manage ;))
answers question: http://stackoverflow.com/q/24989527
upvote count: 3
type: Answer

http://stackoverflow.com/comment/38937938
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/25036072
type: Comment
has text: Ok, I thought so, but wasn't sure. Thanks. I will accept the answer in 10 min, since I can't yet after just creating the question. ;) Looks like my problem of my AutoCompleteTextView currently being unfocussable lies somewhere else, so I will look into this and perhaps create a new question if necessary.

http://stackoverflow.com/a/25016155
has comment: http://stackoverflow.com/comment/38902848
has comment: http://stackoverflow.com/comment/38903559
type: AcceptedAnswer
score: 4
type: Answer
has comment: http://stackoverflow.com/comment/38903851
has comment: http://stackoverflow.com/comment/38903274
has body: I think the best way to achieve this is to chain your methods: getDataByDateInterval(Date from, Date to) { //... } getDataByWeek(Date to) { // Calculate 'from' date (minus 7 days) return getDataByDateInterval(from, to); } This approach keeps your interface clear but prevents you violating the DRY principle.
has comment: http://stackoverflow.com/comment/38903742
upvote count: 4
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25016026
answers question: http://stackoverflow.com/q/25016026

http://stackoverflow.com/q/24932374
type: Question
upvote count: 2
possible better answer: http://stackoverflow.com/a/24932517
has answer: http://stackoverflow.com/a/24932538
has title: Java: how to print the rows from database?
has answer: http://stackoverflow.com/a/24932517
accepted answer: http://stackoverflow.com/a/24932538
has answer: http://stackoverflow.com/a/24933261
tagged with: java
answer count: 3
tagged with: mysql
linked to: http://stackoverflow.com/q/10903206
downvote count: 1
has comment: http://stackoverflow.com/comment/38743027
has comment: http://stackoverflow.com/comment/38743370
tagged with: database
has body: I have this program: class DataRetrieve { DataRetrieve() { try { Class.forName("com.mysql.jdbc.Driver"); Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/phonebook", "root", "1234"); Statement st = con.createStatement(); st.executeQuery("select * from contacts"); } catch(Exception e) { e.printStackTrace(); } } } public class MainProgram { public static void main(String[] args) { DataRetrieve dr = new DataRetrieve(); //here i want to print that table rows into Console using this System.out.println(); // How do you print here that table rows? } } Can anyone explain how to print this database information in System.out.println?
type: AnsweredQuestion
score: 1
favorite count: 0

http://stackoverflow.com/comment/38798546
has text: Which version of Archiva do you use? Best would be to ask on the mailing lists...
comment on: http://stackoverflow.com/q/24957374
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24953513
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/24953370
upvote count: 2
type: Answer
has body: what's the point of Map using a static member class for Entry? That's because, it makes the package structure logically correct. Why not just use an interface on the API? Now, this is a design discussion nobody would like to be dragged into.

http://stackoverflow.com/a/24964581
type: Answer
answers question: http://stackoverflow.com/q/24964293
score: 0
has body: This regex ^\s*(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\{.*\}).*$ works for your two given inputs, but will almost certainly fail for inputs whose (undeclared-in-question) syntax is valid. If you'd be willing to accept a slight change to the input syntax, you might want to consider using json (and use java's parser for it, jackson: https://github.com/FasterXML/jackson)

http://stackoverflow.com/comment/38950396
has text: FYI, if you only have one parameter, generally Theories are the easier way to do this. Parameters are better when you want to explicitly pair values (either multiple inputs or input and expected output).
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25042364
type: Comment

http://stackoverflow.com/comment/38865076
comment on: http://stackoverflow.com/q/24997309
score: 0
type: Comment
type: QuestionComment
has text: Try `key = key.replaceFirst("\\s*-", "");`.

http://stackoverflow.com/comment/39024474
type: Comment
comment on: http://stackoverflow.com/a/25066733
type: AnswerComment
has text: hk2 gives the users the ability to choose which constructor (or methods or fields) are to be injected into with a ClassAnalyzer
score: 0

http://stackoverflow.com/comment/38969406
comment on: http://stackoverflow.com/a/25052515
has text: Thanks a lot for the help so far! I'll post my custom class now~
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/a/24968349
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/24937539
has body: Change your when clause to when(queryBus.handle(eq(VehicleCollection.class), any(GetVehicle.class))) .... If you use one matcher, then every argument must be a matcher. And in this case, the first argument must be a matcher of type Class&lt;R&gt;. So don't use isA or any, because they will give you type VehicleCollection. Instead, you need eq.
downvote count: 0
type: Answer

http://stackoverflow.com/comment/38943714
score: 0
has text: I can't help you there because I don't know how src2srcml works. What is the output? Text? Can you print it in any way to the console?
comment on: http://stackoverflow.com/q/25038912
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41213959
score: 0
has text: @ Takendarkk I am experiencing the same issue. Out of curiosity, how could you resolve OP last question "All errors gone apparently but when i run the app it says The message client did not start" GrStorm? also for me as well it says it says Variable messageService is never used
type: Comment
comment on: http://stackoverflow.com/q/24965588
type: QuestionComment

http://stackoverflow.com/a/25027414
has comment: http://stackoverflow.com/comment/38923545
has comment: http://stackoverflow.com/comment/38923805
has comment: http://stackoverflow.com/comment/38923269
has comment: http://stackoverflow.com/comment/38923151
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/38923816
has comment: http://stackoverflow.com/comment/38922600
has comment: http://stackoverflow.com/comment/38922574
has comment: http://stackoverflow.com/comment/38923930
has comment: http://stackoverflow.com/comment/38923519
has comment: http://stackoverflow.com/comment/38923910
has comment: http://stackoverflow.com/comment/38923706
has body: There are three basic problems... First... In your Triangle constructor, you are passing getSide1(), getSide2() and getSide3() to the setSides method... public Triangle(double side1, double side2, double side3, String color, boolean filled) throws IllegalTriangleException { try { setSides(getSide1(), getSide2(), getSide3()); This means, you are simply passing the values of the fields side1, side2 and side3, which haven't been set yet are defaulted to 0, which means you are effectively saying... setSides(0d, 0d, 0d); This needs to be changed to pass the parameters of the constructor, for example... public Triangle(double side1, double side2, double side3, String color, boolean filled) throws IllegalTriangleException { try { setSides(side1, side2, side3); Second... Your setSides method is testing the state of the instance fields state1, state2 and state3, which haven't been set yet (and even correcting for the previous mistake) are still defaulted to 0...so 0 + 0 &gt; 0 is ... false public void setSides(double newSide1, double newSide2, double newSide3) throws IllegalTriangleException { if (side1 + side2 &gt; side3){ if (side1 + side3 &gt; side2) if (side2 + side3 &gt; side1) This should be modified to use the values passed to the method instead... public void setSides(double newSide1, double newSide2, double newSide3) throws IllegalTriangleException { if (newSide1 + newSide2 &gt; newSide3) if (newSide1 + newSide3 &gt; newSide2) if (newSide2 + newSide3 &gt; newSide1) Third... The previous if statement is wrong. What this basically equates to saying is, if everything is fine, set side1 = newSide1 and regardless of anything else, set side2 and side3 to newSide2 and newSide3 respectivly... public void setSides(double newSide1, double newSide2, double newSide3) throws IllegalTriangleException { if (newSide1 + newSide2 &gt; newSide3) if (newSide1 + newSide3 &gt; newSide2) if (newSide2 + newSide3 &gt; newSide1) side1 = newSide1; side2 = newSide2; side3 = newSide3; This is w…
has comment: http://stackoverflow.com/comment/38923211
answers question: http://stackoverflow.com/q/25027249
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25027249
score: 1

http://stackoverflow.com/q/25031328
score: 20
answer count: 2
has answer: http://stackoverflow.com/a/25036338
linked to: http://stackoverflow.com/q/13906687
has title: smooth rounded corners in swing
tagged with: rounded-corners
has comment: http://stackoverflow.com/comment/38931770
favorite count: 0
upvote count: 20
has body: I want to make smooth rounded corners for my swing application, but I can't get my desired result... here's the screenshots: 1.setShape() for JFrame : 2.overriding paintComponent() method for JPanel instead of using setShape() : 3.setBackground(new Color(0, 0, 0, 0)) for JFrame : well, but there's a problem with text quality: before step 3 : after step 3 : guys I'm confused, I've searched many times but nothing helped me... what should I do? please help me here's the full code : public class WelcomePage extends JFrame { private Point initialClick; private boolean end = false; private JLabel jLabelAppTitle; private JPanel jPanelExit; private JLabel jLabelHint; private int r = 220, g = 0, b = 0; private int r2 = 10, g2 = 10, b2 = 10; private boolean flag = false; public WelcomePage() { initComponents(); // setShape(new RoundRectangle2D.Double(0, 0, getWidth(), getHeight(), 15, 15)); centerLocation(); refreshPage(); } public static void main(String args[]) { try { for (UIManager.LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException e) { e.printStackTrace(); } EventQueue.invokeLater(() -&gt; FadeTransitions.fadeIn(new WelcomePage(), FadeTransitions.NORMAL_FADE, true)); } private void refreshPage() { Timer timer = new Timer(20, e -&gt; { if (!end) { if (r == 220 &amp;&amp; b == 0 &amp;&amp; g &lt; 220) { g++; } else if (g == 220 &amp;&amp; b == 0 &amp;&amp; r &gt; 0) { r--; } else if (g == 220 &amp;&amp; r == 0 &amp;&amp; b &lt; 220) { b++; } else if (b == 220 &amp;&amp; r == 0 &amp;&amp; g &gt; 0) { g--; } else if (b == 220 &amp;&amp; g == 0 &amp;&amp; r &lt; 220) { r++; } else if (r == 220 &amp;&amp; g == 0 &amp;&amp; b &gt; 0) { b--; } if (!flag) { r2 += 5; g2 += 5; b2 += 5; if (r2 == 250) { flag = true; } } else { r2 -= 5; g2 -= 5; b2 -= 5; if (r2 =…
linked to: http://stackoverflow.com/q/9382426
type: UnansweredQuestion
tagged with: swing
tagged with: java-8
tagged with: jbutton
has answer: http://stackoverflow.com/a/25041627
downvote count: 0
tagged with: java
type: Question

http://stackoverflow.com/comment/38744212
comment on: http://stackoverflow.com/q/24932977
score: 0
has text: Ouch on that `System.exit(0)`... You reset the Table model everytime. Use a custom `MutableTableModel` and `model.fireTableDataChanged()` instead.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24919624
has comment: http://stackoverflow.com/comment/38719761
has title: Create a JAR file in eclipse dynamically from the code
tagged with: eclipse
score: 0
answer count: 1
tagged with: jar
has comment: http://stackoverflow.com/comment/38720122
has answer: http://stackoverflow.com/a/24919785
type: UnansweredQuestion
tagged with: maven
has comment: http://stackoverflow.com/comment/38719981
tagged with: java
has body: I am currently working on a TESTING a game project. Below are the details about my project. This is my first Maven Project and I really have very less idea on it's working methodology.Please help me! 1] GameProject - Is a Maven Project in Eclipse. The main goals of this project is to create a game player (also called bot) for a First Person Shooter game. When you run this Java Application, it will run the game, with a new player, whose actions will be determined by the code I wrote up in this project. It has lot of java files, and one main class. There is a class called PlayerInfo.Java, which contains the code to decide, what the player should do while playing the game. It is like the brain of the player. Let's say it has around 40 variables, which decides the behavior of the Player. Example - One of the variable in the class may be like Player_HEALTH_Level = 50. This means that Player should have atleast 50% of the health to be able to fight with other players. If it's less than this, then He/she should find a health Pack and increase the value. Similarly I have few other 39 parameters. 2] Testing Project - This too is a maven Project. Which is designed to test my Player(bot) performance in the game. Such as, how many times he wins the match, number of weapons he collects, etc. The way this project is designed that, it requires the path for the JAR file of the GameProject as a input in the Main Method. Then, It runs the bot/player for the given JAR and prints out the results of the game in a separate file. Example - In the Main Method I specify something like this String playerJAR_Path = "C:\Users\Player\Netbeans\GameProject-one-SNAPSHOT-jar.jar" Note:- The above is the path for GameProject JAR folder. Basically, I just build the GameProject as "Maven Install" and it will create a JAR for me. Then use the path address on the second Project. Hope this gives you some idea about my project structure. Issue The real issue is I have to basically run my GameProject aroun…
has comment: http://stackoverflow.com/comment/38719827
type: Question

http://stackoverflow.com/a/67072938
downvote count: 0
score: 1
has body: I solved by removed @JsonManagedReference and keep @JsonBackReference as it to avoid infinity loop .
answers question: http://stackoverflow.com/q/24972437
upvote count: 1
type: Answer

http://stackoverflow.com/q/24940806
type: Question
has comment: http://stackoverflow.com/comment/38759385
tagged with: jtable
score: 0
has answer: http://stackoverflow.com/a/24946210
tagged with: jscrollpane
answer count: 1
has comment: http://stackoverflow.com/comment/38759358
has title: JScrollPane scrollbar does not appear until after rowSorter.toggleSortOrder() is called
tagged with: swing
accepted answer: http://stackoverflow.com/a/24946210
type: AnsweredQuestion
tagged with: java
tagged with: tablerowsorter
has body: I have noticed that when I have a JTable with a TableRowSorter contained by a JScrollPane, the vertical scrollbar does not appear until after I have created SortKeys for the sorter (which is done by calling toggleSortOrder() for one of the columns). My question is really why? What do SortKeys have to do with a vertical scrollbar? Update: Added SSCCE that opens a JFrame with a JTable inside a JScrollPane, that sits in a Container along with a "Populate" button. When the table is initially painted, there is no data and hence no need for a scroll bar. After I populate it with 20 rows, there is a need for a scroll bar, but none appears. There are two ways to make the scroll bar appear: Click on either of the header cells to cause a sort to occur. Remove the commented call toggleSortOrder() in the Container's refresh() method. // table.getRowSorter().toggleSortOrder(0); toggleSortOrder() calls setSortKeys() calls sort() calls fireRowSorterChanged() and eventually something catches the event and adds the scroll bar. package test; import java.awt.Dimension; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.ArrayList; import java.util.List; import javax.swing.BorderFactory; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JScrollPane; import javax.swing.JTable; import javax.swing.ListSelectionModel; import javax.swing.WindowConstants; import javax.swing.table.AbstractTableModel; import javax.swing.table.TableRowSorter; @SuppressWarnings("serial") public class TestFrame extends JFrame { class MyTableModel extends AbstractTableModel { public List&lt;String&gt; names = new ArrayList&lt;String&gt;(); public int getRowCount () { return names.size(); } public int getColumnCount () { return 2; } public String getColumnName (int columnIndex) { return columnIndex &gt; 0 ? "Name" : "Number"; } public Class&lt;?&gt; getColumnClass (int columnIndex) { return String.class; } public Object getValueAt (int row, int col) { re…

http://stackoverflow.com/q/24918931
tagged with: thread-safety
has body: Is the setBounds() method of a Component like JPanel called on the Event Dispatch Thread? I am asking this because I am writing a program that draws platforms and uses a Swing Timer to move them up. I override the setBounds() method so that every time the JPanel is resized, the platforms will resize too. I just want to make sure that setBounds() doesn't resize the platforms while the Timer is moving them. Also, would it be better to use a WindowListener to check if the JPanel was resized?
type: Question
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/24919059
tagged with: setbounds
tagged with: event-dispatch-thread
upvote count: 1
tagged with: swing
accepted answer: http://stackoverflow.com/a/24919059
type: AnsweredQuestion
score: 1
tagged with: java
has title: Is setBounds() called in the EDT?

http://stackoverflow.com/comment/38811887
type: Comment
score: 0
has text: Should be, you can't get any more useful information from the `Process` object anyway ...
type: QuestionComment
comment on: http://stackoverflow.com/q/24968950

http://stackoverflow.com/q/25009365
score: 0
has title: Web Services response contains invalid "?" before and after
tagged with: websphere
has comment: http://stackoverflow.com/comment/38893097
has comment: http://stackoverflow.com/comment/38893517
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38892963
tagged with: soap
has comment: http://stackoverflow.com/comment/38894176
has comment: http://stackoverflow.com/comment/38890009
answer count: 0
has comment: http://stackoverflow.com/comment/38894483
tagged with: java
tagged with: web-services
has comment: http://stackoverflow.com/comment/38893281
type: Question
tagged with: ejb
has comment: http://stackoverflow.com/comment/38926837
has body: I am upgrading my application infrastructure, earlier my application(written in 2006) was deployed on WAS6 now upgrading it to WAS8.5. The issue is: I have a EJB 2.1 application which is consuming SOAP web service on some other server outside my network. When i call the web service it sends correct request, i can see it on console but when i receive response it contains "?" before and after the response. due to which i got error: 00000076 SystemErr R [Fatal Error] :1:1: Content is not allowed in prolog. I suspect this is due to some configuration i missed while installing because response text is correct but the HTTP response wrapped around it is creating problem and adding "?". Thanks in advance. Below is the response i am getting: ?<?xml version="1.0" encoding="utf-16"?> <session_response xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <return_code>0</return_code> 4674cfcf-e465-4550-a2d0-7fb5a1cff69b ABC <system_error_code>0</system_error_code> <account_locked>False</account_locked> False USER 07/28/2014 7:54:05 AM </session_response>?
has comment: http://stackoverflow.com/comment/38888252

http://stackoverflow.com/a/25055673
downvote count: 0
score: 1
has body: You can try something like following List&lt;Users&gt; usersList = new ArrayList&lt;&gt;(); Map&lt;String,List&lt;Users&gt;&gt; hashMap = new HashMap &lt;&gt; (); hashMap.put("user",usersList); Now hashMap.get("user") Will return a List of Users, Now you can use hashMap.get("user").get(0); // to get 0th index user
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/25055508

http://stackoverflow.com/a/24962286
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/24962077
has body: In addition of a shell script, you might also use binfmt_misc tricks. I prefer the shell script, it is probably more portable (some Linux system might not load, or have available, the kernel module required to support binfmt_misc) As the kernel's Documentation/java.txt explains: 2) You have to compile BINFMT_MISC either as a module or into the kernel (CONFIG_BINFMT_MISC) and set it up properly. If you choose to compile it as a module, you will have to insert it manually with modprobe/insmod, as kmod cannot easily be supported with binfmt_misc. Read the file 'binfmt_misc.txt' in this directory to know more about the configuration process. 3) Add the following configuration items to binfmt_misc (you should really have read binfmt_misc.txt now): support for Java applications: ':Java:M::\xca\xfe\xba\xbe::/usr/local/bin/javawrapper:' support for executable Jar files: ':ExecutableJAR:E::jar::/usr/local/bin/jarwrapper:' support for Java Applets: ':Applet:E::html::/usr/bin/appletviewer:' or the following, if you want to be more selective: ':Applet:M::&lt;!--applet::/usr/bin/appletviewer:' Of course you have to fix the path names. The path/file names given in this document match the Debian 2.1 system. (i.e. jdk installed in /usr, custom wrappers from this document in /usr/local) using gcj Another possibility (which I don't recommend) would be to use gcj (the old Java compiler inside GCC). gcj enables you to compile a Java program into a native Linux ELF binary executable. But I don't recommend it because: few (and less and less) people inside the GCC community are working on gcj few people are using gcj ; I only met only one occasional developer using it so gcj is becoming obsolete gcj generated code which allocates a lot does not perform very well (because it uses Boehm garbage collector which is much slower than the GC in other Java implementations). However on Java code with a low allocation rate it may run quite fast (because of the powerful optimizations of GCC done in …
has comment: http://stackoverflow.com/comment/38800016
upvote count: 1
type: Answer

http://stackoverflow.com/a/25037283
type: AcceptedAnswer
downvote count: 0
score: 1
type: Answer
upvote count: 1
accepted answer of: http://stackoverflow.com/q/25037148
answers question: http://stackoverflow.com/q/25037148
has body: That it creates a zillion anonymous inner classes for no reason whatsoever. I agree about grouping components with {} but I don't see making anonymous classes justified, e.g. // This is unnecessary and unjustified: setContent(layout = new VerticalLayout() { // ... });

http://stackoverflow.com/q/24939448
has title: Do I need to remake jar file every time I update config file?
favorite count: 0
type: UnansweredQuestion
tagged with: config
score: -1
linked to: http://stackoverflow.com/q/22923226
tagged with: java
has comment: http://stackoverflow.com/comment/38756687
downvote count: 1
type: Question
duplicate of: http://stackoverflow.com/q/22923226
has body: I have a config.properties file that my JavaMail program pulls from for the email address's, message, etc. When I update the config.properties file, the jar file doesn't pull from that config file, but instead pulls from the config file when I initially created the jar file. I am using Eclipse. I was wondering if there's a way to make the jar file pull from the updated config file or if I had to remake the jar every time. Thanks.
tagged with: eclipse
tagged with: jakarta-mail
has answer: http://stackoverflow.com/a/24939509
upvote count: 0
answer count: 1
tagged with: jar

http://stackoverflow.com/comment/39247078
has text: E com.ibm.ws.webcontainer.servlet.ServletWrapper service SRVE0068E: Uncaught exception created in one of the service methods of the servlet /sampleBankCustomerCheckPortProxy/Result.jsp in application JAXWSCustomerClientEAR. Exception created : com.ibm.websphere.servlet.error.ServletErrorReport: **java.lang.NoClassDefFoundError: com.ibm.ws.wstx.handler.WSATGenerator (initialization failure)** at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:695) at com.ibm._jsp._Result._jspService(_Result.java:372)
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24959189

http://stackoverflow.com/q/24986887
score: 2
has answer: http://stackoverflow.com/a/24989364
upvote count: 2
tagged with: java
has answer: http://stackoverflow.com/a/24988229
type: Question
tagged with: hadoop
answer count: 3
tagged with: file-io
has body: I'm trying to read the contents of a file from HDFS. My code is below - package gen; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.Path; public class ReadFromHDFS { public static void main(String[] args) throws Exception { if (args.length &lt; 1) { System.out.println("Usage: ReadFromHDFS &lt;hdfs-file-path-to-read-from&gt;"); System.out.println("Example: ReadFromHDFS 'hdfs:/localhost:9000/myFirstSelfWriteFile'"); System.exit(-1); } try { Path path = new Path(args[0]); FileSystem fileSystem = FileSystem.get(new Configuration()); BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(fileSystem.open(path))); String line = bufferedReader.readLine(); while (line != null) { System.out.println(line); line = bufferedReader.readLine(); } } catch (IOException e) { e.printStackTrace(); } } } However, I can't figure out how to give this program the path to my HDFS directory. I have tried - java -cp &lt;hadoop jar:myjar&gt; gen.ReadFromHDFS &lt;path&gt; where with path I tried referencing the directory directly (what I see when I do hadoop fs -ls), the file inside the directory, adding hdfs:/localhost, hdfs:/ and none of them work. Can any one help me with how exactly I should pass the path of my folder to HDFS? For example, when I give the path directly (with no prefix) it says that the file does not exist. Edit: None of the solutions so far seem to work for me. I always get the exception - java.io.FileNotFoundExceptoin: File &lt;filename&gt; does not exist. at org.apache.hadoop.fs.getFileSystem.getFileStatus(RawLocalFileSystem.java:361) It seems to be trying to find the file locally.
downvote count: 0
has answer: http://stackoverflow.com/a/24987191
favorite count: 0
type: UnansweredQuestion
has title: Reading data from HDFS - my program can't find the path

http://stackoverflow.com/q/25011420
answer count: 1
favorite count: 0
type: UnansweredQuestion
has body: In my application I use security.xml like this: &lt;security:http pattern="/services/upload" security="none" /&gt; &lt;security:http auto-config='true' create-session="stateless" entry-point-ref="digestEntryPoint"&gt; &lt;security:intercept-url pattern="/admin.html" access="ROLE_ADMIN" /&gt; &lt;security:intercept-url pattern="/services/projects/**" access="ROLE_ADMIN" /&gt; &lt;security:http-basic /&gt; &lt;security:custom-filter ref="digestFilter" after="BASIC_AUTH_FILTER" /&gt; &lt;/security:http&gt; &lt;bean id="digestFilter" class="org.springframework.security.web.authentication.www.DigestAuthenticationFilter"&gt; &lt;property name="userDetailsService" ref="userService" /&gt; &lt;property name="authenticationEntryPoint" ref="digestEntryPoint" /&gt; &lt;/bean&gt; &lt;bean id="digestEntryPoint" class="org.springframework.security.web.authentication.www.DigestAuthenticationEntryPoint"&gt; &lt;property name="realmName" value="Admin Tab via Digest Authentication" /&gt; &lt;property name="key" value="acegi" /&gt; &lt;/bean&gt; &lt;security:authentication-manager&gt; &lt;security:authentication-provider&gt; &lt;security:user-service id="userService"&gt; &lt;security:user name="xx" password="xx" authorities="ROLE_ADMIN" /&gt; &lt;/security:user-service&gt; &lt;/security:authentication-provider&gt; &lt;/security:authentication-manager&gt; When I click on admin tab on index.html browser pops up its (not controlled by me) form to enter login and password. When I click cancel on this button I get 401 error page. When I enter bad credentials popup resets and doesn't inform me about credentials. What I would like to achieve is to just stay on index.html when user click cancel and show some information if user enters bad credentials. I tried many solutions, but can't get to any solution. Is it even possible?
tagged with: spring
has answer: http://stackoverflow.com/a/25016727
downvote count: 0
score: 1
tagged with: java
type: Question
tagged with: spring-security
has title: How to change popup behaviour for login using Spring Security?
upvote count: 1

http://stackoverflow.com/comment/38863762
type: QuestionComment
has text: One line answer are not accepted :) Thank you anyway.
score: 0
comment on: http://stackoverflow.com/q/24995617
type: Comment

http://stackoverflow.com/q/25018095
has answer: http://stackoverflow.com/a/25018618
type: Question
has answer: http://stackoverflow.com/a/25018275
has answer: http://stackoverflow.com/a/25018285
has comment: http://stackoverflow.com/comment/38904561
answer count: 6
tagged with: number-formatting
has comment: http://stackoverflow.com/comment/38904560
has answer: http://stackoverflow.com/a/25018256
score: 0
has answer: http://stackoverflow.com/a/25018219
accepted answer: http://stackoverflow.com/a/25018219
has body: I have a number format exception when I try to compile my app. Here is the source of the error: EditText a = (EditText) findViewById(R.id.etPred_density); setPredDensity(Double.parseDouble(a.getText().toString())); The problem is with the second line. Here is the .xml file it is referring to in activity_main.xml: <EditText android:id="@+id/etPred_density" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginLeft="20dp" android:gravity="center_vertical|center_horizontal" android:hint="0.2" android:inputType="numberDecimal" /> Here is my manifest: <?xml version="1.0" encoding="utf-8"?> <uses-sdk android:minSdkVersion="11" android:targetSdkVersion="19" /> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> <action android:name="android.intent.action.Sequence" /> <category android:name="android.intent.category.LAUNCHER" /> <action android:name="android.intent.action.Rules" /> <category android:name="android.intent.category.LAUNCHER" /> The error log: FATAL EXCEPTION: main Process: bham.eco, PID: 2543 java.lang.IllegalStateException: Could not execute method of the activity at android.view.View$1.onClick(View.java:3823) at android.view.View.performClick(View.java:4438) at android.view.View$PerformClick.run(View.java:18422) at android.os.Handler.handleCallback(Handler.java:733) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:136) at android.app.ActivityThread.main(ActivityThread.java:5017) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:515) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595) at dalvik.system.NativeStart.main(Native Method) Caused by: java.lang.reflect.InvocationTargetException at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.inv…
has comment: http://stackoverflow.com/comment/38904603
has comment: http://stackoverflow.com/comment/38904518
has comment: http://stackoverflow.com/comment/38904699
possible better answer: http://stackoverflow.com/a/25018275
tagged with: exception
tagged with: android
has title: Number format exception in user input
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/38904661
has answer: http://stackoverflow.com/a/25018182

http://stackoverflow.com/q/25019789
type: Question
linked to: http://stackoverflow.com/q/9259411
tagged with: text-parsing
has comment: http://stackoverflow.com/comment/38945970
tagged with: newline
downvote count: 0
has title: Java parse contents of a string into lines, auto-detecting line type
has body: I have a string of around a hundred lines, it is unknown whether the lines will be "\r\n" or "\n". I want to parse the string once, processing each line. This question almost answers mine, but there's no mention of how to deal with unknown new line delimiting characters. I was thinking of using one of the above methods, choosing "\n" as the delimiter and then stripping any "\r" characters on a line-by-line basis. While performance really isn't an issue, I'd like to know if there is a cleaner way of doing this. I have not been able to find any methods that automatically handle line delimiter types. Attempt #1, as per suggestion from @TritonMan: Scanner scanner = new Scanner(myString); String line = scanner.nextLine(); // line contains whole contents of string, not just the first line If it matters, I am running this on Android. The string comes from a PLS file (playlist) which doesn't seem to be well defined anywhere, so I do not know what type of line delimiters it uses. As a fallback, I will use the code from this question, but it's now bugging me how to do it without regex or String.split() in case I deal with streams: String lines[] = String.split("\\r?\\n");
has comment: http://stackoverflow.com/comment/38907882
answer count: 1
has answer: http://stackoverflow.com/a/25021138
favorite count: 0
has comment: http://stackoverflow.com/comment/38939896
linked to: http://stackoverflow.com/q/1096621
has comment: http://stackoverflow.com/comment/38936068
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25021138
score: 1
tagged with: java
upvote count: 1

http://stackoverflow.com/a/25069083
has body: Here's a classic example that shows the kind of hard-to-debug problems the author is trying to avoid. The class UseDownloader is created and downloadSomething is called. As the download progresses, the onProgress method is called. Since this is called from within the synchronized block, the Downloader motinor is locked. Inside our onProgress method, we need to lock our own resource, in this case lock. So when we are trying to synchronize on lock we are holding the Downloader monitor. If another thread has decided that the download should be canceled, it will call setCanceled. This first tests done so it synchronized on the lock monitor and then calls removeListener. But removeListener requires the Downloader lock. This kind of deadlock can be hard to find because it doesn't happen very often. public static final int END_DOWNLOAD = 100; class UseDownloader implements ProgressListener { Downloader d; Object lock = new Object(); boolean done = false; public UseDownloader(Downloader d) { this.d = d; } public void onProgress(int n) { synchronized(lock) { if (!done) { // show some progress } } } public void downloadSomething() { d.addListener(this); d.start(); } public boolean setCanceled() { synchronized(lock) { if (!done) { done = true; d.removeListener(this); } } } }
score: 0
answers question: http://stackoverflow.com/q/25050574
type: Answer

http://stackoverflow.com/comment/38865150
score: 0
type: Comment
type: QuestionComment
has text: I saw [this LineReader class](http://www.java2s.com/Code/Java/File-Input-Output/Alinereadingwrapperthatworkswithbytestreams.htm) when I was scavenging around.
comment on: http://stackoverflow.com/q/24996050

http://stackoverflow.com/comment/39056941
comment on: http://stackoverflow.com/a/25043310
type: Comment
has text: See the edited answer, I added the link for the `jar` file and where to get `orange` and `apple`.
score: 0
type: AnswerComment

http://stackoverflow.com/a/24984974
upvote count: 8
has comment: http://stackoverflow.com/comment/38842403
accepted answer of: http://stackoverflow.com/q/24981736
has body: I think that the wording in §14.18 The throw Statement, that you refer to, is a mistake in the JLS &mdash; text that should have been updated with Java SE 7, and was not. The bit of JLS text that describes the intended behavior is in §11.2.2 Exception Analysis of Statements: A throw statement whose thrown expression is a final or effectively final exception parameter of a catch clause C can throw an exception class E iff: E is an exception class that the try block of the try statement which declares C can throw; and E is assignment compatible with any of C's catchable exception classes; and E is not assignment compatible with any of the catchable exception classes of the catch clauses declared to the left of C in the same try statement. The first bullet point is the relevant one; because the catch-clause parameter t is effectively final (meaning that it's never assigned to or incremented or decremented; see §4.12.4 final Variables), throw t can only throw something that the try block could throw. But as you say, the compile-time checking in §14.18 does not make any allowance for this. §11.2.2 does not decide what's allowed and what's not; rather, it's supposed to be an analysis of the consequences of the various restrictions on what can be thrown. (This analysis does feed back into more-normative parts of the spec &mdash; §14.18 itself uses it in its second bullet point &mdash; but §14.18 can't just say "it's a compile-time error if it throws an exception it can't throw per §11.2.2", because that would be circular.) So I think §14.18 needs to be adjusted to accommodate the intent of §11.2.2. Good find!
answers question: http://stackoverflow.com/q/24981736
has comment: http://stackoverflow.com/comment/38842367
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38842202
score: 8
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/38842163

http://stackoverflow.com/q/24930062
tagged with: android-library
tagged with: android
has comment: http://stackoverflow.com/comment/38739863
type: AnsweredQuestion
score: 1
has answer: http://stackoverflow.com/a/24931375
accepted answer: http://stackoverflow.com/a/24931375
type: Question
linked to: http://stackoverflow.com/q/2471935
tagged with: java
tagged with: eclipse
upvote count: 2
downvote count: 1
answer count: 1
tagged with: jar
has title: How to display an image with use of jar file in Android?
favorite count: 0
has comment: http://stackoverflow.com/comment/38738772
has body: I am new for Android. I want to create an jar file if i call a method of that jar file in another android application it will show an image in imageview of the application. For example a method in jar file as DisplayImg(URL); i will use this jar as library in another application and here i will create an imageview ImageView imageView; imageView = (ImageView) findViewById(R.id.img); Then if i call imageView.DisplayImg(URL); then it will display specified url image on the imageview. I spend lot more time to get the solution but not work.plz help with the code thank

http://stackoverflow.com/q/25048744
has comment: http://stackoverflow.com/comment/38968119
type: UnansweredQuestion
has body: I have a very complicated query that doesn't convert to HQL, so I must use SQL. I put my query into a NamedNativeQuery annotation. It "should" return a list of two values (List&lt;Object[2]&gt;). When I try to run, the session fails to load the query because I haven't defined a mapping or result class. I cannot create a simple class to map these values to because the annotations have to go in a specific DAO project and the code that is using the queries exists in its own project. (The DAO project is more general-purpose and the entities in that project map directly to tables in our database. I cannot just create a small class in this project to map to my query result because it wouldn't fit the schema of this project) Is there a way for me to map the query results to a more generic class, or even better is there some way for me to just get a List&lt;Object[]&gt; back without having to map at all to anything particular? This is extremely frustrating that Hibernate has to work in this particular way when all I want to do is execute a query and get the result back as an array.
has answer: http://stackoverflow.com/a/25069028
has comment: http://stackoverflow.com/comment/38962781
score: 3
has title: Hibernate - How to execute named native query without mapping to a specific class
has answer: http://stackoverflow.com/a/25049113
upvote count: 3
tagged with: java
tagged with: hibernate
type: Question
has answer: http://stackoverflow.com/a/25049027
answer count: 3
tagged with: sql
downvote count: 0
favorite count: 0

event-handling
tag name: event-handling
tags question: http://stackoverflow.com/q/25043521
type: Tag
tags question: http://stackoverflow.com/q/24944928
tags question: http://stackoverflow.com/q/25053014

webserver
tags question: http://stackoverflow.com/q/25068097
tag name: webserver
type: Tag

http://stackoverflow.com/a/25060078
has comment: http://stackoverflow.com/comment/39007432
has comment: http://stackoverflow.com/comment/39007969
upvote count: 1
accepted answer of: http://stackoverflow.com/q/25059689
answers question: http://stackoverflow.com/q/25059689
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/39011089
has body: Depending on your needs you could even use a macro; You should even be able to use regex like this: "^13{2,}", but that didn't work for me in Word 2010, see http://social.msdn.microsoft.com/Forums/en-US/0d921f97-b59a-48a9-a01a-20fe72f21c19/how-to-remove-blank-lines-?forum=worddev Sub RemoveBlankLines() Selection.Find.ClearFormatting Selection.Find.Replacement.ClearFormatting With Selection.Find .Text = "^p^p" .Replacement.Text = "^p" .MatchWildcards = False End With Selection.Find.Execute Replace:=wdReplaceAll End Sub Sub RemoveEnters() Selection.Find.ClearFormatting Selection.Find.Replacement.ClearFormatting With Selection.Find '^11 or ^l New line .Text = "^l" .Replacement.Text = "" End With Selection.Find.Execute Replace:=wdReplaceAll With Selection.Find '^13 or ^p Carriage return/paragraph mark .Text = "^p" .Replacement.Text = "" End With Selection.Find.Execute Replace:=wdReplaceAll End Sub
score: 1

http://stackoverflow.com/comment/39132982
has text: have you tried setting negative top margin/padding on your child's layout?
type: QuestionComment
comment on: http://stackoverflow.com/q/24955173
type: Comment
score: 0

http://stackoverflow.com/q/24965848
type: Question
tagged with: debugging
answer count: 2
score: 5
upvote count: 5
downvote count: 0
has comment: http://stackoverflow.com/comment/38806218
has answer: http://stackoverflow.com/a/25001326
has body: A common problem I face when debugging recursive methods is that I can't avoid getting trapped into going deeper and deeper into the stack when I want to debug a given piece of code. The only way to avoid getting trapped is to manually disable the BP and then set up it again after the block of code I'm interested in has been passed. In the above picture, I just want to do a little stroll over the loop's variables for each iteration, seeing if they're behaving as they should and if all's fine and dandy, but I'm currently only getting the first iteration of each call to combinations! Any clever ideas to get around this?
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24965923
has comment: http://stackoverflow.com/comment/38806245
tagged with: java
has title: Debugging recursive methods in Eclipse -- any clever way to avoid getting trapped into ever more nested calls?
tagged with: eclipse

tomcat
tags question: http://stackoverflow.com/q/25058024
tags question: http://stackoverflow.com/q/24943197
tags question: http://stackoverflow.com/q/24929207
tags question: http://stackoverflow.com/q/25027714
tags question: http://stackoverflow.com/q/24933710
tags question: http://stackoverflow.com/q/25038550
tags question: http://stackoverflow.com/q/25006597
tags question: http://stackoverflow.com/q/24937613
tags question: http://stackoverflow.com/q/25021285
tags question: http://stackoverflow.com/q/25000434
tags question: http://stackoverflow.com/q/24929175
tags question: http://stackoverflow.com/q/24950775
tags question: http://stackoverflow.com/q/24968305
tags question: http://stackoverflow.com/q/25024721
tags question: http://stackoverflow.com/q/24993446
tags question: http://stackoverflow.com/q/25048431
tags question: http://stackoverflow.com/q/25018991
tags question: http://stackoverflow.com/q/24970033
tags question: http://stackoverflow.com/q/24936521
tags question: http://stackoverflow.com/q/24989925
tags question: http://stackoverflow.com/q/24990515
tags question: http://stackoverflow.com/q/25020079
tags question: http://stackoverflow.com/q/24925367
tags question: http://stackoverflow.com/q/25024663
tags question: http://stackoverflow.com/q/25062176
tags question: http://stackoverflow.com/q/24990105
tags question: http://stackoverflow.com/q/24968641
tags question: http://stackoverflow.com/q/24937494
tags question: http://stackoverflow.com/q/24984841
tags question: http://stackoverflow.com/q/24931537
tags question: http://stackoverflow.com/q/25022095
tags question: http://stackoverflow.com/q/24968990
tag name: tomcat
tags question: http://stackoverflow.com/q/24923002
tags question: http://stackoverflow.com/q/25000414
tags question: http://stackoverflow.com/q/24943304
tags question: http://stackoverflow.com/q/25010454
tags question: http://stackoverflow.com/q/24984728
tags question: http://stackoverflow.com/q/24958199
tags question: http://stackoverflow.com/q/24911183
tags question: http://stackoverflow.com/q/24925139
tags question: http://stackoverflow.com/q/25002293
tags question: http://stackoverflow.com/q/25057510
tags question: http://stackoverflow.com/q/24965090
tags question: http://stackoverflow.com/q/25042763
tags question: http://stackoverflow.com/q/24968548
tags question: http://stackoverflow.com/q/25021777
tags question: http://stackoverflow.com/q/25048038
tags question: http://stackoverflow.com/q/25065572
tags question: http://stackoverflow.com/q/25063894
tags question: http://stackoverflow.com/q/24914340
tags question: http://stackoverflow.com/q/25010620
type: Tag
tags question: http://stackoverflow.com/q/24935889
tags question: http://stackoverflow.com/q/24999791
tags question: http://stackoverflow.com/q/24974796
tags question: http://stackoverflow.com/q/24975944
tags question: http://stackoverflow.com/q/24963117
tags question: http://stackoverflow.com/q/24998849
tags question: http://stackoverflow.com/q/25000506
tags question: http://stackoverflow.com/q/24993956
tags question: http://stackoverflow.com/q/24998026
tags question: http://stackoverflow.com/q/24913111
tags question: http://stackoverflow.com/q/25047075
tags question: http://stackoverflow.com/q/24983931
tags question: http://stackoverflow.com/q/24925146
tags question: http://stackoverflow.com/q/24996702
tags question: http://stackoverflow.com/q/24981592
tags question: http://stackoverflow.com/q/25032597
tags question: http://stackoverflow.com/q/24915333

http://stackoverflow.com/comment/38900902
type: Comment
comment on: http://stackoverflow.com/a/25012442
has text: You can see my answer for the solution i didn't want to choose.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/38776112
has text: Consider summarizing what's in the link.
type: AnswerComment
type: Comment
score: 8
comment on: http://stackoverflow.com/a/24949609

http://stackoverflow.com/q/24974388
score: 1
has comment: http://stackoverflow.com/comment/38822217
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/38822286
accepted answer: http://stackoverflow.com/a/24974456
has comment: http://stackoverflow.com/comment/38822299
tagged with: java
has body: So I'm trying to create an XML File in my C:\ directory and every time I launch the program, it says Access Is Denied. The following is my code: public void buildXML(){ try { DocumentBuilderFactory xmlFac = DocumentBuilderFactory.newInstance(); DocumentBuilder doc = xmlFac.newDocumentBuilder(); Document settings = doc.newDocument(); Element rootElement = settings.createElement("AppSettings"); rootElement.appendChild(settings.createElement("FAK0")); TransformerFactory transform = TransformerFactory.newInstance(); Transformer former = transform.newTransformer(); DOMSource src = new DOMSource(settings); StreamResult res = new StreamResult(new File("C:\\file.xml")); former.transform(src, res); }catch(Exception e){ System.out.println(e+""); } } And here is the output on the console: javax.xml.transform.TransformerException: java.io.FileNotFoundException: C:\file.xml (Access is denied) Is it because I have no administrator access or what? If it is then that would be very unsettling.
upvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/38822260
has comment: http://stackoverflow.com/comment/38822278
has title: Java: file write error, access is denied
has answer: http://stackoverflow.com/a/24974456
type: AnsweredQuestion
downvote count: 0

http://stackoverflow.com/q/24977933
has comment: http://stackoverflow.com/comment/38828798
has comment: http://stackoverflow.com/comment/38828984
has body: I'm trying to learn java and of course I'm a beginner. I am facing problem with initializing a multidimensional array. Here is the code I'm trying to write... import java.util.Scanner; public class one { public static void main(String args[]) { int p[][] = null; System.out.println("Type ur array here:"); System.out.println("how many rows and column:"); int row, colmn; Scanner u = new Scanner(System.in); Scanner y = new Scanner(System.in); Scanner t = new Scanner(System.in); Scanner r = new Scanner(System.in); row = t.nextInt(); colmn = r.nextInt(); for(int i = 0; i &lt;= row; i++) for(int v = 0; v &lt;= colmn; v++){ int j = u.nextInt(); p[row][colmn] = j; } int a[][] = p; System.out.println("The given array:"); y(a); } public static void y(int n[][]) { for(int i=0;i&lt;n.length;i++) { for(int j=0;j&lt;n[i].length;j++){ System.out.print(n[i][j]); } System.out.println(); } } } Please someone correct this and provide me with sufficient knowledge I need.
accepted answer: http://stackoverflow.com/a/24978068
has comment: http://stackoverflow.com/comment/38828949
favorite count: 0
has title: Having trouble with multidimensional array initialization
has comment: http://stackoverflow.com/comment/38829000
has comment: http://stackoverflow.com/comment/38828911
has comment: http://stackoverflow.com/comment/38828807
score: -4
has comment: http://stackoverflow.com/comment/38828928
upvote count: 1
has comment: http://stackoverflow.com/comment/38828782
has answer: http://stackoverflow.com/a/24978068
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38829041
has comment: http://stackoverflow.com/comment/38829039
tagged with: java
downvote count: 5
has comment: http://stackoverflow.com/comment/38828805
type: Question
has comment: http://stackoverflow.com/comment/38828874
answer count: 1

http://stackoverflow.com/comment/41713945
type: QuestionComment
has text: Each operation is not 1 quota unit. Eg retrieving an email costs 5, creating a draft costs 10, deleting a thread costs 20. See https://developers.google.com/gmail/api/v1/reference/quota
comment on: http://stackoverflow.com/q/24983679
score: 0
type: Comment

http://stackoverflow.com/q/25049698
has title: Skip reading a file if it just has headers and continue reading rest of the files with headers + data, with a MultiResourceItemReader?
tagged with: spring-batch
score: 0
answer count: 2
has body: Is it possible to skip reading a file if it just has headers and continue reading rest of the files with headers + data, with a MultiResourceItemReader? I have multiple files to be read and following is my configuration. With my configuration in SingleFileReader, I am skipping the headers, but not the files with headers, and I am getting a FlatFileParseException at line: 2 with input=[] as there is no data to be read. The code works fine if there are any number of files with headers and data.
has comment: http://stackoverflow.com/comment/38966661
tagged with: filereader
tagged with: spring
has answer: http://stackoverflow.com/a/25053012
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/25050402
type: Question
possible better answer: http://stackoverflow.com/a/25050402
accepted answer: http://stackoverflow.com/a/25053012

http://stackoverflow.com/q/24955886
type: Question
linked to: http://stackoverflow.com/q/3367843
answer count: 2
has comment: http://stackoverflow.com/comment/38792116
has comment: http://stackoverflow.com/comment/39041746
downvote count: 1
favorite count: 0
linked to: http://stackoverflow.com/q/1279110
tagged with: regex
has answer: http://stackoverflow.com/a/24957632
upvote count: 0
has answer: http://stackoverflow.com/a/25028265
has title: How can I add a space to the end and beginning of punctuation mark without messing numbers notations?
type: UnansweredQuestion
has body: I have a string formatting questions which I think would be best to do with Regular Expressions. Therefore I was hoping I could get advice and help on putting together the set of regex and in which order so one would not cancel or override the other. Here are the requirements: 1) I need to add only one blank space before and after punctuation signs such as ., ,, ;, :, !, ?, -, _, .... So that the following sentence "Instructions: Pay-attention! Will you? Except with respect to the information specifically incorporated by reference in this Form 10-K, the registrant's definitive proxy statement is not deemed to be filed as a part of this Form 10-K." Will be: "Pay - attention ! Will you ? Except with respect to the information specifically incorporated by reference in this Form 10 - K , the registrant's definitive proxy statement is not deemed to be filed as a part of this Form 10 - K ." 2) However, I want to preserve numbers and dollar signs as they are so for instance the number: 1,000.00 has to be 1,000.00 or if it is notated as 1.000,00 has to maintain the same without adding spaces. Same goes to $1,000.00 which ought to be the same, so $1,000.00. What is the easiest way to preserve numbers while making sure that the following punctuation marks ., ,, ;, :, !, ?, -, _, ... get a space before and after? 3) On top of that, the third requirement is to make sure that if you have more than 3 dots so ..... they have to be reduced to ... but if you have 2 dots .. it has to be reduced to just one dot ..
has comment: http://stackoverflow.com/comment/38788459
tagged with: java
score: -1
linked to: http://stackoverflow.com/q/17098834

http://stackoverflow.com/q/24972903
has answer: http://stackoverflow.com/a/25090199
upvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/38820583
favorite count: 0
score: -1
type: UnansweredQuestion
tagged with: textures
tagged with: opengl
tagged with: java
tagged with: lwjgl
downvote count: 1
has comment: http://stackoverflow.com/comment/38820919
tagged with: opacity
type: Question
has body: I am trying to map a texture onto a quad that is programmed to fade in and fade out. The code runs without errors but the textures won't load. All I get is a quad that is white. I am new to Java and OpenGL and don't quite understand why it won't work. I have tried altering it in many ways yet still can't figure out what is wrong. Please help, the source is: package smooth_transitions; import static org.lwjgl.opengl.GL11.*; import org.lwjgl.opengl.*; import org.lwjgl.*; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import org.lwjgl.LWJGLException; import org.lwjgl.input.Keyboard; import org.lwjgl.input.Mouse; import org.lwjgl.opengl.Display; import org.lwjgl.opengl.DisplayMode; import org.newdawn.slick.opengl.Texture; import org.newdawn.slick.opengl.TextureLoader; public class SmoothTransitions { private static enum State{ STUDIO, INTRO, FADING, MAIN; } private State state = State.INTRO; private Texture background; private Texture menu; private Texture intro; public static final int WIDTH = 640; public static final int HEIGHT = 480; public SmoothTransitions(){ try{ Display.setDisplayMode(new DisplayMode(640,480)); Display.setTitle("Hello, LWJGL!"); Display.setVSyncEnabled(true); Display.create(); } catch (LWJGLException e){ System.err.println("Creation of the display failed."); e.printStackTrace(); System.exit(1); } try { Texture texture = TextureLoader.getTexture("PNG", new FileInputStream(new File("res/football.png"))); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } //Initialisation code OpenGL glMatrixMode(GL_PROJECTION); //Just do it lol glLoadIdentity(); glOrtho(0, 640, 480, 0, 1, -1); //This time it sets the origin to the upper-right whilst -1,-1 is bottom left glMatrixMode(GL_MODELVIEW); glEnable(GL_BLEND); //Enables trancluency glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); float fade = 0f; //Amount of fade. while (!Display.i…
has title: How do you change the opacity of a texture in OpenGL that is bound onto a quadrilateral?

http://stackoverflow.com/comment/39046736
type: Comment
has text: Are your sure you have instances of your Patient Agent in your Main? Otherwise it won't work.
comment on: http://stackoverflow.com/a/25078183
score: 0
type: AnswerComment

http://stackoverflow.com/comment/38777892
comment on: http://stackoverflow.com/q/24950613
has text: post the log files also so that it become's easier to understand the problem
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24996085
has comment: http://stackoverflow.com/comment/38863040
answer count: 0
has comment: http://stackoverflow.com/comment/38863202
type: UnansweredQuestion
type: Question
has body: Is there any method returns the height of any text drawn on the canvas?
tagged with: java
tagged with: ondraw
tagged with: android-canvas
has comment: http://stackoverflow.com/comment/38862746
score: 0
has title: How to measure the text height when it is drawn on a canvas?
tagged with: android

http://stackoverflow.com/comment/38841705
type: Comment
type: QuestionComment
has text: @ChrisHayes: Even with if(false) Java will not throw error/exception, only eclipse shows a warning. Why it isn't the same with if(true)?
comment on: http://stackoverflow.com/q/24984769
score: 0

http://stackoverflow.com/q/25000003
has comment: http://stackoverflow.com/comment/38870458
answer count: 2
tagged with: android
has answer: http://stackoverflow.com/a/25000124
has comment: http://stackoverflow.com/comment/38870223
has comment: http://stackoverflow.com/comment/38870175
has comment: http://stackoverflow.com/comment/38870379
has comment: http://stackoverflow.com/comment/38870299
tagged with: java
has comment: http://stackoverflow.com/comment/38870509
downvote count: 1
has comment: http://stackoverflow.com/comment/38870589
upvote count: 0
type: UnansweredQuestion
has body: i made another linear layout beside the first one by your help, but now after trying to add a new button in the left the button is not appearing even though i made wrap_content as i learned but still it's not appearing while the buttons in the first linearlayout are working perfectly i hope you can help and thanks this is the main.xml &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:gravity="right" android:orientation="vertical" &gt; &lt;TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="اضغط على من تريد معرفة المزيد عنه" android:padding="10dp" /&gt; &lt;Button android:id="@+id/buttontype1" android:layout_width="120dp" android:layout_height="wrap_content" android:text="Start" /&gt; &lt;Button android:id="@+id/button1" android:layout_width="120dp" android:layout_height="wrap_content" android:text="Start" /&gt; &lt;Button android:id="@+id/button2" android:layout_width="120dp" android:layout_height="wrap_content" android:text="Stop"/&gt; &lt;Button android:id="@+id/button3" android:layout_width="120dp" android:layout_height="wrap_content" android:text="Start" /&gt; &lt;Button android:id="@+id/button4" android:layout_width="120dp" android:layout_height="wrap_content" android:layout_gravity="right" android:text="Stop" /&gt; &lt;Button android:id="@+id/button5" android:layout_width="120dp" android:layout_height="wrap_content" android:text="Start" /&gt; &lt;Button android:id="@+id/button6" android:layout_width="120dp" android:layout_height="wrap_content" android:text="Stop"/&gt; &lt;Button android:id="@+id/button7" android:layout_width="120dp" android:layout_height="wrap_content" android:text="Start" /&gt; &lt;Button android:id="@+id/button8" android:layout_width="120dp" android:layout_height="wrap_content" android:text="Stop"/&gt; &lt;LinearLayout android:layout_width="wrap_conten…
has title: Another linear layout with a button not appearing
score: -1
favorite count: 0
has comment: http://stackoverflow.com/comment/38870330
has comment: http://stackoverflow.com/comment/38870421
has answer: http://stackoverflow.com/a/25000228
type: Question

http://stackoverflow.com/q/25035543
tagged with: windows
upvote count: 2
has comment: http://stackoverflow.com/comment/105830347
tagged with: performancecounter
tagged with: java
answer count: 1
downvote count: 1
has body: I'm looking for a way to get performance counters from Windows Performance monitor in Java program. I know it's pretty easy to get this counters in .NET or PowerShell. Who knows is it possible in Java?
type: UnansweredQuestion
has title: Windows performance counters from java
score: 1
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25035812

http://stackoverflow.com/comment/50187189
type: QuestionComment
has text: it is 2105 use a modern args parser like [JewelCLI](http://jewelcli.lexicalscope.com/) or at least [JSAP](http://www.martiansoftware.com/jsap/) that apache commons crap is just that crap always has been and just gets crappier with time.
comment on: http://stackoverflow.com/q/24931839
score: 0
type: Comment

http://stackoverflow.com/q/24921687
has comment: http://stackoverflow.com/comment/38723847
tagged with: arraylist
has answer: http://stackoverflow.com/a/24921828
tagged with: android
has comment: http://stackoverflow.com/comment/38723646
favorite count: 0
has answer: http://stackoverflow.com/a/24922143
type: UnansweredQuestion
has title: ArrayList loop performance in ART (Android Runtime Environment)
has body: I have read the performance tips here: http://developer.android.com/training/articles/perf-tips.html#Loops and at the time it looks like for(i=0; i &lt;= objectArrayList.size() ; ++i){} loops are preferred for performance reasons to "for each" or "enhanced" style loops for(Object object : objectArrayList){} Does this still hold true for ART or will that change things? Just wondering.
has comment: http://stackoverflow.com/comment/38723593
tagged with: performance
has comment: http://stackoverflow.com/comment/38724006
tagged with: java
linked to: http://stackoverflow.com/q/16274852
type: Question
upvote count: 4
answer count: 2
downvote count: 0
score: 4

http://stackoverflow.com/a/24987071
has comment: http://stackoverflow.com/comment/38855443
accepted answer of: http://stackoverflow.com/q/24986962
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/24986962
has comment: http://stackoverflow.com/comment/38846293
upvote count: 8
type: Answer
score: 8
has comment: http://stackoverflow.com/comment/38846230
has comment: http://stackoverflow.com/comment/38846695
has body: It's completely depend on you, But in my opinion, You should not compare Rails and Django with Node.js. It's better to compare Node.js with Ruby or Python and compare Rails and Django with Node.js based full stack frameworks like Geddy, Sails.js or Total.js. I have about 3-4 years experience of working with these frameworks and I can simply say that while Django and Rails speed up your development process, Node.js based frameworks are more flexible and most of the time give you better performance, But I It's better for you to learn the real procedure of web development instead of sticking to an specific framework. When you learn how to develop the web, You can easily switch between frameworks and In real world you can't say that one framework is better than another one, You should choose your framework based on the project needs. The bottom line: You can read these nice articles and comparisons: Why we moved from NodeJS to Ruby on Rails Which should I learn? Python vs Django Ruby on Rails vs. Node.js at LinkedIn - InfoQ

http://stackoverflow.com/comment/38727795
has text: Store the info somewhere and have the other class retrieve it later on. [Android Storage Options](http://developer.android.com/guide/topics/data/data-storage.html)
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24924090

http://stackoverflow.com/q/24957006
has answer: http://stackoverflow.com/a/24957140
possible better answer: http://stackoverflow.com/a/24957206
has title: Why Eclipse deletes a reference to the function?
accepted answer: http://stackoverflow.com/a/24957140
duplicate of: http://stackoverflow.com/q/24820325
tagged with: methods
type: Question
type: AnsweredQuestion
tagged with: java
tagged with: eclipse
linked to: http://stackoverflow.com/q/24820325
has answer: http://stackoverflow.com/a/24957206
has body: I tried to call the method .getHours() and Eclipse marks the name of a function with a line. Why is this happening?
has comment: http://stackoverflow.com/comment/38789170
score: 0
answer count: 2

http://stackoverflow.com/comment/38913785
score: 0
type: Comment
type: QuestionComment
has text: You may find [File.toPath()](http://docs.oracle.com/javase/8/docs/api/java/io/File.html#toPath--) and [Path.startsWith](http://docs.oracle.com/javase/8/docs/api/java/nio/file/Path.html#startsWith-java.nio.file.Path-) useful. java.io.File has been obsolete since 2011, like Vector and Hashtable; like them, it is still needed for legacy APIs but shouldn't be used unless necessary.
comment on: http://stackoverflow.com/q/25022006

http://stackoverflow.com/q/24910171
upvote count: 9
tagged with: java-native-interface
tagged with: java
has answer: http://stackoverflow.com/a/24923279
accepted answer: http://stackoverflow.com/a/24923279
type: Question
has title: Keeping java methods called from Android JNI
score: 9
answer count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/38710287
tagged with: android
has comment: http://stackoverflow.com/comment/38711859
tagged with: proguard
has body: I'm trying to obfuscate an Android app code via Proguard. After processing with proguard the app is working by itself, however native calls made from c to java are failing with java.lang.NoSuchMethodError. This code is from the native part, where a call is made to the java class instance, named EngineStarted: void callEngineStarted( JNIEnv* env, bool isStreamOne ) { jclass cls; if(isStreamOne == true) { cls = ( *env )-&gt;GetObjectClass( env, currentObjectOne ); } else { cls = ( *env )-&gt;GetObjectClass( env, currentObjectTwo ); } jmethodID midCallBack = ( *env )-&gt;GetMethodID( env, cls, "EngineStarted", "(I)V" ); if (0 == midCallBack) { LOGW("Could not find EngineStarted method in class"); return; } if(isStreamOne == true) { ( *env )-&gt;CallVoidMethod( env, currentObjectOne, midCallBack, 1 ); } else { ( *env )-&gt;CallVoidMethod( env, currentObjectTwo, midCallBack, 0 ); } } The java has this method. It is only called from the native part, and not anywhere else. Because of that, proguard is removing the method. public void EngineStarted ( int isStreamOne ) { Log.v( "decoderService", "PDecoder - Engine started, using stream " + ( isStreamOne == 1 ? "one" : "two" ) ); this.isStreamOne = isStreamOne == 1; // Initialize the player InitializePlayer( isStreamOne ); } I've tried adding this to proguard-project.txt, but did not solve the problem. -keep class com.emrahgunduz.AppBase.Services.PlayService.players.pDecoders.PDecoderNative { void EngineStarted( int ); void PositionChanged( int ); void SetDuration( int ); void Completed(); void CompletedWithFade(); void Spectrum ( *** ); } After compiling, mapping.txt does not include the methods, I suspect proguard removes them. How can I keep these methods getting removed and/or renamed? EDIT / SOLUTION: I was able to solve the problem by changing full location with a wildcard. This saved some of the methods but was not enough. Don't know why but one other method (void InitializePlayer(int)) that was called by the dumped on…
tagged with: android-ndk
type: AnsweredQuestion

http://stackoverflow.com/comment/38928553
comment on: http://stackoverflow.com/a/25030786
has text: according to his code `java.sql.Timestamp updatedAt = new java.sql.Timestamp(now.getTime()); stmt.setTimestamp(2, updatedAt);` he already does
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/38840699
type: QuestionComment
comment on: http://stackoverflow.com/q/24984144
has text: Try checking this post: http://stackoverflow.com/questions/24440297/how-to-update-jenkins-config-xml-from-java-code
score: 0
type: Comment

http://stackoverflow.com/comment/38862439
comment on: http://stackoverflow.com/q/24994216
score: 1
type: QuestionComment
type: Comment
has text: java version "1.7.0_45" Java(TM) SE Runtime Environment (build 1.7.0_45-b18) Java HotSpot(TM) 64-Bit Server VM (build 24.45-b08, mixed mode) -- but once I added the javaagent configuration, it ran well.

http://stackoverflow.com/q/25006815
type: UnansweredQuestion
tagged with: css
has body: I have Java object get passed via servlet, for each element in that has map I generate a div. Example: &lt;c:forEach items="${myObject}" var="aRec" varStatus="mapLoop"&gt; &lt;div class="row borderRecords"&gt; I want to change the background color of the div based on a value in that object example: myObject.isSuccess I want to color the div. What is the best way to do this.
has answer: http://stackoverflow.com/a/25006873
downvote count: 0
score: 1
tagged with: java
type: Question
answer count: 2
has title: change a div background based on variable passed to jsp
tagged with: jsp
upvote count: 1
tagged with: http://stackoverflow.com/tag/html
has answer: http://stackoverflow.com/a/25006889
favorite count: 0

http://stackoverflow.com/a/24936869
has body: Keep it as Object. Try import com.google.gson.Gson; class User { private Object group; private String name; public Object getGroup() { return group; } public void setGroup(Object group) { this.group = group; } public String getName() { return name; } public void setName(String name) { this.name = name; } @Override public String toString() { return "User [group=" + group + ", name=" + name + "]"; } } public class Sample { public static void main(String[] args) throws Exception { String json1 = "{ id: \"5382f2949a24ed95b44dc04f\", \"name\": \"jack\", \"group\": \"5382f2949a24ed95b44dc04d\" }"; String json2 = "{ id: \"5382f2949a24ed95b44dc04f\", \"name\": \"jack\", \"group\": { \"id\": \"5382f2949a24ed95b44dc04d\", \"name\": \"g1\" } }"; Gson gson = new Gson(); System.out.println(gson.fromJson(json1, User.class)); // Prints - User [group=5382f2949a24ed95b44dc04d, name=jack] System.out.println(gson.fromJson(json2, User.class)); // Prints - User [group={id=5382f2949a24ed95b44dc04d, name=g1}, name=jack] } }
answers question: http://stackoverflow.com/q/24936567
score: 0
type: Answer

http://stackoverflow.com/comment/38982728
has text: Ah, a further update, it appears it doesn't need to be the JToolTip returned by Component.createToolTip, simply creating a JToolTop and calling setTipText works fine.
type: AnswerComment
comment on: http://stackoverflow.com/a/25046353
score: 0
type: Comment

http://stackoverflow.com/comment/38735241
type: Comment
has text: okay..how can i add the values dynamically usig shiftRows() method..Please help
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24927546

http://stackoverflow.com/q/24987944
has title: Appengine: SocketException: Cannot assign requested address on socket.connect
answer count: 1
favorite count: 0
type: UnansweredQuestion
tagged with: google-app-engine
tagged with: sockets
upvote count: 1
has body: I am using java.net.Socket.connect() to connect to an FTP server in passive mode on AppEngine. It works around 30% of the time, but I usually get the following error: java.net.SocketException: System error: errno: 99, detail:Cannot assign requested address It sounds as though the host simply doesn't have any available ports for outgoing connections (I am not requesting a specific port.) I get the same result when I use new java.net.Socket() I would appreciate any thoughts as to what might be happening.
score: 1
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/25008654
downvote count: 0

http://stackoverflow.com/a/48783972
score: 17
has body: @Override protected void configure(HttpSecurity http) throws Exception { // ... .antMatchers(HttpMethod.GET, "/**").permitAll .antMatchers(HttpMethod.POST, "/*").permitAll // ... } In this configuration any "Get" request will be permitted, for example: /book /book/20 /book/20/author So, all this urls match text with pattern "/**". Permitted urls for "Post": /book /magazine Urls above match with "/*"
type: Answer
upvote count: 17
answers question: http://stackoverflow.com/q/24948651
downvote count: 0

http://stackoverflow.com/comment/38832820
type: QuestionComment
has text: @MadProgrammer Didn't see it was for NetBeans. Do you know of any alternatives for Eclipse?
score: 0
comment on: http://stackoverflow.com/q/24978212
type: Comment

http://stackoverflow.com/comment/38838740
type: QuestionComment
comment on: http://stackoverflow.com/q/24983097
score: 0
has text: Instead of having `Slot1`...`Slot5` make a `Texture[]` for them.
type: Comment

http://stackoverflow.com/comment/38985250
has text: Didnt remember so put it in. No args will never be null
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25060882

http://stackoverflow.com/a/25056768
answers question: http://stackoverflow.com/q/24954234
score: 0
has body: It turned out that the somehow overlooked at first websocket4net library works well and is easy to use, so using that library is the answer to my question.
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/24954234

http://stackoverflow.com/q/24927623
type: AnsweredQuestion
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/38739581
tagged with: java
tagged with: bufferedinputstream
accepted answer: http://stackoverflow.com/a/24933497
has comment: http://stackoverflow.com/comment/38745967
has comment: http://stackoverflow.com/comment/38740508
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/38745837
has body: My JavaWS application will run in an intern network and so it is signed with the company's own certificate and also the SSL certificate is from the company's root CA. So because of the huge amount of computers its unlikely to import the certificates on each comupter manually. So I extended my app with a class which should automatically import the certificates, this works from the console and the IDE but not if the application is executed by java web start :( Code cf = CertificateFactory.getInstance("X.509"); signCertIn = ClassLoader.class.getResourceAsStream((pack + signCertName + ".cer")); sslCertIn = ClassLoader.class.getResourceAsStream((pack + sslCertName) + ".crt"); File file = new File(new File(System.getProperty("java.home") + SEP + "lib" + SEP + "security"), "cacerts"); javaCertIn = new FileInputStream(file); KeyStore keystore = KeyStore.getInstance(KeyStore.getDefaultType()); keystore.load(javaCertIn, passphrase); javaCertIn.close(); if (!keystore.containsAlias(signCertName)) { bis = new BufferedInputStream(signCertIn); // &lt;&lt;&lt;&lt;&lt;&lt;&lt; Exception thrown here while (bis.available() &gt; 0) { Certificate cert = cf.generateCertificate(bis); keystore.setCertificateEntry(signCertName, cert); } save = true; signCertIn.close(); } if (!keystore.containsAlias(sslCertName)) { bis = new BufferedInputStream(sslCertIn); while (bis.available() &gt; 0) { Certificate cert = cf.generateCertificate(bis); keystore.setCertificateEntry(sslCertName, cert); } save = true; sslCertIn.close(); } if (save) { OutputStream out = new FileOutputStream(file); keystore.store(out, passphrase); out.close(); } JavaWS console output java.io.IOException: Stream closed at java.io.BufferedInputStream.getInIfOpen(Unknown Source) at java.io.BufferedInputStream.available(Unknown Source) at at.sviss.util.cert.Certificates.install(Certificates.java:48) at at.sviss.Main.main(Main.java:91) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorIm…
has answer: http://stackoverflow.com/a/24933497
has answer: http://stackoverflow.com/a/24933994
tagged with: security
has title: BufferedInputStream won't work after KeyStore.load()
upvote count: 1
favorite count: 0
tagged with: classloader
possible better answer: http://stackoverflow.com/a/24933994

http://stackoverflow.com/q/25010454
tagged with: jdbc
has title: Error while starting Apache tomcat server
favorite count: 0
accepted answer: http://stackoverflow.com/a/25022870
type: Question
upvote count: 2
answer count: 1
tagged with: spring-mvc
tagged with: java
tagged with: mysql
has answer: http://stackoverflow.com/a/25022870
downvote count: 0
tagged with: tomcat
score: 2
type: AnsweredQuestion
has body: My context is &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;Context antiJARLocking="true" path="/abc" &gt; &lt;Resource auth="Container" driverClassName="com.mysql.jdbc.Driver" maxActive="50" maxIdle="15" maxWait="10000" name="jdbc/abcd" type="javax.sql.DataSource" url="jdbc:mysql://localhost:3306/abc?characterEncoding=UTF-8&amp;amp;autoReconnect=true" validationQuery="SELECT 1" username="***" password="***"/&gt; &lt;/Context&gt; I am getting this error while starting my server. Name [jdbc/abcd] is not bound in this Context. Unable to find [jdbc]. How to solve this issue? Edit: Found the issue, My Application context is returning blank while trying to get the context by doing lookup(java:comp/env) and in my eclipse server context file i didn't mention any configuration. It is happening because i have enabled java melody and placed 2 jars(jrobin-1.5.9.1.jar and javamelody.jar) in my tomcat lib folders. Don't know why its happening, but i found the solution that if i am putting all those application context data to eclipse sever context file, its resolving my problem. Did anyone face this kind of problem ?

http://stackoverflow.com/a/24990686
score: 1
upvote count: 1
has body: For k-means you need to specify the number of clusters. I guess this defaulted to 1 cluster (with ID 0). P.S. for your data (latitude, longitude, demand), k-means does not make a whole lot of sense. You need to define a distance that measures the similarity as you need it for your data (data specific!), then use a distance based clustering algorithm.
accepted answer of: http://stackoverflow.com/q/24987960
answers question: http://stackoverflow.com/q/24987960
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/comment/38832715
comment on: http://stackoverflow.com/q/24978179
has text: Using JDBC (or by a higher level framework like JPA).
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/38939220
comment on: http://stackoverflow.com/a/25036200
type: AnswerComment
has text: I want it to loop back and forth between turn 1 and turn 2 until either enemyHp or charHp falls to zero or lower. How would I accomplish this?
type: Comment
score: 0

http://stackoverflow.com/a/24939254
accepted answer of: http://stackoverflow.com/q/24939170
has comment: http://stackoverflow.com/comment/38756469
has comment: http://stackoverflow.com/comment/38756211
answers question: http://stackoverflow.com/q/24939170
has comment: http://stackoverflow.com/comment/38756426
type: Answer
upvote count: 2
score: 2
has comment: http://stackoverflow.com/comment/38756583
has comment: http://stackoverflow.com/comment/38756321
has body: From the developer's site about requestFeature(): Enable extended screen features. This must be called before setContentView(). May be called as many times as desired as long as it is before setContentView(). If not called, no extended features will be available. You can not turn off a feature once it is requested. You canot use other title features with FEATURE_CUSTOM_TITLE. So the simple answer is no.
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/24927635
answers question: http://stackoverflow.com/q/24927437
accepted answer of: http://stackoverflow.com/q/24927437
score: 0
type: AcceptedAnswer
has body: &lt;jaxrs:server serviceClass="de.test.MyServiceRest" address="/MyServiceRest" /&gt;
type: Answer

http://stackoverflow.com/a/25040006
score: 1
type: Answer
has comment: http://stackoverflow.com/comment/38947393
answers question: http://stackoverflow.com/q/25039827
upvote count: 1
has body: No built-in function, but can be done on one line: "takaderoka".matches("tkkr".replace("", ".*")); Or put it in a function: static boolean matcher(String one, String two) { return one.matches(two.replace("", ".*")); }
downvote count: 0

http://stackoverflow.com/comment/38806188
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24965841
has text: `this` is apparently null. Why don't you look at the source code of the method `setRequestedOrientation` to check it out?

http://stackoverflow.com/comment/38826008
comment on: http://stackoverflow.com/q/24976458
has text: `Scanner.nextLine()` and `Scanner.useDelimiter()` don't play well together. Use `Scanner.nextLine()` to get the lines, and then `String.split(",")` on each line.
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/a/25044119
answers question: http://stackoverflow.com/q/25044058
upvote count: 3
has comment: http://stackoverflow.com/comment/38953587
has body: I think storing the degrees in the BlockFace enum would be totally acceptable. Otherwise you'd need to search through the arrays, find the matching index, and then multiply by 45 or 90.
type: Answer
score: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/38953664

http://stackoverflow.com/q/25004905
score: 1
has title: How should I handle checked and unchecked exceptions in Java Config @Bean method to display a user-friendly cause of the error?
favorite count: 0
duplicate of: http://stackoverflow.com/q/17468249
has comment: http://stackoverflow.com/comment/38879918
tagged with: exception
tagged with: spring
accepted answer: http://stackoverflow.com/a/25012345
has body: I am developing a small spring-boot-based command-line application. The main class has an @Autowired-annotated field @Autowired Repository repository; whose construction recipe is provided in Java Config class that has an appropriate @Bean-annotated method @Bean Repository repository(){...}. The @Bean-annotated method contains code that can throw checked and unchecked exceptions. @Bean Repository repository(){...//exceptions} My target is to create a user-friendly application which logs brief messages at appropriate logging level rather than long stack traces. Currently, an exception in Java Config @Bean-annotated method causes the application to exit with o.s.boot.SpringApplication: Application startup failed message and a very long stack trace. I wonder if there is a good way to handle at least typical exceptions (which I am aware of) in Java Config @Bean-annotated method to log user-friendly brief messages useful for troubleshooting. I assume such a strategy would expect adding exception handling code to Java Config class, but I have never seen such code in publicly available Java Config classes, which suggests exception handling code in Java Config classes could be a bad practice. Thank you.
type: AnsweredQuestion
tagged with: spring-boot
has comment: http://stackoverflow.com/comment/38888124
tagged with: java
upvote count: 1
tagged with: spring-java-config
has comment: http://stackoverflow.com/comment/38887836
type: Question
linked to: http://stackoverflow.com/q/17468249
has answer: http://stackoverflow.com/a/25012345
answer count: 1
downvote count: 0

http://stackoverflow.com/a/24984360
upvote count: 1
downvote count: 0
answers question: http://stackoverflow.com/q/24983917
has body: Your keys seemed to be mapped differently than my keys, but look in the Preferences (General --> Keys) to see exactly what commands are available for your version of Eclipse and OS. I think the closest command to what you're looking for is Run to Line (where you have to point to the line with the closing curly bracket).
type: Answer
score: 1

http://stackoverflow.com/a/25083038
downvote count: 0
score: 1
has body: Use the @Resolve and @Replace annotations, here you can do. @Replace private Object writeReplace() { return new InstanceWithANullList(); } and then @Resolve private Object readResolve() { return new InstanceWithANonNullList(); }
answers question: http://stackoverflow.com/q/25061122
upvote count: 1
type: Answer

http://stackoverflow.com/q/25006574
has answer: http://stackoverflow.com/a/25006598
score: -1
has comment: http://stackoverflow.com/comment/38882562
answer count: 1
has body: I'm currently stuck on a problem, let's say I want to find the middle value the user inputted, is there a function in Java wherein I can peek or return the middle value? import java.util.*; public class PQueue { public static Scanner console = new Scanner(System.in); public static void main(String[] args) { int arr; PriorityQueue&lt;Integer&gt; queueB = new PriorityQueue&lt;Integer&gt;(); for(int j=0; j&lt;=4; j++) { System.out.println("Input Intergers: "); arr = console.nextInt(); queueB.add(arr); } System.out.print(queueB.peek()); } }
favorite count: 0
has comment: http://stackoverflow.com/comment/38882762
tagged with: priority-queue
type: UnansweredQuestion
downvote count: 2
upvote count: 1
has title: Using Priority Queue to return the middle value in Java
tagged with: java
has comment: http://stackoverflow.com/comment/38882934
tagged with: queue
type: Question

http://stackoverflow.com/q/25044058
has comment: http://stackoverflow.com/comment/38953828
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/38953500
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/38953435
answer count: 1
downvote count: 0
favorite count: 0
has title: How would I reverse this?
has comment: http://stackoverflow.com/comment/38953533
has comment: http://stackoverflow.com/comment/38953369
tagged with: reverse
has comment: http://stackoverflow.com/comment/38953446
has answer: http://stackoverflow.com/a/25044119
has body: I have this code: public static final BlockFace[] axis = {BlockFace.NORTH, BlockFace.EAST, BlockFace.SOUTH, BlockFace.WEST}; public static final BlockFace[] radial = {BlockFace.NORTH, BlockFace.NORTH_EAST, BlockFace.EAST, BlockFace.SOUTH_EAST, BlockFace.SOUTH, BlockFace.SOUTH_WEST, BlockFace.WEST, BlockFace.NORTH_WEST}; public static BlockFace yawToFace(float yaw, boolean useSubCardinalDirections) { if (useSubCardinalDirections) { return radial[Math.round(yaw / 45f) &amp; 0x7]; } else { return axis[Math.round(yaw / 90f) &amp; 0x3]; } } How would I go about reversing this in an efficient matter? I can think of a few brute-forcey ways, but they seem very inefficient. So, what I have is a yawToFace() method, I want to create a faceToYaw() method. Any help would be greatly appreciate. Thank you! :)
type: UnansweredQuestion

http://stackoverflow.com/comment/38982793
type: Comment
comment on: http://stackoverflow.com/q/25059673
score: 0
has text: Possible duplicate of [Thread-safe circular buffer in Java](http://stackoverflow.com/questions/11079210/thread-safe-circular-buffer-in-java)
type: QuestionComment

http://stackoverflow.com/comment/38820612
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24972437
has text: @SotiriosDelimanolis i've added the request. hope it's clear enough

http://stackoverflow.com/a/79221845
type: Answer
answers question: http://stackoverflow.com/q/24943894
score: 0
has body: Statement st = con.createStatement(); ResultSet rs=st.executeQuery(Queryall); ResultSetMetaData metaData = rs.getMetaData(); int columnCount = metaData.getColumnCount(); for (int i = 1; i <= columnCount; i++) { System.out.print(metaData.getColumnName(i) + " "); } System.out.println(); while (rs.next()) { for (int i = 1; i <= columnCount; i++) { System.out.print(rs.getString(i) + " "); } System.out.println(); } con.close(); System.out.println("Connection Closed");

http://stackoverflow.com/a/25059398
has body: You're not comparing a char to a char, you're comparing a char to an int. Which just happens to be legal because chars are numbers internally (put very simply, there's more to it than that of course). Change the line to: if(arr[i].charAt(word)== '1') Notice the quotes.
downvote count: 0
score: 1
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/25059329

http://stackoverflow.com/q/25024280
has comment: http://stackoverflow.com/comment/38916875
tagged with: shell
has comment: http://stackoverflow.com/comment/38917844
has body: I have following script: #!/bin/bash ID=$PPID read PID &lt; &lt;(exec ps -o ppid= "$ID") top -cbn 1 -p $PID grep -f &lt;(pstree -cp $PID | grep -Po '\(\K\d+'| sed -re 's/$/ /g' | sed -re 's/^/^\\s\*/g' ) &lt;(top -cbn 1) When I am running this script from command prompt the output is top - 16:43:17 up 6:40, 6 users, load average: 0.04, 0.02, 0.00 Tasks: 1 total, 0 running, 1 sleeping, 0 stopped, 0 zombie Cpu(s): 0.9%us, 0.6%sy, 0.0%ni, 98.1%id, 0.4%wa, 0.0%hi, 0.0%si, 0.0%st Mem: 4152800k total, 1908108k used, 2244692k free, 92984k buffers Swap: 1048568k total, 0k used, 1048568k free, 1104756k cached PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 16866 root 40 0 7792 3188 2088 S 0.0 0.1 0:00.01 su 16750 builder 40 0 1213m 262m 15m S 0.0 6.5 0:55.43 /opt/ibm/java-i386-60/jre/bin/java -Dosgi.requiredJavaVersion=1.6 -XX:MaxPermSize=256m -Xms40m -Xmx1024m -jar /home/builder/eclipse//plugins/org.eclipse.equinox.launcher_1.3.0. Notice the output of COMMAND and it is displaying the complete command. But if I run the same program from java, the output truncate the COMMAND name and I am not able to figure out why ? Truncation occur after 19 character. Or in different words Every line truncate after 80 character. Here is the output if I run the same program using Java top - 16:13:52 up 6:10, 6 users, load average: 0.16, 0.16, 0.06 Tasks: 1 total, 0 running, 1 sleeping, 0 stopped, 0 zombie Cpu(s): 0.9%us, 0.6%sy, 0.0%ni, 98.0%id, 0.4%wa, 0.0%hi, 0.0%si, 0.0%st Mem: 4152800k total, 1913364k used, 2239436k free, 91560k buffers Swap: 1048568k total, 0k used, 1048568k free, 1103952k cached PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 16750 builder 40 0 1206m 257m 15m S 0.0 6.3 0:26.32 /opt/ibm/java-i386- 16750 builder 40 0 1206m 257m 15m S 1.9 6.3 0:26.33 /opt/ibm/java-i386- 16943 builder 20 0 2608 1008 748 R 1.9 0.0 0:00.02 top -cbn 1 16918 builder 20 0 554m 14m 6060 S 0.0 0.4 0:00.10 /opt/ibm/java-i386- 16934 builder 20 0 4976 1120 992 S 0.0 0.0 0:00.00 /bin/bash…
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38917278
has comment: http://stackoverflow.com/comment/38919042
has comment: http://stackoverflow.com/comment/38918063
answer count: 0
linked to: http://stackoverflow.com/q/5960554
has comment: http://stackoverflow.com/comment/38943384
tagged with: java
has comment: http://stackoverflow.com/comment/38917422
has title: different output while running a command from java
type: Question
has comment: http://stackoverflow.com/comment/38917931
score: 0
has comment: http://stackoverflow.com/comment/38916964

http://stackoverflow.com/q/25049739
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/25052055
answer count: 1
downvote count: 0
has body: Trying to profile my app, I found in Sampler section of Java Visual VM, that method MyClass#setDimensionValue(int) takes the most time. But the code of this method is following: public int setDimensionValue(int index, int newValue) { return delegate.setValue(index, newValue); } i.e. it just calls another method. How it can spend so much time inside caller method then?
has title: How to interpret big self-time results in Java Visual VM?
favorite count: 0
tagged with: visualvm
type: UnansweredQuestion
score: 2
upvote count: 2

http://stackoverflow.com/comment/38779300
type: AnswerComment
has text: Thanks but it's not what I need. The problem is that I don't write a real xls file. It's just outputing it as xls and offer promt to the user to save or open it. After more investigation I'm afraid it's not possible to do what I need :( . Thanks anyway
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24950025

http://stackoverflow.com/a/24996969
has comment: http://stackoverflow.com/comment/38880441
type: Answer
has body: This is really normal. The exectuion flow is like this: j=0 i=0 LABEL 2 loop entered, LABEL 1 loop entered, continue to LABEL 2 j++ LABEL 1 loop entered, continue to LABEL 2 j++ LABEL 1 loop entered, continue to LABEL 2 ... until j==3
has comment: http://stackoverflow.com/comment/38865522
downvote count: 2
upvote count: 16
score: 14
has comment: http://stackoverflow.com/comment/39763487
has comment: http://stackoverflow.com/comment/39743618
has comment: http://stackoverflow.com/comment/38864903
answers question: http://stackoverflow.com/q/24996852

http://stackoverflow.com/q/24914788
answer count: 1
tagged with: jpa
has comment: http://stackoverflow.com/comment/38710240
has body: Java + Spring + JPA + Hibernate + oracle I am using following code to batch inserts when i execute the following code i get response -2 and no record insert into the table. any help ? Example code.java List&lt;ReportItem&gt; reportItems = new ArrayList&lt;ReportItem&gt;(); ReportItem reportItem = new ReportItem(); reportItems.add(reportItem); reportItem.setReportId(new Long(61)); reportItem.setLicenseWindowEnd("LICENSE_WINDOW_END"); reportItem.setLicenseWindowStart("LICENSE_WINDOW_START"); reportItem.setPackageAssetID("PACKAGE_ASSET_ID"); reportItem.setPackageAssetName("PACKAGE_ASSET_NAME"); reportItem.setPackageProvider("PACKAGE_PROVIDER"); reportItem.setPackageProviderID("PACKAGE_PROVIDER_ID"); reportItem.setPackageUpdateNum("PACKAGE_UPDATE_NUM"); reportItem.setTitle("TITLE"); reportItem.setTitleAssetID("TITLE_ASSET_ID"); reportItem.setTitleBrief("TITLE_BRIEF"); reportItem.setTitleProviderID("TITLE_PROVIDER_ID"); reportItem.setTitleUpdateNum("TITLE_UPDATE_NUM"); reportItem.setTargetPitchDate("TARGET_PITCH_DATE"); reportItem.setAssetCdnStatus("ASSET_CDN_STATUS"); reportItem.setAssetReceived("ASSET_RECEIVED"); reportItem.setAssetReceived("ASSET_AVAILABLE"); int[] counts = reportDAO.insertBatchReportItems(reportItems); // response return counts[0] is -2 Dao.java @Override public int[] insertBatchReportItems(final List&lt;ReportItem&gt; reportItems) { int[] counts = getJdbcTemplate().batchUpdate(sql, new BatchPreparedStatementSetter() { @Override public void setValues(PreparedStatement ps, int i) throws SQLException { ReportItem reportItem = reportItems.get(i); ps.setLong(1, reportItem.getReportId()); ps.setString(2, reportItem.getLicenseWindowEnd()); ps.setString(3, reportItem.getLicenseWindowStart()); ps.setString(4, reportItem.getPackageAssetID()); ps.setString(5, reportItem.getPackageAssetName()); ps.setString(6, reportItem.getPackageProvider()); ps.setString(7, reportItem.getPackageProviderID()); ps.setString(8, reportItem.getPackageUpdateNum()); ps.setString(9, …
tagged with: spring
type: AnsweredQuestion
tagged with: java
tagged with: hibernate
type: Question
has comment: http://stackoverflow.com/comment/38710345
has title: inserting batch update no error but number of rows effected -2
score: 0
has comment: http://stackoverflow.com/comment/38710608
has answer: http://stackoverflow.com/a/24915387
accepted answer: http://stackoverflow.com/a/24915387

http://stackoverflow.com/comment/38771173
comment on: http://stackoverflow.com/a/24947020
has text: what is that Char method for ?
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/38808379
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24962555
has text: That is how I set my first one up, however I wanted to try doing so with this slightly different approach as well. I am using a transformation matrix in my project, but for this example I figured that would distract from the real issue. (i.e. the non-functional recursive setPos)
score: 0

http://stackoverflow.com/q/24954418
has title: Center a block of two Views in Android
score: 0
has comment: http://stackoverflow.com/comment/38784559
has answer: http://stackoverflow.com/a/24954636
answer count: 5
tagged with: android
has answer: http://stackoverflow.com/a/24954730
has comment: http://stackoverflow.com/comment/38784959
has body: I want a block of two labels to be horizontally centered in the screen, currently I have the following code: &lt;LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:orientation="horizontal" &gt; &lt;TextView android:id="@+id/TextView02" android:layout_width="wrap_content" android:layout_height="wrap_content" android:ellipsize="end" android:singleLine="true" android:text="Lorem ipsum" android:textColor="#ff0000" /&gt; &lt;TextView android:id="@+id/TextView01" android:layout_width="wrap_content" android:layout_height="wrap_content" android:singleLine="true" android:text="Test 2" android:textColor="#00ff00" /&gt; &lt;/LinearLayout&gt; It is ok when the text are short (see image below): But when the red text is long (or the screen is narrow) the green text is missing: Since green text is a single word I want it to have priority, beeing always visible ellipsing the red if needed (and keeping the block centered) This is how it should look like: How can I achieve that? Note: I need to use two TextView since they must be animated
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38784549
tagged with: java
has answer: http://stackoverflow.com/a/24954860
has comment: http://stackoverflow.com/comment/38784427
has answer: http://stackoverflow.com/a/24954800
accepted answer: http://stackoverflow.com/a/24954800
type: Question
possible better answer: http://stackoverflow.com/a/24954860
has comment: http://stackoverflow.com/comment/38784594
has answer: http://stackoverflow.com/a/24954901

multidimensional-array
tags question: http://stackoverflow.com/q/24964454
tags question: http://stackoverflow.com/q/24973673
tags question: http://stackoverflow.com/q/24983812
tags question: http://stackoverflow.com/q/24955314
tags question: http://stackoverflow.com/q/25038143
type: Tag
tags question: http://stackoverflow.com/q/25042479
tag name: multidimensional-array

http://stackoverflow.com/comment/38986068
comment on: http://stackoverflow.com/q/25061386
type: QuestionComment
has text: possible duplicate of [File name and class name different in java](http://stackoverflow.com/questions/19731853/file-name-and-class-name-different-in-java)
score: 3
type: Comment

http://stackoverflow.com/comment/38708254
type: AnswerComment
comment on: http://stackoverflow.com/a/24913266
score: 0
type: Comment
has text: Sorry, I had a typo. I assume you mean "a" followed by anything (or nothing) followed by an ending "b".

http://stackoverflow.com/q/24934464
favorite count: 0
tagged with: bluetooth
has title: How to do good real-time data streaming using Java Android SDK
accepted answer: http://stackoverflow.com/a/27777724
has body: I have a home-made bluetooth device measuring ECG at 500Hz: every 2 ms the device sends 9 bytes of data (header, ECG measurment, footer). So this is roughly a 9*500=4.5kbytes/s data stream. I have a C++ Windows program able to connect the device and retrieve the data stream (displaying it with Qt/qwt). In this case, I use Windows control panel to bond the device and I connect it via a virtual COM port using boost serial_port interface. This works perfectly and I'm receiving my data stream in real time: I get a measurment point every 2ms or so. I ported the whole program on Android via QtCreator 3.0.1 (Qt 5.2.1). It appears that virtual COM ports cannot be accessed by boost (probably SDK permissions won't allow that) so I wrote a piece of Java code to open and manage the Bluetooth connection. So my app remains C++/Qt but only the layer connecting and reading data from the device was reworked in Java (opening the connexion with createInsecureRfcommSocketToServiceRecord): Java code to read the data: public int readData( byte[] buffer ) { if( mInputStream == null ) { traceErrorString("No connection, can't receive data"); } else { try { final boolean verbose = false; int available = mInputStream.available(); if ( verbose ) { Calendar c = Calendar.getInstance(); Date date = new Date(); c.setTime(date); c.get(Calendar.MILLISECOND); SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss"); String currentTime = sdf.format(date); traceDebugString( currentTime + ":" + c.get(Calendar.MILLISECOND) + " - " + available + " bytes available, requested " + buffer.length ); } if ( available &gt;= buffer.length ) return mInputStream.read( buffer ); // only call read if we know it's not blocking else return 0; } catch (IOException e) { traceDebugString( "Failed to read data...disconnected?" ); } } return -1; } Called from C++ like that: bool ReceiveData( JNIEnv* env, char* data, size_t length, bool&amp; haserror ) { bool result = false; jbyteArray array = env-&gt;NewByteArray(length); ji…
tagged with: android
tagged with: c++
linked to: http://stackoverflow.com/q/18420525
upvote count: 2
tagged with: qt
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27777724
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/27229813
score: 2
answer count: 1
downvote count: 0

http://stackoverflow.com/q/25034894
accepted answer: http://stackoverflow.com/a/39247865
type: Question
tagged with: grails
answer count: 2
score: 3
downvote count: 0
has answer: http://stackoverflow.com/a/39247865
favorite count: 0
has body: I have to map a character(1) field in the database to a gorm attribute. The field in the database is clearly a "yes_no" type, but with the exception, that the 'Y' should have the german expression 'J'. Is there a way to handle it, or should I use a char field instead of a boolean in my gorm-class? Thanks in advance,
possible better answer: http://stackoverflow.com/a/25038647
has answer: http://stackoverflow.com/a/25038647
has title: hibernate type yes_no with 'J' instead of 'Y'
type: AnsweredQuestion
upvote count: 3
tagged with: java
tagged with: hibernate
tagged with: grails-orm

http://stackoverflow.com/comment/38867492
type: QuestionComment
comment on: http://stackoverflow.com/q/24983925
has text: What does your Assets class look like? Are you by any chance re-loading the sound every time you want to play it? I don't understand your `waitForLoadCompleted` method--are you doing some kind of asynchronous loading?
score: 0
type: Comment

wsdl
tags question: http://stackoverflow.com/q/25059555
tags question: http://stackoverflow.com/q/24952440
tags question: http://stackoverflow.com/q/24953103
tags question: http://stackoverflow.com/q/25028384
tags question: http://stackoverflow.com/q/25038393
tags question: http://stackoverflow.com/q/24959693
tags question: http://stackoverflow.com/q/25041931
tags question: http://stackoverflow.com/q/24934558
tags question: http://stackoverflow.com/q/25056836
tags question: http://stackoverflow.com/q/24995358
tags question: http://stackoverflow.com/q/24998830
type: Tag
tag name: wsdl

http://stackoverflow.com/comment/38709396
type: QuestionComment
comment on: http://stackoverflow.com/q/24914340
has text: Most IDEs will auto-deploy artifacts like JS, CSS, JSP, etc.
type: Comment
score: 1

http://stackoverflow.com/comment/38728382
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24924088
has text: Ok if it can't be done that sucks. I read something about a batch file, not sure how that works, but could that work ?

http://stackoverflow.com/comment/38882242
type: Comment
type: QuestionComment
has text: Unless you're dealing with embedded systems where you need to count each byte, your issue is immaterial.
score: 0
comment on: http://stackoverflow.com/q/25006314

http://stackoverflow.com/q/24941750
has title: Gradle fail: unsupported node 'item' in ids.xml
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/24942948
favorite count: 0
tagged with: android
has body: I'm having some trouble with getting my Android application to run since Gradle keeps failing. I have recently updated Android Studio to 0.8.0 and am trying to run a project that a friend (using the same version of Android Studio) modified. The message from the Gradle Build just says: Error:Execution failed for task ':app:mergeDebugResources'. > Unsupported node 'item' in file D:\Dropbox\Programing\GIT\AntiTheftCharge\app\src\main\res\values\ids.xml Below is my ids.xml file: <?xml version="1.0" encoding="utf-8"?> switchOnOff switchMovement switchPower optTimeNone optTime2 optTime5 optTime10 btnChooseTime linear btnChooseTone cmdStop btnStop btnAbout Here is the contents of the build.gradle file from inside the app folder apply plugin: 'android' android { compileSdkVersion 19 buildToolsVersion "19.1.0" defaultConfig { minSdkVersion 7 targetSdkVersion 19 versionCode 1 versionName "1.0" } buildTypes { release { runProguard false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' } } } dependencies { compile 'com.android.support:appcompat-v7:+' compile 'com.android.support:support-v4:19.0.0' } Thanks for taking the time to read this, and any suggestions would be much appreciated :)
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/24942948
tagged with: gradle
type: Question
score: 4
upvote count: 4

http://stackoverflow.com/comment/38859455
has text: possible duplicate of [Spring MVC with multiple view resolvers](http://stackoverflow.com/questions/18215402/spring-mvc-with-multiple-view-resolvers)
comment on: http://stackoverflow.com/q/24994351
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24952390
has body: I am making a libGDX (Android) game for which I'll have 90 ParticleEffects playing simultaneously. These may however be of about 25 different types (e.g.: water, fire, ...), which would potentially mean that 2250 effects are pooled in 25 different pools. I estimate that I need about 20 new effects per second. Now I have 3 possibilities to implement this: Pooling, with a potential size of 2250, while I only need to show 90 at a time. --> memory overhead Keep a list of 90 effects and dispose() / create() them at a frequency of 20 times per second. --> computationally expensive Pooling, but now dispose() effects which probably are not needed in the next ~10 seconds, which would require them to be recreated once they are needed. This way, the size would reduce to about 300-500. --> less memory overhead than (1), but potentially the same computational requirement as (2) at times. Q: Is there any way to say which possibility is the `better' option in terms of lowest computational cost / memory overhead? Which is equivalent to asking: How efficient is pooling ParticleEffects? Thanks in advance.
tagged with: libgdx
tagged with: java
score: 0
has comment: http://stackoverflow.com/comment/38799706
has comment: http://stackoverflow.com/comment/38799494
has comment: http://stackoverflow.com/comment/38786910
has comment: http://stackoverflow.com/comment/38787559
tagged with: particles
answer count: 0
type: UnansweredQuestion
tagged with: pooling
has comment: http://stackoverflow.com/comment/38782736
has title: Java - libGDX - ParticleEffect - Should I use pooling?
type: Question
tagged with: effect

http://stackoverflow.com/q/24986982
possible better answer: http://stackoverflow.com/a/32596611
has title: issues with codingbat maxMirror exercise
has answer: http://stackoverflow.com/a/32596611
has answer: http://stackoverflow.com/a/51092884
has answer: http://stackoverflow.com/a/58797441
score: 2
type: AnsweredQuestion
downvote count: 0
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26708932
accepted answer: http://stackoverflow.com/a/26708932
upvote count: 2
favorite count: 0
has answer: http://stackoverflow.com/a/25874968
has body: So basically, I've been going through these codingBat problems, and when I get really stuck, I usually check out the solution and trace the logic and that has helped me not get stuck on later problems which used similar ideas. This max mirror problem is not like the others for me personally; I have no idea how to actually write the code to solve it, even forming the algorithm is kind of tricky for me We'll say that a "mirror" section in an array is a group of contiguous elements such that somewhere in the array, the same group appears in reverse order. For example, the largest mirror section in {1, 2, 3, 8, 9, 3, 2, 1} is length 3 (the {1, 2, 3} part). Return the size of the largest mirror section found in the given array. maxMirror({1, 2, 3, 8, 9, 3, 2, 1}) → 3 maxMirror({1, 2, 1, 4}) → 3 maxMirror({7, 1, 2, 9, 7, 2, 1}) → 2 Now, in terms of the algorithm, I sort of want to say something like, if we start by checking if the whole array is a mirror and then decrease the checked area size by 1 if it's not. But in terms of the pseudocode and the real code I have no idea.
answer count: 5

http://stackoverflow.com/q/25011530
answer count: 1
type: UnansweredQuestion
has title: JBehave sub-scenarios?
downvote count: 0
score: 1
favorite count: 0
tagged with: jbehave
type: Question
has answer: http://stackoverflow.com/a/25710175
has body: Is it possible to add multiple given-when-then blocks to a scenario (something like a sub-scenario)? Here's an example what I have in mind: A sample story with a collection of scenarios Narrative: As a dev In order to do work I want multiple sub-scenarios :-) Scenario: A sample collection scenario Given step1... When step1... Then step1... Given step2... When step2... Then step2... As a workaround, I could use multiple scenarios, but that would require rewriting some glue code for initializing structures (before and after methods). Any hints how could I avoid that? Thanks in advance!
tagged with: java
upvote count: 1

http://stackoverflow.com/a/25616702
has comment: http://stackoverflow.com/comment/40136132
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/40136157
has body: first implements Filterable in ApkAdapter class add this in apkAdapter clas @Override public Filter getFilter() { if (mFilter == null) { mFilter = new ItemsFilter(); } return mFilter; } private class ItemsFilter extends Filter { @Override protected FilterResults performFiltering(CharSequence prefix) { // TODO Auto-generated method stub ArrayList&lt;PackageInfo&gt; packageList_2 = packageList; String prefixString = prefix.toString().toLowerCase(); FilterResults results = new FilterResults(); ArrayList&lt;PackageInfo&gt; FilteredList = new ArrayList&lt;PackageInfo&gt;(); if (prefix == null || prefix.length() == 0) { results.values = packageList_2; results.count = packageList_2.size(); return results; } for (int i = 0; i &lt; packageList_2.size(); i++) { String filterText = prefix.toString().toLowerCase(); try { PackageInfo data = packageList_2.get(i); if (data.applicationInfo .loadLabel(getActivity().getPackageManager()) .toString().toLowerCase().contains(filterText)) { FilteredList.add(data); } else if (data.packageName.contains(filterText)) { FilteredList.add(data); } } catch (Exception e) { Toast.makeText(getActivity(), "exception e" + e.toString(), Toast.LENGTH_SHORT).show(); } } results.values = FilteredList; results.count = FilteredList.size(); } @SuppressWarnings("unchecked") @Override protected void publishResults(CharSequence constraint, FilterResults results) { Toast.makeText(getActivity(),"result-0 "+results.count, Toast.LENGTH_SHORT).show(); packageList = (List&lt;PackageInfo&gt;) results.values; notifyDataSetChanged(); } } then add this in OnCreateOptionMenu @Override public boolean onCreateOptionsMenu(Menu menu){ MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.block, menu); SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE); SearchView searchView = (SearchView) menu.findItem(R.id.action_search).getActionView(); searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName())); searchV…
has comment: http://stackoverflow.com/comment/40136839
has comment: http://stackoverflow.com/comment/40019417
has comment: http://stackoverflow.com/comment/40045504
answers question: http://stackoverflow.com/q/24926998
downvote count: 0
has comment: http://stackoverflow.com/comment/40136230
type: Answer

http://stackoverflow.com/a/24971751
upvote count: 7
answers question: http://stackoverflow.com/q/24971666
accepted answer of: http://stackoverflow.com/q/24971666
has body: Two ways come to mind immediately: Use the userData property: Button a = new Button(); a.setUserData("A"); Button b = new Button(); b.setUserData("B"); Button c = new Button(); c.setUserData("C"); somePane.getChildren().addAll(a, b, c); // ... private Node getByUserData(Parent parent, Object data) { for (Node n : parent.getChildren()) { if (data.equals(n.getUserData())) { return n ; } return null ; } Or, use a CSS id and the lookup() method. Note that this will only work once CSS has been applied to the node, which effectively means that they must be part of a live scene graph. Button a = new Button(); a.setId("A"); Button b = new Button(); b.setId("B"); Button c = new Button(); c.setId("C"); somePane.getChildren().addAll(a, b, c); // ... Button button = (Button) somePane.lookup("#B");
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 7

http://stackoverflow.com/comment/38908369
score: 0
comment on: http://stackoverflow.com/a/25019696
type: AnswerComment
has text: Yeah sure, give me a moment.
type: Comment

http://stackoverflow.com/a/24933265
has comment: http://stackoverflow.com/comment/38745077
has comment: http://stackoverflow.com/comment/38749090
has comment: http://stackoverflow.com/comment/38744892
score: 0
type: Answer
has body: This is not a general solution to the stated problem, but a solution to your problem. I would use regular expressions along the lines of: &lt;item&gt;([0-9a-zA-Z]*):([0-9a-zA-Z]*)&lt;/item&gt; If you use this expression in global mode you will match each input. You can parse the string using java.util.regex.Pattern. (See the section on "Groups and capturing" to get the values within.) You can then build up a com.google.gson.JsonArray and populate the values from the Matcher. This array can then be replaced with the additionalDetails field. Finally you just write out the result or do whatever you wanted to do with it.
has comment: http://stackoverflow.com/comment/38756892
answers question: http://stackoverflow.com/q/24932907

http://stackoverflow.com/comment/38988571
type: Comment
comment on: http://stackoverflow.com/q/25062789
score: 0
type: QuestionComment
has text: As in, is it two actions instead of one? I think if it affects performance its tiny, but i'm interested in knowing if there is a difference between the two.

http://stackoverflow.com/comment/38776897
type: Comment
type: QuestionComment
has text: emulator-5554 disconnected! Cancelling 'com.example.mobileapp.MainActivity activity launch'!
comment on: http://stackoverflow.com/q/24949161
score: 0

http://stackoverflow.com/q/24923929
favorite count: 0
has answer: http://stackoverflow.com/a/24923976
score: -3
possible better answer: http://stackoverflow.com/a/24923990
has answer: http://stackoverflow.com/a/24923986
has answer: http://stackoverflow.com/a/24923990
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/29140402
tagged with: java
upvote count: 1
accepted answer: http://stackoverflow.com/a/24923976
has title: Java program outputs different characters rather than person object information
has comment: http://stackoverflow.com/comment/38727435
duplicate of: http://stackoverflow.com/q/29140402
type: Question
has answer: http://stackoverflow.com/a/24923981
answer count: 6
downvote count: 4
has body: I do not understand why my output is not what I expected, instead of showing the persons information, the output displays: examples.Examples@15db9742 Am I doing something wrong in my code? package examples; public class Examples { String name; int age; char gender; public Examples(String name, int age, char gender){ this.name = name; this.age = age; this.gender = gender; } public static void main(String[] args) { Examples[] person = new Examples[10]; person[0] = new Examples("Doe",25,'m'); System.out.println(person[0]); } }
has answer: http://stackoverflow.com/a/24923994
has answer: http://stackoverflow.com/a/24924026

http://stackoverflow.com/comment/38902601
type: Comment
has text: Looks like a typo. Variable should be declared as interface with call to concrete class constructor.
score: 0
comment on: http://stackoverflow.com/q/25016949
type: QuestionComment

http://stackoverflow.com/comment/38811459
score: 0
has text: Actually I think those emojis are up in the area where you get into surrogate pairs: `"\uD83D\uDE03"`, `"\uD83D\uDE1C"`, and `"\uD83D\uDE0D"` respectively in Java's UTF-16 strings. That's what I get when I paste them into my "Unicode Show Me" bin: http://jsbin.com/erajer/16 (it really should be called a "UTF-16 Show Me"), and if I paste that into a Java program as `System.out.println("\uD83D\uDE03\uD83D\uDE1C\uD83D\uDE0D");` (I don't do Scala), I see the emojis on the console.
type: AnswerComment
comment on: http://stackoverflow.com/a/24968688
type: Comment

http://stackoverflow.com/q/24942789
score: 0
tagged with: android
has body: I see the following in my cmd window when using adb logcat Is this indicative of a memory leak? My assumption is that java garbage collection is running continuously, but I'm not sure. Any clarification is welcome!
type: UnansweredQuestion
tagged with: garbage-collection
tagged with: performance
tagged with: java
has answer: http://stackoverflow.com/a/24942832
type: Question
has title: GC_CONCURRENT running non-stop
answer count: 1

http://stackoverflow.com/a/24948969
type: Answer
accepted answer of: http://stackoverflow.com/q/24948924
upvote count: 9
score: 9
type: AcceptedAnswer
downvote count: 0
has body: enum ModulesEnum { FIRST(new C1()), SECOND(new C2()); // and so on private ModulesEnum(Intr intr) { this.obj = intr; } private Intr obj; public Intr getObj() { return obj; } } Hope that helps. The trick is to add an implementation to every enum. If you want to access the object, use the getter. ModulesEnum.FIRST.getObj(); If your Intr and its implementations are package protected, you can make ModulesEnum public to expose the implementations. This way you can have only one instance per implementation, making them singleton without using the pattern explicitly. You can of course use a Factory too if you intend to have multiple instances for every implementation.
answers question: http://stackoverflow.com/q/24948924

http://stackoverflow.com/q/25003822
possible better answer: http://stackoverflow.com/a/25003894
has body: I'm taking a beginners java course online, and I need to better understand how the assignments work with inheritance. If I have, for example, these classes... public class Cell{...} public class BloodCell extends Cell {...} public class RedBloodCell extends BloodCell {...} Are these valid? Cell c = new BloodCell(); Cell c = new RedBloodCell(); BloodCell c = new RedBloodCell(); RedBloodCell c = new BloodCell();
has answer: http://stackoverflow.com/a/25003894
answer count: 2
accepted answer: http://stackoverflow.com/a/25004126
favorite count: 0
has title: Understanding assignments and "extends" in Java
has comment: http://stackoverflow.com/comment/38877490
downvote count: 6
has comment: http://stackoverflow.com/comment/38877524
type: AnsweredQuestion
score: -5
tagged with: java
has comment: http://stackoverflow.com/comment/38877634
has comment: http://stackoverflow.com/comment/38877682
has comment: http://stackoverflow.com/comment/38877660
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/25004126
has comment: http://stackoverflow.com/comment/38877520
tagged with: inheritance
has comment: http://stackoverflow.com/comment/38877531

http://stackoverflow.com/comment/38855536
type: QuestionComment
has text: That's what the API guys said. The problem is that it parses fine when the request is sent from POSTMAN but does not work when it goes through my java application. So the problem must be there in my code. Maybe I'm not setting a required request header etc.
comment on: http://stackoverflow.com/q/24991804
score: 0
type: Comment

http://stackoverflow.com/comment/38863177
has text: I think your expected output should actually be `537316,MANUAL,546,"""THIS"",""IS"",FOR,""TEST""",345`. If a field has a comma in, then the whole field needs to be surrounded in quotes for it to be treated as one field. And if that field already has quotes in, then such quotes need to be made into double-quotes!
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24995282
score: 0

http://stackoverflow.com/comment/38886490
comment on: http://stackoverflow.com/a/25008379
has text: @user3862586 check the edit parts of the ans it should solve the problem
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/38970245
score: 0
comment on: http://stackoverflow.com/a/25020069
type: Comment
has text: I think there is either something wrong with your UnitTest or when you copied my code, because I now also tested it with that input and the UnitTest still succeeded.
type: AnswerComment

http://stackoverflow.com/a/24920619
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24920133
downvote count: 0
answers question: http://stackoverflow.com/q/24920133
has comment: http://stackoverflow.com/comment/38722964
type: Answer
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/38722635
has body: I guess instead of this.items.add(neu); use the method call add() this.add(neu); But you are always adding to array[0] do you really want to do that ? Also (E[])(new Object[5]); is an unsafe cast, as Jigar Joshi posted use an ArrayList instead A working example : import java.util.ArrayList; public class Generic &lt;E extends Item&gt; { private ArrayList&lt;E&gt; items = new ArrayList&lt;E&gt;(); public void add(E neu) { this.items.add(neu); } public void problematic(E clazz) { this.add(clazz); // this line is the problem } } class Item {} The same with an Array of Object public class Gen &lt;E extends Item&gt; { private Object[] items = new Object[5]; private int itemCounter = 0; public void add(E neu) { if(itemCounter &lt; items.length){ this.items[itemCounter] = neu; itemCounter +=1; } } public int length() { return itemCounter; } // testing the class public static void main(String[] args) { Item t0 = new Item(); Item t1 = new Item(); Item t2 = new Item(); Item t3 = new Item(); Item t4 = new Item(); Item t5 = new Item(); Gen&lt;Item&gt; g = new Gen&lt;Item&gt;(); g.add(t0); g.add(t1); g.add(t2); g.add(t3); g.add(t4); g.add(t5); // ignored System.out.println(g.length()); } } class Item {}

http://stackoverflow.com/q/24983091
possible better answer: http://stackoverflow.com/a/24983141
downvote count: 0
favorite count: 0
has title: Check if string taken with Scanner.next() contains number
tagged with: regex
has comment: http://stackoverflow.com/comment/38838476
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38838698
tagged with: java.util.scanner
score: 1
has comment: http://stackoverflow.com/comment/38838566
tagged with: java
has answer: http://stackoverflow.com/a/24983121
accepted answer: http://stackoverflow.com/a/24983121
has answer: http://stackoverflow.com/a/24983141
type: Question
has comment: http://stackoverflow.com/comment/38838551
has body: I wanted to take a String using Scanner.next() and see if it contains a number or not. I used regex to check if a string contains anything but a number. The regex works correctly if the string is hard coded, but not when taken from keyboard. I expected input of 5 to be detected as a number, but it is not. Please tell me why. My code: import java.util.Scanner; public class Error { public static void main(String[] args) { Scanner inp = new Scanner(System.in); int num = 0; String input = ""; boolean isStringNumber = true; System.out.println("\nPlease enter a number only..."); input = inp.nextLine(); isStringNumber = input.contains("[^0-9]+"); if (isStringNumber == false) { System.out.println("\nYou entered a non number " + input); } } }
has comment: http://stackoverflow.com/comment/38838517
answer count: 2
upvote count: 1

http://stackoverflow.com/a/24970817
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/24970782
has comment: http://stackoverflow.com/comment/38816060
accepted answer of: http://stackoverflow.com/q/24970782
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/38816405
has body: This is how you get the value from the defined in xml: String[] arrayXml= yourContext.getResources().getStringArray(R.array.my_array); textView.setText(arrayXml[0]);//setText

http://stackoverflow.com/comment/38841343
has text: `private class DrawingPane extends JPanel { .. setSize(640,480);` I'd replace the `DrawingPane` with a `BufferedImage` displayed in a `JLabel`..
score: 1
comment on: http://stackoverflow.com/q/24984547
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24984117
tagged with: xmpp
favorite count: 0
has comment: http://stackoverflow.com/comment/38843176
has title: How to install Openfire on windows 8.1 64-bit with external database
type: UnansweredQuestion
answer count: 0
downvote count: 0
score: 1
tagged with: java
has body: I try to install openfire but I have some error, I don't understand why I cannot install successfully Openfire 3.9.3 . when I choose : Standard Database Connection Use an external database with the built-in connection pool. => I use http://localhost/phpmyadmin/ for mysql Database Driver Presets:MySql JDBC Driver Class:com.mysql.jdbc.Driver Database URL:jdbc:mysql://[localhost]:3306/[dbopenfire]?rewriteBatchedStatements=true Username:root //Left blank Password: what is the problem? many thanks. error.log: 2014.07.27 20:57:33 org.jivesoftware.util.log.util.CommonsLogFactory - Prototype com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server. at sun.reflect.GeneratedConstructorAccessor13.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) at java.lang.reflect.Constructor.newInstance(Unknown Source) at com.mysql.jdbc.Util.handleNewInstance(Util.java:409) at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1127) at com.mysql.jdbc.MysqlIO.&lt;init&gt;(MysqlIO.java:356) at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2502) at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2539) at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2321) at com.mysql.jdbc.ConnectionImpl.&lt;init&gt;(ConnectionImpl.java:832) at com.mysql.jdbc.JDBC4Connection.&lt;init&gt;(JDBC4Connection.java:46) at sun.reflect.GeneratedConstructorAccessor10.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) at java.lang.reflect.Constructor.newInstance(Unknown Source) at com.mysql.jdbc.Util.handleNewInstance(Util.java:409) at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:417) at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:344) at java.sql.Dri…
type: Question
tagged with: openfire
upvote count: 1

http://stackoverflow.com/a/24919059
score: 1
has comment: http://stackoverflow.com/comment/38724569
has body: setBounds() will be called on the EDT by Swing code, but you have to ensure your code's own invocations of setBounds() also only calls it on the EDT. If you can ensure all calls of setBounds() occur on the EDT, then you shouldn't have to worry about setBounds() being executed while your SwingTimer is being executed because SwingTimers also execute on the EDT by default (so they won't execute at the same time). Also I never seen someone override setBounds() so I do wonder if there's not an alternative solution such as just querying the bounds every time your SwingTimer executes. Using a listener listening for window resizes like you say does sound much better.
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38718572
answers question: http://stackoverflow.com/q/24918931
type: Answer
accepted answer of: http://stackoverflow.com/q/24918931
downvote count: 0

http://stackoverflow.com/q/24975014
has comment: http://stackoverflow.com/comment/38832191
has comment: http://stackoverflow.com/comment/38830538
score: 2
type: AnsweredQuestion
tagged with: java
has title: Java UCanAccess doesn't detect all items
has comment: http://stackoverflow.com/comment/38830556
has answer: http://stackoverflow.com/a/24983702
type: Question
upvote count: 2
accepted answer: http://stackoverflow.com/a/24983702
has body: I have a problem. I use this query: SELECT prodeje.datum, prodeje.prodejce, prodeje.pocet, prodeje.cena, produkty.autor_music, produkty.autor_text, produkty.skladba, produkty.isrc, produkty.cd, produkty.ean FROM prodeje INNER JOIN produkty ON prodeje.id_produktu = produkty.id But it doesn't return all items. There should be 59 results but it skips (randomly) 9 results. When I tried the same query in Microsoft Access it worked...so I'm desperate. I am using UCanAccess JDBC driver.
answer count: 1
favorite count: 0
tagged with: sql
has comment: http://stackoverflow.com/comment/38823742
has comment: http://stackoverflow.com/comment/38825437
tagged with: ucanaccess
downvote count: 0

http://stackoverflow.com/q/25041263
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/25041918
tagged with: swing
tagged with: jtextfield
type: Question
score: 0
has body: I need to display text within a field I created in this program that is identified in the actionEvent, which is the RadioButton selection. I'm having a hard time getting the selection to display in the field. Please help? import javax.swing.*; import java.awt.*; import java.awt.event.*; public class JBasketball { public static void main(String args[]) { JFrame frame = new JFrame("JBasketball"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JTextField field = new JTextField(16); JPanel panel = new JPanel(new FlowLayout()); ButtonGroup group = new ButtonGroup(); JRadioButton sixers = new JRadioButton("Philadelphia 76ers"); JRadioButton raptors = new JRadioButton("Toronto Raptors"); JRadioButton lakers = new JRadioButton("Los Angeles Lakers"); JRadioButton sonics = new JRadioButton("Seattle Supersonics"); JRadioButton bullets = new JRadioButton("Baltimore Bullets"); ActionListener action = new ActionListener() { public void actionPerformed(ActionEvent actionEvent) { JRadioButton aButton = (JRadioButton) actionEvent.getSource(); String team = aButton.getText(); //This is where I need the field to display the team name field.setText(team); } }; panel.add(sixers); group.add(sixers); panel.add(raptors); group.add(raptors); panel.add(lakers); group.add(lakers); panel.add(sonics); group.add(sonics); panel.add(bullets); group.add(bullets); panel.add(field); sixers.addActionListener(action); raptors.addActionListener(action); lakers.addActionListener(action); sonics.addActionListener(action); bullets.addActionListener(action); field.addActionListener(action); frame.add(panel); frame.setSize(500, 130); frame.setVisible(true); frame.setLocationRelativeTo(null); } }
answer count: 1
tagged with: actionevent
accepted answer: http://stackoverflow.com/a/25041918
has title: Java: Display actionEvent in a field

http://stackoverflow.com/q/24983336
has comment: http://stackoverflow.com/comment/38839801
type: Question
tagged with: dynamic-programming
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/38866250
has answer: http://stackoverflow.com/a/25001745
has title: How to solve this program better
type: UnansweredQuestion
downvote count: 3
upvote count: 1
tagged with: recursion
tagged with: algorithm
has comment: http://stackoverflow.com/comment/38873250
score: -2
tagged with: java
has body: The following question was from a recent Programming Contest. GCD Game Life and death, win or lose - both have two sides to each other. And that's what Arjit and Chandu Don are fighting about. They are tired of gang-wars between each other, and thus decide to settle like men in a field, of Mathematics. But even while going to play the game of Mathematics, they have not given up on their tactics of hurting each other. So, Arjit carries a number of rubber bullets with himself, and Chandu Don carries b number of rubber bullets. Since, Little Chandu is a more dangerous gangster of the two, he decides to give the first chance to Arjit. The way they’re going to decide who wins the entire land of HEpur is by playing the age-old game of GCD-DCG. The first one to end up with only 1 bullet is going to lose. This is how the game progresses: 1. If GCD (a, b) is greater than 1, then, the player can: a.) Subtract 1 from opposite player’s bullets. **OR** b.) Divide the number of bullets of opposite player by GCD (a, b). 2. If GCD (a, b) is equal to 1, then, the player can: a.) Subtract 1 from the opposite player’s bullets. Note : Player can choose only one move out of two if GCD(A,B) &gt; 1 . The one who ends up with only one bullet loses the battle, and his life, and the land of HEpur. Determine who is going to rule, once and for all! Input: First line contains number of test cases T, next T lines contains two numbers A and B taken by Arjit and Chandu Don respectively. Output: Print the name of winner of the game in case of draw print Draw. Constraints 1 &lt;= T &lt;= 1000 1 &lt;= A &lt;= 1000 1 &lt;= B &lt;= 1000 Problem Statement Credit : Arjit Srivastava. Sample Input 4 2 1 3 4 5 5 1 1 Sample Output Arjit Chandu Don Arjit Draw I am adding my solution here: import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.StringTokenizer; public class TestClass { public static void main(String args[] ) throws Exception { BufferedReader br = new BufferedReader(ne…

http://stackoverflow.com/comment/38772780
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24947349
has text: Check my edited answer! It'll answer your query,READ THE EDITED SECTION below the web.xml file configuration.I hope you get it!

http://stackoverflow.com/q/25017551
accepted answer: http://stackoverflow.com/a/25103536
upvote count: 1
tagged with: silent-installer
favorite count: 0
has comment: http://stackoverflow.com/comment/38903628
has answer: http://stackoverflow.com/a/25103536
possible better answer: http://stackoverflow.com/a/25019317
has comment: http://stackoverflow.com/comment/38903791
has body: I want to install JDK Silently but want to install JRE on different path. I am using this command, which installs JDK on given path and JRE inside the same path. But I want to install JRE on different path, due to existing dependencies for diff path. CALL D:\Installer\JAVA7\jdk-7u55-windows-x64.exe /s ADDLOCAL="ToolsFeature" /INSTALLDIR="D:\Prereqs\Java-64\jdk" /L "C:\Users\Desktop\JAVA_64_SDK_INSTALL_Logs.txt" tried giving one more parameter /JREINSTALLDIR="D:\Prereqs\Java-64\jre" but installer uses it for jdk installation path. -Arun
has comment: http://stackoverflow.com/comment/80509382
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/25019317
has title: Installing JDK Silently but JRE on different path

http://stackoverflow.com/comment/38746802
comment on: http://stackoverflow.com/q/24933877
score: 2
has text: Are you sure that your user/password is correct? Have you tried getting those messages using desktop email client such as Thunderbird?
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24946987
answer count: 1
has body: Sample run: License Validator Enter a last name: ab bA Enter a last name: ab bA Enter year of birth: a12w Enter year of birth: 1979 Enter driver's license number: A123-4567-9801-23 Consistent My code is: import java.util.Scanner; public class five { private static String getLastName(Scanner sc) { System.out.println("License Validator"); System.out.print("enter last name: ab bA"); String lastname=sc.nextLine().trim(); if(lastname.length()==0) lastname=getLastName(sc); int numspaces=0; for(int i=0;i&lt;lastname.length();i++) { if(Character.isSpace(lastname.charAt(i))) { numspaces++; } else if(!Character.isLetter(lastname.charAt(i))) { lastname=getLastName(sc); } if(numspaces&gt;2) { lastname=getLastName(sc); } } return lastname; } private static boolean Character(char charAt) { return false; } public static String getYearOfBirth(Scanner sc) { System.out.print("Enter year of birth: 1979"); String year=sc.nextLine().trim(); if(year.length()==0) year=getYearOfBirth(sc); try { int yearint=Integer.parseInt(year); if(yearint&lt;1900||yearint&gt;1999) { year=getYearOfBirth(sc); } } catch(NumberFormatException e) { year=getYearOfBirth(sc); } return year; } public static String getlicensenumber(Scanner sc) { System.out.print("Enter driver's license number:"); String licencenum=sc.nextLine().trim(); if(licencenum.length()!=17||licencenum.length()==0) { licencenum=getlicensenumber(sc); } String arr[]=licencenum.split("-"); if(arr.length!=4) { licencenum=getlicensenumber(sc); } if(Character.isLetter(arr[0].charAt(0))) { if(Character.isLowerCase(arr[0].charAt(0))) { licencenum=getlicensenumber(sc); } } else { licencenum=getlicensenumber(sc); } try { Long.parseLong(arr[0].substring(1)+arr[1]+arr[2]+arr[3]); } catch(NumberFormatException e) { licencenum=getlicensenumber(sc); } return licencenum; } public static void main(String[] args) { Scanner sc=new Scanner(System.in); String lastname=getLastName(sc); String yearOfBirth=getYearOfBirth(sc); String licensenumber=getlicensenumber(sc…
score: 0
has title: Not printing out all of the statements written
has comment: http://stackoverflow.com/comment/38771186
type: UnansweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/24947020
type: Question

http://stackoverflow.com/comment/38765764
type: Comment
comment on: http://stackoverflow.com/a/24943355
type: AnswerComment
score: 0
has text: check if you can find `/etc/default/tomcat7` file and try changing the user settings to `TOMCAT7_USER=ubuntu` and `TOMCAT7_GROUP=ubuntu`

http://stackoverflow.com/comment/38923542
comment on: http://stackoverflow.com/q/25027946
score: 0
type: Comment
type: QuestionComment
has text: @cabellicar123: I know that ValueOf doesn't work. That was just my attempt.

http://stackoverflow.com/a/24977385
type: Answer
answers question: http://stackoverflow.com/q/24977375
has comment: http://stackoverflow.com/comment/38827873
has body: Yours is a Swing threading issue. All server communication should be done on a background thread, and all JTextArea text updates should be done on the Swing event thread. Use a SwingWorker, especially its publish/process method pairs to update your JTextArea (would a JList be better?), and your code should work a lot better.
score: 4
upvote count: 4
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24977375

http://stackoverflow.com/q/24932854
tagged with: utf-8
has body: When I send mail with following code in attachment instead of EURO symbol I am getting some weird character like this "â‚¬;". I already set the content type of message as UTF-8 as well for OutputStreamWriter as well. What could be the reason for this? public static void sendMail(String email, String password, String sendTo, String subject, String msg) { Properties props = new Properties(); props.put("mail.smtp.host", "smtp.gmail.com"); props.put("mail.smtp.socketFactory.port", "465"); props.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory"); props.put("mail.smtp.auth", "true"); props.put("mail.smtp.port", "465"); final String fEMail = email; final String fPassword = password; Session session = Session.getDefaultInstance(props, new javax.mail.Authenticator() { protected PasswordAuthentication getPasswordAuthentication() { return new PasswordAuthentication(fEMail, fPassword); } }); try { Message message = new MimeMessage(session); message.setFrom(new InternetAddress(email)); message.setRecipients(Message.RecipientType.TO, InternetAddress.parse("to mail address")); message.setSubject(subject); message.setContent("Hi", "text/plain; charset=UTF-8"); File file = File.createTempFile("test", ".csv"); FileOutputStream fileOutputStream = new FileOutputStream(file); OutputStreamWriter outputStreamWriter = new OutputStreamWriter(fileOutputStream, Charset.forName("UTF-8").newEncoder()); PrintWriter writer = new PrintWriter(outputStreamWriter); writer.println("\u20ac;"); writer.println("€"); writer.flush(); MimeMultipart rootMultipart = new MimeMultipart("mixed"); MimeBodyPart bodyPart = new MimeBodyPart(); bodyPart.setDisposition(Part.ATTACHMENT); bodyPart.setDataHandler(new DataHandler(new FileDataSource(file))); bodyPart.setFileName(file.getName()); rootMultipart.addBodyPart(bodyPart); message.setContent(rootMultipart); Transport.send(message); writer.close(); file.delete(); System.out.println("Message sent successfully!"); } catch (MessagingException e) { …
has title: Weird euro symbol in java mail attachment
type: UnansweredQuestion
score: 0
tagged with: java
type: Question
tagged with: encoding
has answer: http://stackoverflow.com/a/24944017
tagged with: jakarta-mail
answer count: 1

string
tags question: http://stackoverflow.com/q/24939969
tags question: http://stackoverflow.com/q/25011735
tags question: http://stackoverflow.com/q/24979926
tags question: http://stackoverflow.com/q/25002776
tags question: http://stackoverflow.com/q/25003550
tags question: http://stackoverflow.com/q/25056701
tags question: http://stackoverflow.com/q/24932499
tags question: http://stackoverflow.com/q/24981684
tags question: http://stackoverflow.com/q/24986640
tags question: http://stackoverflow.com/q/24938546
tags question: http://stackoverflow.com/q/24910262
tags question: http://stackoverflow.com/q/24996627
tags question: http://stackoverflow.com/q/24991444
tags question: http://stackoverflow.com/q/25041781
tags question: http://stackoverflow.com/q/25038547
tags question: http://stackoverflow.com/q/24990270
tags question: http://stackoverflow.com/q/25025593
tags question: http://stackoverflow.com/q/24959324
tags question: http://stackoverflow.com/q/24940454
tags question: http://stackoverflow.com/q/24946387
tags question: http://stackoverflow.com/q/25041944
tags question: http://stackoverflow.com/q/25051554
tags question: http://stackoverflow.com/q/24973278
tags question: http://stackoverflow.com/q/24995868
tags question: http://stackoverflow.com/q/24928124
tags question: http://stackoverflow.com/q/25058152
tags question: http://stackoverflow.com/q/24919181
tags question: http://stackoverflow.com/q/25028381
tags question: http://stackoverflow.com/q/24997406
tags question: http://stackoverflow.com/q/25028249
tags question: http://stackoverflow.com/q/24961701
tags question: http://stackoverflow.com/q/25055659
tags question: http://stackoverflow.com/q/25050735
tag name: string
tags question: http://stackoverflow.com/q/25024444
tags question: http://stackoverflow.com/q/25054866
tags question: http://stackoverflow.com/q/25055797
tags question: http://stackoverflow.com/q/25056661
tags question: http://stackoverflow.com/q/25039827
type: Tag
tags question: http://stackoverflow.com/q/24938504
tags question: http://stackoverflow.com/q/25006359
tags question: http://stackoverflow.com/q/25049170
tags question: http://stackoverflow.com/q/25067808
tags question: http://stackoverflow.com/q/24913072
tags question: http://stackoverflow.com/q/24968438
tags question: http://stackoverflow.com/q/24985385
tags question: http://stackoverflow.com/q/24955479
tags question: http://stackoverflow.com/q/24967089
tags question: http://stackoverflow.com/q/25043428
tags question: http://stackoverflow.com/q/25049584
tags question: http://stackoverflow.com/q/24989645
tags question: http://stackoverflow.com/q/24986101
tags question: http://stackoverflow.com/q/24995141
tags question: http://stackoverflow.com/q/25036297
tags question: http://stackoverflow.com/q/24983887
tags question: http://stackoverflow.com/q/24964794
tags question: http://stackoverflow.com/q/24910537
tags question: http://stackoverflow.com/q/25058405
tags question: http://stackoverflow.com/q/25068425
tags question: http://stackoverflow.com/q/24922854
tags question: http://stackoverflow.com/q/25025347
tags question: http://stackoverflow.com/q/25007932
tags question: http://stackoverflow.com/q/25028146
tags question: http://stackoverflow.com/q/25025259
tags question: http://stackoverflow.com/q/25050670
tags question: http://stackoverflow.com/q/24941606
tags question: http://stackoverflow.com/q/24983983
tags question: http://stackoverflow.com/q/25056607
tags question: http://stackoverflow.com/q/24939213
tags question: http://stackoverflow.com/q/24950586
tags question: http://stackoverflow.com/q/24918293
tags question: http://stackoverflow.com/q/25036532
tags question: http://stackoverflow.com/q/25009738
tags question: http://stackoverflow.com/q/24915256
tags question: http://stackoverflow.com/q/24997687
tags question: http://stackoverflow.com/q/24922011
tags question: http://stackoverflow.com/q/24946454
tags question: http://stackoverflow.com/q/24933319
tags question: http://stackoverflow.com/q/24936699

http://stackoverflow.com/q/24954978
tagged with: exec
favorite count: 0
type: UnansweredQuestion
has body: import java.io.*; import java.util.Scanner; public class runtime { public static void main ( String [] args) { try { Process proc= Runtime.getRuntime().exec("bash -c " + "./a.out" ); BufferedReader stdInput = new BufferedReader(new InputStreamReader(proc.getInputStream())); BufferedWriter stdOutput = new BufferedWriter(new OutputStreamWriter(proc.getOutputStream())); String s = ""; BufferedReader reader = new BufferedReader((new InputStreamReader(System.in))); String sendMemo = reader.readLine(); stdOutput.write(sendMemo+"\n"); stdOutput.flush(); while ((s = stdInput.readLine()) != null) { System.out.println(s); } } catch( IOException e ) { System.out.println ( e )}; } } C code #include&lt;stdio.h&gt; int main() { int a; printf("InPUt : \n"); scanf("%d",&amp;a); printf("std : %d",a); } I want to execute C Program In JAVA. I think to use this shell Command from JAVA: runtime.getRuntime().exec So i want result this: print :: Input : &lt;-value input 5 print ::std : 5 but my code is value input 5 print :: Input : print :: std : 5 help me please
tagged with: java
tagged with: output
downvote count: 1
has title: C Program at runtime to execute the shell with respect to the input and output In JAVA
type: Question
tagged with: runtime
score: -1
tagged with: http://stackoverflow.com/tag/c
has answer: http://stackoverflow.com/a/24955628
has comment: http://stackoverflow.com/comment/38785749
upvote count: 0
answer count: 1

http://stackoverflow.com/q/24955979
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/25007030
has title: Bulk Pre-Caching using MyBatis
type: UnansweredQuestion
tagged with: java
type: Question
has body: I am using version 3.2.7 of MyBatis and what I want to do is be able to pre-fill the cache before the application is used, so on start-up. So say in the actual application, I want to search for a specific users info: &lt;select id="selectSpecificUser" parameterType="int"&gt; SELECT * FROM users WHERE userid=#{id} &lt;/select&gt; So when this is called, it will check the cache, if it's not there, then it will search the DB. Is there a way to pre-load this cache with every record from this table so that when this method is called, it picks it up from cache rather than the DB?
tagged with: mybatis
tagged with: caching

http://stackoverflow.com/q/24996686
tagged with: java
has body: So I want a whileloop that runs every second but appearently using Thread.sleep(1000); , doesn't work as it makes the app freeze and crash with this error : 07-28 15:03:17.641: A/libc(5792): Fatal signal 6 (SIGABRT) at 0x00000280 (code=0), thread 5792 () So im guessing The loop im using isnt safe enough and uses too much resources the loop is running in a service and is initzalated by a actionbutton :) while(buttonpressed != false); try { writer = new FileWriter(timedata); writer.append(TIME); writer.flush(); writer.close(); Thread.sleep(1000); }
has answer: http://stackoverflow.com/a/24996741
has answer: http://stackoverflow.com/a/24997553
type: Question
answer count: 3
has comment: http://stackoverflow.com/comment/38863853
tagged with: android
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38865087
has comment: http://stackoverflow.com/comment/38864840
has answer: http://stackoverflow.com/a/24996835
has title: Safe Whileloop that runs every second
linked to: http://stackoverflow.com/q/21974587
score: 0

http://stackoverflow.com/a/25007018
type: AcceptedAnswer
downvote count: 0
has body: Some issues: When you do table.setAutoCreateRowSorter(true); it replaces the RowSorter you just created with a default one. Remove that line. + is a special character in a regular expression. Specifically it's a quantifier that means to match 1 or more of the preceding token. Since there is no preceding token, the regex pattern is invalid. If you weren't suppressing the PatternSyntaxException it would tell you that. To match a literal + in a regular expression, escape it with a backslash: \+. To encode a backslash in a string literal in Java source code, escape it with another backslash. I.e., change newFilter("+"); to newFilter("\\+");. Also, remove the try-catch for the PatternSyntaxException. The subsequent parameters to RowFilter.regexFilter are the indices of the columns it should perform filtering on. You've told it to perform filtering only using column 0, but I'm not sure that's the right column in your data, so that might need to be changed. If you want to perform filtering on all columns, just leave that blank. I.e., f = RowFilter.regexFilter(filter);. A RowFilter says which rows to include, but it sounds like you want to exclude the ones containing + (maybe?). You can use RowFilter.notFilter to invert the meaning if needed. I.e., rf = RowFilter.notFilter(RowFilter.regexFilter(filter));. The code to insert under //Show all the rows again would be sorter.setRowFilter(null);. That should get it working. However, if for neatness, you'd prefer not have the column with the +/- signs displayed, you could remove that column from your table, and create a custom implementation of RowFilter that operates on the data in the model directly, that tests whether the values are in or out of range on the fly. I don't know what your data looks like so this is a toy example: sorter.setRowFilter(new RowFilter&lt;TableModel,Integer&gt;() { @Override public boolean include(RowFilter.Entry&lt;? extends TableModel,? extends Integer&gt; row) { // only include rows that have a cat …
type: Answer
answers question: http://stackoverflow.com/q/25005302
upvote count: 3
accepted answer of: http://stackoverflow.com/q/25005302
has comment: http://stackoverflow.com/comment/38892116
score: 3
has comment: http://stackoverflow.com/comment/38892069
has comment: http://stackoverflow.com/comment/38891498

openal
type: Tag
tags question: http://stackoverflow.com/q/24977882
tags question: http://stackoverflow.com/q/24986843
tags question: http://stackoverflow.com/q/25028058
tag name: openal

http://stackoverflow.com/comment/38745191
has text: You tried manually adding the variable to R? R is autogenerated and all manual modifications are wiped at build time. Try adding to the XMLs that hold your variables (general advice).
type: Comment
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/24933421

http://stackoverflow.com/q/24936150
has comment: http://stackoverflow.com/comment/38750928
has comment: http://stackoverflow.com/comment/38750391
tagged with: java
type: Question
has body: I want to write a generic builder class which wraps around any java class and providing setter functions of a specific style. I am not sure if this could be called "dynamically generated functions". When I have a beanish Pojo class i.e. class Pojo { public void setValue(int value) {...} public void setName(String name) {...} } My Maker class should be usable like this: Pojo p = Builder&lt;Pojo&gt;.create(new Pojo()) .setName("Funny") .setValue(123) .build(); As you can see, the work it does should be similar to class PojoBuilder { private Pojo pojo; PojoBuilder(Pojo pojo) { this.pojo = pojo; } public static PojoMaker create(Pojo p) { return new PojoBuilder(p); } public PojoBuilder setName(String name) { pojo.setName(name); return this; } public PojoBuilder setValue(int val) { pojo.setValue(val); return this; } public Pojo make() { return pojo; } } Only, I would like Maker to be generic. Obviously, the "setXyz"-Methods depend on the generic argument. How to do that? Of course, functionally equivalent but syntactically different approach is also fine. I'd like to do it without annotations: With annotations I gather I'd need a second javac-pass over my source code, generating the wrapper code. That seems to be what Limbok does or how some JPA wrappers work. But when I work with Mockito it seems that this pass is not necessary. So, How can I do it with Generics?
score: 32
has answer: http://stackoverflow.com/a/67333702
tagged with: factory-pattern
answer count: 2
has comment: http://stackoverflow.com/comment/38750836
tagged with: wrapper
has comment: http://stackoverflow.com/comment/38751431
downvote count: 0
has answer: http://stackoverflow.com/a/24939058
linked to: http://stackoverflow.com/q/17317010
tagged with: generics
has title: How to implement a builder class using Generics, not annotations?
favorite count: 0
type: UnansweredQuestion
upvote count: 32
has comment: http://stackoverflow.com/comment/38750373

http://stackoverflow.com/a/25005501
score: 1
has body: You can utilize publisher listener pattern (code) import java.util.LinkedList; import java.util.List; import java.util.Random; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JTextArea; import javax.swing.SwingUtilities; public class PublisherListenerSignalExample { private interface Listener { void onEventRecieved(Event e); } private static class Event { private double distance; private double atten; public Event(double distance, double atten) { this.distance = distance; this.atten = atten; } public double getDistance() { return distance; } public double getAtten() { return atten; } } private static class GUI { public static double d; } private static class Mover { public static double instantDistance(double animpos) { return 0; } } private static double distance, animpos; private static List&lt;Listener&gt; listeners = new LinkedList&lt;&gt;(); private static void fire(Event event) { for(Listener l : listeners) { l.onEventRecieved(event); } } public static void addListener(Listener l) { listeners.add(l); } public static double calculateSignal(double d, double f) { GUI.d = Mover.instantDistance(animpos); // needs to be displayed double atten = 20 * (Math.log10(d)) + 20 * (Math.log10(f)) + 32.44; // would // also // like // to // display // this fire(new Event(d, atten)); return atten; } public static void main(String[] args) { addListener(new Listener() { @Override public void onEventRecieved(Event e) { System.out.println(String.format("distance=%f atten=%f", e.getDistance(), e.getAtten())); } }); final JTextArea textArea_3 = new JTextArea(); textArea_3.setEditable(false); textArea_3.setBounds(147, 481, 215, 32); final JTextArea textArea_4 = new JTextArea(); textArea_4.setEditable(false); textArea_4.setBounds(147, 527, 215, 27); addListener(new Listener() { @Override public void onEventRecieved(final Event e) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { textArea_3.setText(""+e.getDistance()); //would have to b…
downvote count: 0
answers question: http://stackoverflow.com/q/25004779
type: Answer
upvote count: 1

http://stackoverflow.com/comment/38864749
comment on: http://stackoverflow.com/q/24996791
type: Comment
type: QuestionComment
has text: the end of your query is `like%car wash%` there is clearly something wrong with it. it should be, at least `like '%car wash%'` (not the quotes and the space) or `like '%' || 'car wash' || '%'` which is a form that allows parametrization.
score: 0

http://stackoverflow.com/comment/38772172
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24944356
type: Comment
has text: His is definitely easier, but if you have multiple times you have to write a wrapper, simpler just to write it once.

http://stackoverflow.com/comment/38753617
score: 1
has text: If you're getting `List<Class<T>>` then how do you anticipate getting the _values_ within the instances of type `T`? It's easy to loop across a list of `Class`es and instantiate them (`type.newInstance();`), but I think you need to look at this differently. You need to get the actual instances with their values rather than types that need to be filled in. Having just the class suggests you aren't getting the right thing to begin with.
comment on: http://stackoverflow.com/q/24918525
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24944603
has comment: http://stackoverflow.com/comment/38795922
has comment: http://stackoverflow.com/comment/38768180
has body: First of all, you will have to decide how to handle the fact that you don't know the number of lines at start. You could: Count lines in first go to create result array of desired size, then read your file again and fill that array with data. Store your lines inside a List instead. (i will choose 2) Second, what characters you want to allow inside your strings? for example " or \n (newline) can make things more complicated since you would have to escape them, but let's assume that these characters will be banned (and also ,, so we can split more easily) Scanner in = new Scanner(new File("strings.test")); List&lt;String[]&gt; lines = new ArrayList&lt;&gt;(); while(in.hasNextLine()) { String line = in.nextLine().trim(); String[] splitted = line.split(", "); for(int i = 0; i&lt;splitted.length; i++) { //get rid of additional " at start and end splitted[i] = splitted[i].substring(1, splitted[i].length()-1); } lines.add(splitted); } //pretty much done, now convert List&lt;String[]&gt; to String[][] String[][] result = new String[lines.size()][]; for(int i = 0; i&lt;result.length; i++) { result[i] = lines.get(i); } System.out.println(Arrays.deepToString(result)); Output: [[dog, runs, fast], [birds, flies, high], [baby, cries, often, in the evening], [He, works]] If you need any of those characted that i "threw away", let me know in comment and i'll edit this answer.
upvote count: 1
accepted answer of: http://stackoverflow.com/q/24924937
score: 1
answers question: http://stackoverflow.com/q/24924937
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/q/25007997
tagged with: ant-contrib
type: Question
tagged with: mapped-drive
tagged with: vpn
has body: I have the following part in one of my build xmls. - called "common.xml" This comes from the common library in the company, so many projects share this same construct. &lt;target name="init.compile.copy.sources"&gt; &lt;if&gt; &lt;isreference refid="compile.copy.sources"/&gt; &lt;then&gt; &lt;property name="compile.copy.sources" value="1"/&gt; &lt;/then&gt; &lt;/if&gt; &lt;/target&gt; And my build scripts with ant look just fine when on the PC in the office. The particular project is named "eMyproj", and sits in a directory c:\developer\projects\myProject. Again it works fine when in the office. From home, I am connected with VPN and mapped my home drive (B:) to the network folder from my office PC. And the build script do not work. SOme other script do work, so my ant ant java home at home PC are set correctly, however in one of the scripts I get this error: B:\eMyproj\trunk\.buildsys\common.xml:63: Problem: failed to create task or type if Cause: The name is undefined. Can anyone tell what is the problem? I am not to change anything in the build scripts, since it is working while on the office PC. However, when on network mapped drive, it fails. Must be the path somewhere.. but I looked at all I can imagine.
tagged with: ant
tagged with: java
has comment: http://stackoverflow.com/comment/38945456
score: 0
has comment: http://stackoverflow.com/comment/38914584
has title: ant build fails when on mapped drive with VPN connection
has comment: http://stackoverflow.com/comment/38888911
type: UnansweredQuestion
answer count: 0

http://stackoverflow.com/comment/38895815
type: AnswerComment
has text: I've edited my initial question - and I was able to solve the problem in the meantime. Thanks for guiding me!
type: Comment
comment on: http://stackoverflow.com/a/25010064
score: 0

http://stackoverflow.com/comment/38953524
comment on: http://stackoverflow.com/q/25043410
type: Comment
type: QuestionComment
has text: You should start to use the debugger more often. But since your questions are pretty self-contained I could use the debugger for you ;)
score: 0

http://stackoverflow.com/comment/38750028
comment on: http://stackoverflow.com/a/24923217
score: 0
type: Comment
has text: @1337 I could yes, but if i wanted to do something "rough and fast" I could have done already so, unfortunately I'm trying to be sorta off a perfectionist on this project.
type: AnswerComment

http://stackoverflow.com/comment/38813298
type: AnswerComment
score: 0
has text: @EJP I have been able to read things from there at runtime but I guess it's only because the compiler copies those file somewhere into the Jar or something like that... Is it possible to have a directory which can be guaranteed to stay relative to the the DIST so that i can both read and write from it at runtime??
type: Comment
comment on: http://stackoverflow.com/a/24969623

http://stackoverflow.com/q/24983989
score: 0
answer count: 1
tagged with: textview
tagged with: timer
type: UnansweredQuestion
tagged with: countdowntimer
tagged with: android
has title: Getting value from 3 Textviews and converting to int for Countdown Timer
has answer: http://stackoverflow.com/a/24984107
tagged with: java
type: Question
has body: Currently I have three textviews which I am using for the countdown timer in my android app in HH:MM:SS. (hours, minutes and seconds). I am allowing the user to set the textviews to a specific number for the time. I am then trying to get the value from the textviews by converting to int and then using the integer values as the seconds for the countdown timer. But the problem is that there is no values for the ints, and therefore the timer cannot start. As the user drags around the scrubber he can change the textview value for hours, minutes, or seconds: Here is the code for that below in my onCreate method: @Override public void onProgressChanged(SeekArc seekArc, int progress, boolean fromUser) { int progress_count = 0; for (int i=0;i&lt;24;i=i+1) { if (progress ==120) { mSeekArcProgress.setText("24"); } else if (progress == progress_count) { mSeekArcProgress.setText(String.valueOf(String.format("%02d",i))); } progress_count = progress_count + 5; } } }); } else if (v.getId() == R.id.minutetext) { //corresponding button logic should below here mSeekArc.setOnSeekArcChangeListener(new SeekArc.OnSeekArcChangeListener() { @Override public void onStopTrackingTouch(SeekArc seekArc) { } @Override public void onStartTrackingTouch(SeekArc seekArc) { } //This sets the actual string for the minutes @Override public void onProgressChanged(SeekArc seekArc, int progress, boolean fromUser) { int progress_count = 0; for (int i=0;i&lt;120;i++) { if (progress ==120) { mSeekArcMinuteProgress.setText("00"); } else if (progress == progress_count) { mSeekArcMinuteProgress.setText(String.valueOf(String.format("%02d",i))); } progress_count = progress_count + 2; } } }); } else if (v.getId() == R.id.secondtext) { //corresponding button logic should below here mSeekArc.setOnSeekArcChangeListener(new SeekArc.OnSeekArcChangeListener() { @Override public void onStopTrackingTouch(SeekArc seekArc) { } @Override public void onStartTrackingTouch(SeekArc seekArc) { } //This sets the actual string for …

http://stackoverflow.com/q/24912785
downvote count: 0
tagged with: listiterator
favorite count: 0
possible better answer: http://stackoverflow.com/a/24913002
answer count: 3
has title: ListIterator.next() returns null
accepted answer: http://stackoverflow.com/a/24912883
has answer: http://stackoverflow.com/a/24912934
type: AnsweredQuestion
tagged with: java
score: 4
has answer: http://stackoverflow.com/a/24912883
type: Question
upvote count: 4
tagged with: iterator
has body: my question is really, really simple, but everything I find online tells me I am doing it the right way - but I obviously misunderstood something. I have a simple, simple Java ListIterator, which in a while-hasNext()-loop returns a null for next(). Here's the code with my comments on the debug state: [...] ListIterator&lt;Role&gt; rolesIterator = currentUser.getRoles().listIterator(); // rolesIterator is now: java.util.ArrayList$ListItr while( rolesIterator.hasNext() ) { Role roleObject = rolesIterator.next(); // extra step for debugging reasons String role = roleObject.getName(); // NullPointerException - roleObject is null [...] In my thoughts, the loop should not be entered, if there is no next() object - that's why I check using hasNext(). What did I understand wrong, and what is the correct way?
has answer: http://stackoverflow.com/a/24913002

http://stackoverflow.com/comment/38907726
comment on: http://stackoverflow.com/a/25012345
type: Comment
has text: It appears that with default logger configuration `SpringApplication` class is the first one to catch and log the exception `o.s.boot.SpringApplication : Application startup failed` with a long stack trace. So disabling `o.s.boot` loggers should allow to keep the log clean while logging a brief message in the try/catch block around `SpringApplication.run()`.
score: 0
type: AnswerComment

http://stackoverflow.com/a/24914973
has comment: http://stackoverflow.com/comment/38710509
has body: One of the values you are getting is set as null. Edit: MY fault, I believe that it is the Car that is null. You should check if there are any values set as null by: if(car == null) { //and etc for other get method. //Use Logs here to print error on logcat. } This should help identifying which value is null. Info on Logs: http://developer.android.com/reference/android/util/Log.html
type: Answer
score: 2
answers question: http://stackoverflow.com/q/24914624
upvote count: 2
has comment: http://stackoverflow.com/comment/38711085
downvote count: 0

http://stackoverflow.com/a/24956462
score: 0
has comment: http://stackoverflow.com/comment/38974918
has comment: http://stackoverflow.com/comment/38943198
type: Answer
answers question: http://stackoverflow.com/q/24953980
has comment: http://stackoverflow.com/comment/38937186
has body: SessionFactory object is thread safe, and it manages L2 cache, that's why you can assume that all L2 cache is thread safe. This technique is called instance confinement, you assume that only SessionFactory object instance will operate on L2 cache. With L1 cache you have make sure that you manage your Session object properly and you not publish it anywhere, as it's not thread safe.

http://stackoverflow.com/comment/39022143
comment on: http://stackoverflow.com/a/25051772
has text: @johnstlr Is it really the way Netty should be used?
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/24967830
has comment: http://stackoverflow.com/comment/38809999
has comment: http://stackoverflow.com/comment/38809893
answer count: 1
tagged with: java
tagged with: mysql
type: UnansweredQuestion
has title: how to delete a row with auto increment as primary key in netbeans
linked to: http://stackoverflow.com/q/9343470
has body: I am a newbie to java and I am using netbeans I want to delete a row from my database (mysql) by clicking on the row in a table during run time and click button delete but I used auto increment for the primary key of the row I do not know how to specify the primary key column these are not working for me delete from admin where adminID = default delete from admin where adminID = adminID
type: Question
has comment: http://stackoverflow.com/comment/38809883
tagged with: sql
has answer: http://stackoverflow.com/a/24968444
score: 0

http://stackoverflow.com/q/24929092
has body: I tried to make a console chat server. the main problem i am facing is that i can not send the message to the server.. as you can see in the img i uploaded that the server and the client are connected. but when i type anything in the client side. The client becomes unresponsive and i have to close the cmd prompt. How can i fix this? Is something wrong with my computer or is the code wrong? public class MyClient { Socket s ; DataInputStream din ; DataOutputStream dout; public MyClient() { try { s= new Socket("localhost",10); System.out.println(s); din = new DataInputStream(s.getInputStream()); dout= new DataOutputStream(s.getOutputStream()); ClientChat(); } catch(Exception e) { System.err.println(e); } } public void ClientChat() throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); //Scanner s2 = new Scanner(System.in); String s1; System.out.println("start the conversation"); do { s1=br.readLine(); //s1=s2.nextLine(); dout.flush(); System.out.println("server:"+din.readUTF()); } while(!s1.equals("stop")); } public static void main (String args[]) { new MyClient(); } }
type: Question
has answer: http://stackoverflow.com/a/24969809
has title: Client connects but cant send message to the server.[Console Chat]
tagged with: network-programming
has answer: http://stackoverflow.com/a/24977237
tagged with: chat
possible better answer: http://stackoverflow.com/a/24977237
has comment: http://stackoverflow.com/comment/38813031
answer count: 3
upvote count: 1
has comment: http://stackoverflow.com/comment/38812846
favorite count: 0
linked to: http://stackoverflow.com/q/10816541
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24929201
accepted answer: http://stackoverflow.com/a/24929201
downvote count: 0
score: 1
tagged with: java

http://stackoverflow.com/q/24948882
tagged with: spring
tagged with: spring-mvc
has answer: http://stackoverflow.com/a/47901961
type: Question
has comment: http://stackoverflow.com/comment/38776251
tagged with: java
score: 0
has body: i am curious about the security parts of java spring. I have taken a snippet from this website teaching on how to do a login system using database. However, i am concerned about certain parts regarding the security issues. Spring Security Login Form (Database Authentication) Login with Username and Password <c:if test="${not empty error}"> ${error} </c:if> <c:if test="${not empty msg}"> ${msg} </c:if> <form name='loginForm' action="<c:url value='/j_spring_security_check' />" method='POST'> User: Password: As this form will be deployed on a server, and users will log in from their PC. However, this would mean that the data would not be encrypted. Pardon my weak explanation of my problem as i am still new to this java spring environment. I am concerned about the sending of data from the user PC to the server for authentication in the database. http://www.mkyong.com/spring-security/spring-security-form-login-using-database/ Is there anyway to encrypt the packets from the user PC to the server or would this be handled by tomcat servers?
answer count: 1
tagged with: spring-security
tagged with: security
has title: Security issues in java spring
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38774965

http://stackoverflow.com/comment/38853613
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24990326
type: AnswerComment
has text: @TheLostMind after reading dantemple comment only I also recognize my mistake.. and thanks for your answer :)

http://stackoverflow.com/comment/38939289
type: AnswerComment
has text: Yeah but I am getting failed to read row 0, column 2, from Cursor Windows which has 4 rows , 2 columns. Can you help me check my edited portion?
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25036654

http://stackoverflow.com/comment/38709324
type: AnswerComment
has text: The semi-colon is not *wrong* it's translated to `if(x == 1) { }`.. It shouldn't be here in this case, but saying it's wrong might confuse OP.
comment on: http://stackoverflow.com/a/24914362
type: Comment
score: 0

http://stackoverflow.com/comment/38758378
type: Comment
comment on: http://stackoverflow.com/q/24940205
has text: Are you talking about `CheckBoxes`,`radioButtons`,`MouseFocusEvent`???
score: 0
type: QuestionComment

http://stackoverflow.com/q/25020426
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/38909861
type: Question
possible better answer: http://stackoverflow.com/a/25020597
has answer: http://stackoverflow.com/a/25020597
has answer: http://stackoverflow.com/a/25020528
tagged with: bufferedinputstream
tagged with: inputstream
answer count: 2
accepted answer: http://stackoverflow.com/a/25020528
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/38909030
has body: The problem, I think, is that the file is in the jar, which seems to make it a bit harder. I don't understand how to instantiate an InputStreamReader when reading from a local file (inside the jar) as below: package net.bounceme.dur.client; import java.io.BufferedInputStream; import java.io.IOException; import java.io.InputStreamReader; import java.util.logging.Level; import java.util.logging.Logger; public class Template { private static final Logger log = Logger.getLogger(Template.class.getName()); StringBuffer buffer = new StringBuffer(); public Template() { } public String getTemplate() { return buffer.toString(); } public void load() { // try (BufferedInputStream input = new BufferedInputStream(getClass().getClassLoader().getResourceAsStream("template.txt"))) { try (BufferedInputStream input = new BufferedInputStream(new InputStreamReader(getClass().getClassLoader().getResourceAsStream("template.txt")),"UTF-8")) { int data = input.read(); while (data != -1) { buffer.append((char) data); data = input.read(); } } catch (IOException ex) { Logger.getLogger(Template.class.getName()).log(Level.SEVERE, null, ex); } } } compile error (bad syntax): -do-compile: [mkdir] Created dir: /home/thufir/NetBeansProjects/Mail/build/empty [mkdir] Created dir: /home/thufir/NetBeansProjects/Mail/build/generated-sources/ap-source-output [javac] Compiling 14 source files to /home/thufir/NetBeansProjects/Mail/build/classes [javac] /home/thufir/NetBeansProjects/Mail/src/net/bounceme/dur/client/Template.java:23: error: no suitable constructor found for BufferedInputStream(InputStreamReader,String) [javac] try (BufferedInputStream input = new BufferedInputStream(new InputStreamReader(getClass().getClassLoader().getResourceAsStream("template.txt")),"UTF-8")) { [javac] ^ [javac] constructor BufferedInputStream.BufferedInputStream(InputStream,int) is not applicable [javac] (actual argument InputStreamReader cannot be converted to InputStream by method invocation conversion) [javac] construct…
tagged with: io
tagged with: utf-8
has title: how to read a .txt file with BufferedInputStreamReader

http://stackoverflow.com/comment/38826331
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24976319
has text: If you need to do that quick and dirty, wouldn't it be simple just to replace the '[' and ']' for '<'and '>', and the use any xml parser?

http://stackoverflow.com/comment/38802732
comment on: http://stackoverflow.com/a/24956409
score: 0
type: AnswerComment
type: Comment
has text: I edited it, in case someone needs the information in the future.

http://stackoverflow.com/comment/38773152
score: 1
has text: Alternative you can also add a StringEncoder to the ChannelPipeline that will handle the encoding from String -> ByteBuf for you.
comment on: http://stackoverflow.com/a/24942917
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/39003234
comment on: http://stackoverflow.com/q/25049193
has text: I thought there might be some misaligned blocks due to round-off errors, but seems like it's not the case. But I still want to check if using `round()` change anything.
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/38957060
type: AnswerComment
has text: nah..it goes all the way to the end. not to the right index location
comment on: http://stackoverflow.com/a/25045633
type: Comment
score: 0

http://stackoverflow.com/q/24993892
has title: A button to count the number of times it has been clicked in one minute
has body: Hey i am trying to build a program using swing. I have created a button and I want to count the number of times it is clicked in one minute.But the problem is that once I press said button it does not get released and the counter keeps on increasing on its own. Code: while ((System.currentTimeMillis()-startTime)&lt; 1*60*1000) { if(eee.getSource()==b) { counter++; } System.out.println(counter); }
has comment: http://stackoverflow.com/comment/38858591
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38858537
has answer: http://stackoverflow.com/a/24994114
tagged with: swing
tagged with: java
has comment: http://stackoverflow.com/comment/38858546
type: Question
has comment: http://stackoverflow.com/comment/38858524
answer count: 1
score: 0

http://stackoverflow.com/comment/38747189
score: 0
type: Comment
type: AnswerComment
has text: Have a look at the fiddle example, if someone happens to be called 'NULL' it correctly identifies him - also NULL and 'SMITH' ...
comment on: http://stackoverflow.com/a/24934055

http://stackoverflow.com/a/25013873
answers question: http://stackoverflow.com/q/24998654
type: AcceptedAnswer
upvote count: 5
type: Answer
has comment: http://stackoverflow.com/comment/38909058
downvote count: 0
has body: play.mvc.Result is just a wrapper for play.mvc.api.Result so after all you will need to work with it. public static Result batch() { try { Result result = delete(1L); play.api.mvc.SimpleResult res = Await.result(result.getWrappedResult(), Duration.Inf()); int status = res.header().status(); //handle status } catch (Exception e) { //handle exception } } Await and Duration are Scala classes import scala.concurrent.Await; import scala.concurrent.duration.Duration;
accepted answer of: http://stackoverflow.com/q/24998654
score: 5

http://stackoverflow.com/q/25065419
has body: Let’s consider a simple class Action which is meant to traverse multiple stages, a pre-defined order of states, until reaching the last stage. The stages should be represented by subclasses of a common class Stage and encapsulate code for the Action class to be executed when a method proceed() is called. This method also returns the next stage. I hope this is a reasonable design, as I consider it to be cleaner than having an enum with state constants and a proceed() with switch-case. It can be implemented simply with inner classes: public class Action { private int m; private Stage stage; public Action() { stage = new FirstStage(); } public void proceed() { if (stage != null) { stage = stage.proceed(); } } public interface Stage { /** * Executes current stage and returns next stage. * * @return */ Stage proceed(); } public class FirstStage implements Stage { @Override public Stage proceed() { m = 100; return new SecondStage(); } } public class SecondStage implements Stage { @Override public Stage proceed() { //do something return null; // last stage } } } But I am annoyed by all the Stage subclasses residing loosely in the Action class though they belong together. To solve this and to get a convenient namespacing, it would be useful to implement the stage classes as inner classes of Stage. So we would write Stage.First instead of FirstStage which I consider to be clearer. public class ActionB { private int m; private Stage stage; public ActionB() { stage = new Stage.First(); // error } public void proceed() { if (stage != null) { stage = stage.proceed(); } } public abstract class Stage { /** * Executes current stage and returns next stage. * * @return */ public abstract Stage proceed(); public class First extends Stage { @Override public Stage proceed() { m = 100; return new Second(); } } public class Second extends Stage { @Override public Stage proceed() { //do something return null; // last stage } } } } The first thing I had to change was to make Stage an abstra…
tagged with: namespaces
has answer: http://stackoverflow.com/a/25065660
possible better answer: http://stackoverflow.com/a/25065688
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25065688
tagged with: inner-classes
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/39016943
accepted answer: http://stackoverflow.com/a/25065660
has comment: http://stackoverflow.com/comment/39000518
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/39016778
has comment: http://stackoverflow.com/comment/38993668
has title: Is it possible to use a class that is implemented in its parent class (which is an inner class)?
has comment: http://stackoverflow.com/comment/38994013

http://stackoverflow.com/comment/38937342
comment on: http://stackoverflow.com/a/25035709
has text: Perfect. I had been using `KeepScreenOn` just not in the right place.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/24923070
has comment: http://stackoverflow.com/comment/38726055
has comment: http://stackoverflow.com/comment/38726187
answers question: http://stackoverflow.com/q/24923040
has body: For future reference, you can view the bytecode of a .class file with javap -c MyClass to see what your compiled code looks like. To answer your question: the Java compiler does not inline methods. The JVM, on the other hand, analyzes your code and will inline at runtime if necessary. Basically, you shouldn't worry about it -- leave it to the JVM, and it will inline if it finds it beneficial. The JVM is typically smarter than you when it comes to these things. From http://www.oracle.com/technetwork/java/whitepaper-135217.html#method: Method Inlining The frequency of virtual method invocations in the Java programming language is an important optimization bottleneck. Once the Java HotSpot adaptive optimizer has gathered information during execution about program hot spots, it not only compiles the hot spot into native code, but also performs extensive method inlining on that code. Inlining has important benefits. It dramatically reduces the dynamic frequency of method invocations, which saves the time needed to perform those method invocations. But even more importantly, inlining produces much larger blocks of code for the optimizer to work on. This creates a situation that significantly increases the effectiveness of traditional compiler optimizations, overcoming a major obstacle to increased Java programming language performance. Inlining is synergistic with other code optimizations, because it makes them more effective. As the Java HotSpot compiler matures, the ability to operate on large, inlined blocks of code will open the door to a host of even more advanced optimizations in the future.
has comment: http://stackoverflow.com/comment/38726151
has comment: http://stackoverflow.com/comment/38732551
score: 4
has comment: http://stackoverflow.com/comment/38726097
upvote count: 4
has comment: http://stackoverflow.com/comment/38726083
downvote count: 0
has comment: http://stackoverflow.com/comment/38726093
has comment: http://stackoverflow.com/comment/115783183
type: Answer
has comment: http://stackoverflow.com/comment/38727159
has comment: http://stackoverflow.com/comment/38726573
has comment: http://stackoverflow.com/comment/38726130
has comment: http://stackoverflow.com/comment/38726116
has comment: http://stackoverflow.com/comment/38726081

http://stackoverflow.com/q/25008451
answer count: 3
tagged with: arrays
accepted answer: http://stackoverflow.com/a/25008499
has comment: http://stackoverflow.com/comment/38886171
has comment: http://stackoverflow.com/comment/38886356
has body: I'm trying to preserve blank spaces, periods, commas, exclamation marks, and new lines in the process of placing each into an array. All but the blank space are working just fine. Scanner fileInput = new Scanner(file); while (fileInput.hasNext()) { String s = fileInput.next(); if(s.endsWith(",") || s.endsWith(".") || s.endsWith("!")|| s.endsWith("\n") || s.endsWith(",")) { String token = new String(""); token += s.charAt(s.length()-1); s = s.substring(0, s.length()-1); words.add(s.toLowerCase()); words.add(token); } else if (!s.equals("") ) words.add(s.toLowerCase()); } }
has comment: http://stackoverflow.com/comment/38886225
possible better answer: http://stackoverflow.com/a/25009270
score: 0
has answer: http://stackoverflow.com/a/25009270
has comment: http://stackoverflow.com/comment/38886437
has title: Preserving blank space in an Array java
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25008499
has comment: http://stackoverflow.com/comment/38886234
has comment: http://stackoverflow.com/comment/38886180
tagged with: java
has answer: http://stackoverflow.com/a/25008497
type: Question

http://stackoverflow.com/q/25002230
upvote count: 6
tagged with: java
has comment: http://stackoverflow.com/comment/38875273
type: Question
type: AnsweredQuestion
has title: Get a file in a jar in jar
score: 6
answer count: 2
has body: I have a setup like this: outer.jar inner.jar file.txt So, I am executing outer.jar and within it's main class: URL url = Main.class.getClassLoader().getResource("file.txt"); url is: 'jar:file:outer.jar!/inner.jar!/file.txt' But if I try to read it like: url.openStream() I get an exception Exception in thread "main" java.io.FileNotFoundException: JAR entry inner.jar!/file.txt not found in outer.jar at sun.net.www.protocol.jar.JarURLConnection.connect(JarURLConnection.java:142) at sun.net.www.protocol.jar.JarURLConnection.getInputStream(JarURLConnection.java:150) at java.net.URL.openStream(URL.java:1038) at Main.main(Main.java:15) The file is definitely there. Is this not possible with JarURLConnection?
has comment: http://stackoverflow.com/comment/38898148
downvote count: 0
tagged with: jar
has answer: http://stackoverflow.com/a/25189225
favorite count: 0
accepted answer: http://stackoverflow.com/a/25189225
possible better answer: http://stackoverflow.com/a/25002474
has answer: http://stackoverflow.com/a/25002474

http://stackoverflow.com/comment/38872282
type: QuestionComment
has text: Collections.shuffle(yourMusicList);
type: Comment
comment on: http://stackoverflow.com/q/25001156
score: 0

http://stackoverflow.com/comment/38818165
type: Comment
has text: Thanks for your answer. Tried like you said: `public void onActivityCreated(Bundle savedInstanceState) { final TextView tv = (TextView)this.getActivity().findViewById(R.id.column2); tv.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { Intent intent = new Intent(Intent.ACTION_CALL); String phone_no=tv.getText().toString().trim(); intent.setData(Uri.parse("tel:"+phone_no)); startActivity(intent); } }); super.onActivityCreated(savedInstanceState); }` Still getting NPE.
comment on: http://stackoverflow.com/a/24972137
type: AnswerComment
score: 0

http://stackoverflow.com/comment/38798173
has text: It's not really clear what you're asking. There's no Texture constructor that takes an int. If you have multiple Textures that you want to choose from, create an array of Textures and call `miCaja.setTexture(texturesArray[imageNumero]);`. You might have to also call `miCaja.setRegion(0,0,1,1);` depending on how you are using your TextureRegion.
comment on: http://stackoverflow.com/q/24961153
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24955079
score: 2
downvote count: 0
upvote count: 2
answers question: http://stackoverflow.com/q/24954994
type: Answer
has body: Set JAVA_HOME="C:\Program Files (x86)\Java\jdk1.6.0_04" and CATALINA_HOME="C:\Program Files (x86)\apache-tomcat-8.0.9" than go to %CATALINA_HOME%\bin and run startup.bat All simple configuration in %CATALINA_HOME%\conf\server.xml

http://stackoverflow.com/a/24929758
upvote count: 3
has comment: http://stackoverflow.com/comment/38738213
answers question: http://stackoverflow.com/q/24929675
type: AcceptedAnswer
downvote count: 0
has body: The second web site is simply using base64 instead of hex to represent the binary data as text. So you can get rid of your bytesToHex method entirely, and just use Base64: String base64Digest = Base64.encodeToString(thedigest, Base64.DEFAULT); (As an aside, I'd avoid using the as a prefix in variable names - it provides no benefit, and is just cruft.)
has comment: http://stackoverflow.com/comment/119569517
type: Answer
accepted answer of: http://stackoverflow.com/q/24929675
score: 3

http://stackoverflow.com/comment/38897838
type: QuestionComment
score: 0
has text: I think your locations specified for `Gdx.files.internal` are all wrong, including the fjle handles and the texture_atlas_objects constant, check https://github.com/libgdx/libgdx/wiki/Managing-your-assets to align it to their \assets\data\... setup
type: Comment
comment on: http://stackoverflow.com/q/25012478

http://stackoverflow.com/a/25342115
type: AcceptedAnswer
downvote count: 0
score: 4
accepted answer of: http://stackoverflow.com/q/25018814
answers question: http://stackoverflow.com/q/25018814
type: Answer
has body: had same problem, from the documentation: RabbitMQ creates auto-delete queues when destinations like /exchange/amq.direct/position-updates are used. So in that case the client could subscribe to /user/exchange/amq.direct/position-updates remember to add '/exchange/' as a destination prefix in stomp broker relay configuration
has comment: http://stackoverflow.com/comment/39549844
upvote count: 4

http://stackoverflow.com/q/24916855
has title: Calculate image edited percentage in Java
tagged with: percentage
upvote count: 1
has comment: http://stackoverflow.com/comment/38715202
type: Question
has comment: http://stackoverflow.com/comment/38714189
tagged with: java
tagged with: image
has comment: http://stackoverflow.com/comment/38715131
has body: How to calculate the percentage of an image (jpeg) that has been edited using Java? For example, when an image is uploaded, the user wants to know how many percent of that image has been edited, so if it is 0% it shows that it is an original picture.
has answer: http://stackoverflow.com/a/24917410
downvote count: 4
has comment: http://stackoverflow.com/comment/38714185
has comment: http://stackoverflow.com/comment/38714171
answer count: 1
has comment: http://stackoverflow.com/comment/38714218
has comment: http://stackoverflow.com/comment/38714634
favorite count: 0
type: UnansweredQuestion
score: -3
has comment: http://stackoverflow.com/comment/38714332

http://stackoverflow.com/q/25055449
has comment: http://stackoverflow.com/comment/39156596
downvote count: 0
has comment: http://stackoverflow.com/comment/38974870
favorite count: 0
has body: i have a textarea in a form where the user can enter their commands. I am retrieving this command in my java class. Map&lt;String, String[]&gt; params = ActionContext.getParameters(); for(String key: params.keySet()){ value = params.get(key); } val = value[0]; After every sumbit the form gets refresh. I need to display back to the user all the previously entered commands. But i am unable to append the values. after every submit the value of val also is getting refreshed. i am using Stringbuffer to append these values. how could i do this using javascript?
type: UnansweredQuestion
has title: Append previous from values in java class using StringBuffer
answer count: 0
score: 1
tagged with: java
upvote count: 1
linked to: http://stackoverflow.com/q/1320876
type: Question
has comment: http://stackoverflow.com/comment/39009648
has comment: http://stackoverflow.com/comment/39156516
has comment: http://stackoverflow.com/comment/38976456
tagged with: stringbuffer
has comment: http://stackoverflow.com/comment/38976617
tagged with: javascript
linked to: http://stackoverflow.com/q/20059712

http://stackoverflow.com/a/25058336
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38980441
has body: Is there a faster way of doing this? Yes - don't perform repeated string concatenation. That's the part that's killing your performance. Use a StringBuilder instead. It's also not even doing what you want it to - you're not using the result of calling substring. I suspect you want something like this: String[] lines = content.split("\n"); StringBuilder builder = new StringBuilder(); for (String line : lines) { builder.append(line.substring(2)); // I suspect you want this, otherwise you're losing line breaks. builder.append("\n"); } String result = builder.toString(); Additionally, you should consider reading the file line by line instead of reading the whole thing and then splitting it. For example: StringBuilder builder = new StringBuilder(); try (BufferedReader reader = ...) { String line; while ((line = reader.readLine()) != null) { builder.append(line.substring(2)); builder.append("\n"); } } String result = builder.toString(); And unless you really need the whole thing in memory at any one time at all, write the lines as you process them: try (BufferedReader reader = ..., BufferedWriter writer = ...) { String line; while ((line = reader.readLine()) != null) { // Perform any other manipulations here... writer.write(line.substring(2)); writer.write("\n"); } }
type: Answer
accepted answer of: http://stackoverflow.com/q/25058288
has comment: http://stackoverflow.com/comment/38979975
has comment: http://stackoverflow.com/comment/38980668
has comment: http://stackoverflow.com/comment/38980410
has comment: http://stackoverflow.com/comment/38979955
has comment: http://stackoverflow.com/comment/38980016
score: 11
downvote count: 1
has comment: http://stackoverflow.com/comment/38983547
answers question: http://stackoverflow.com/q/25058288
has comment: http://stackoverflow.com/comment/38979909
upvote count: 12

http://stackoverflow.com/q/25059482
possible better answer: http://stackoverflow.com/a/25059517
type: Question
has answer: http://stackoverflow.com/a/25059528
score: 0
tagged with: android
has body: I can't stop my service with stopService(). I have tryed everything but it doesn't work. I stop my service only when I uninstall app. public class Refresh extends Service { @Override public IBinder onBind(Intent intent) { // TODO Auto-generated method stub return null; } @Override public int onStartCommand(Intent intent, int flags, int startId) { Toast.makeText(getApplicationContext(), "NESTO!", Toast.LENGTH_LONG).show(); Toast.makeText(this, "Your location is: "+MyLocation(), Toast.LENGTH_LONG).show(); return START_NOT_STICKY; } @Override public void onCreate() { Intent myService = new Intent(this, Refresh.class); PendingIntent pendingIntent = PendingIntent.getService(this, 0,myService, 0); AlarmManager alarmManager = (AlarmManager) getSystemService(Context.ALARM_SERVICE); alarmManager.setRepeating(AlarmManager.RTC_WAKEUP,System.currentTimeMillis(), 20* 1000, pendingIntent); super.onCreate(); } @Override public void onDestroy() { // TODO Auto-generated method stub super.onDestroy(); } public LatLng MyLocation(){ LocationManager locationManager=(LocationManager)this.getSystemService(Context.LOCATION_SERVICE); Location location=locationManager.getLastKnownLocation(LocationManager.NETWORK_PROVIDER); return new LatLng(location.getLatitude(), location.getLongitude()); } } And this is methods in main activity: public void startService(){ startService(new Intent(getBaseContext(), Refresh.class)); } public void stopService(){ stopService(new Intent(getBaseContext(),Refresh.class)); } And this is how I call methods start and stop service: public void onClick(View V){ stopService(); }
answer count: 4
has answer: http://stackoverflow.com/a/25059517
tagged with: service
has title: Stop service on Android
has answer: http://stackoverflow.com/a/25059866
has comment: http://stackoverflow.com/comment/38982378
accepted answer: http://stackoverflow.com/a/25059528
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/25143903

http://stackoverflow.com/comment/38829553
type: AnswerComment
has text: sure just in memory ? if server restart so every body have to login again ?
type: Comment
comment on: http://stackoverflow.com/a/24978197
score: 0

http://stackoverflow.com/q/25028057
has body: First off, networking is not my strongest subject. So sorry if this question is ridiculous, or if I'm missing some major information. I'd be happy to provide any needed. I am trying spoof a server program. The program I am trying to pretend to be basically creates a local server, then allows client versions of the same program to connect (provided they are on the same computer). Using netstat -a -b -n I was able to figure out that the server was binding itself to 0.0.0.0:53640. The other information given was: Proto: UDP Local Address: 0.0.0.0:56426 Foreign Address: * : * (Without spaces, stackoverflow doesn't seem to like this when it doesn't have them) State: (Was blank) The closest I was able to come was Proto: TCP Local Address: 0.0.0.0:56426 Foreign Address: 0.0.0.0:0 State: LISTENING The code that I am using is: import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.PrintWriter; import java.net.InetAddress; import java.net.ServerSocket; import java.net.Socket; public class Main2 { public static void main(String args[]) { String ip = "0.0.0.0"; int port = 53640; try { InetAddress address = InetAddress.getByName(ip); ServerSocket server = new ServerSocket(port, 5, address); System.out.println("Waiting for connection..."); Socket socket = server.accept(); System.out.println("Got connection!"); doSocket(socket); server.close(); } catch (Exception e) { e.printStackTrace(); } } public static void doSocket(Socket socket) { try { System.out.println("Connection from: " + socket.getInetAddress()); BufferedReader in = new BufferedReader(new InputStreamReader(socket.getInputStream())); PrintWriter out = new PrintWriter(socket.getOutputStream()); int b; char c; while ((b = in.read()) != -1) { c = (char) b; System.out.print(c); } in.close(); out.close(); } catch (Exception e) { e.printStackTrace(); } } } ServerSocket.accept seems to never stop yielding, as "Got connection!" is never printed to the output. All help is very welcome. Thanks in advance!…
answer count: 1
has answer: http://stackoverflow.com/a/25028139
has title: Copy a Different Program's Local Server (Java)
type: AnsweredQuestion
score: 0
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/25028139

http://stackoverflow.com/comment/38818250
type: Comment
has text: @user3673449 Please, update the code on your question, also add the log and mark the line where you're getting the NPE.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24972137

http://stackoverflow.com/q/24989561
score: 0
tagged with: macos
accepted answer: http://stackoverflow.com/a/25234231
tagged with: ruby
has body: I used Watir and Shoes 4 to make a ruby program. Then, I used the packaging instruction from https://github.com/shoes/shoes4 to make an app. This app crashed immediately after I click to run it on Macs - leave this bit for a moment because I asked this in another thread. However, I can 'Show package contents' and then find these two folders 'Java' and 'MacOS'. 'Java' contains a jar file. 'MacOS' contains a JavaAppLauncher. Now, I can click on this JavaAppLauncher, then it opens a terminal and runs my app. The problem is that JavaAppLauncher runs on the ~ root dir in this terminal where doesn't contain the files that the app should read from. Those files were in the same dir where the source code was. I suppose those files should be packaged, but apparently they are not. How am I supposed to solve this? Can JavaAppLauncher open a terminal and run from the dir where JavaAppLauncher sits? Can I write a script to move the files to the root dir while running the app and remove them when it's finished? Thanks!
type: AnsweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/25234231
answer count: 1
tagged with: executable-jar
tagged with: shoes
has title: JavaAppLauncher on Mac

http://stackoverflow.com/comment/38732274
type: QuestionComment
comment on: http://stackoverflow.com/q/24910417
has text: I can only work with the JAR File, which includes the text "jar-with dependencies". But i must rename this file, because of my bash sell script, which execute this File. The second JAR file, which was created by maven, can not be used, since i get this error message: no main manifest attribute, in myJarFile.jar
score: 0
type: Comment

http://stackoverflow.com/comment/40314365
type: Comment
score: 1
comment on: http://stackoverflow.com/a/24983702
type: AnswerComment
has text: This issue, due to a misalignment between table metadata and data in damaged mdb/accdb, has been solved in UCanAccess 2.0.9.

http://stackoverflow.com/a/24985802
upvote count: 4
has comment: http://stackoverflow.com/comment/38869487
downvote count: 0
answers question: http://stackoverflow.com/q/24985751
has comment: http://stackoverflow.com/comment/107124269
type: Answer
has body: Math.toDegrees(Math.atan(Math.abs(pointBY - pointAY), Math.abs(pointBX - pointAX))); This calls the inverse tangent function to find an angle based on the lengths of the opposite and adjacent sides of a right angled triangle. However, you should add this if statement: if(!(pointAX == pointBX || pointAY == pointBY)) { angle = Math.toDegrees(Math.atan(Math.abs(pointBY - pointAY), Math.abs(pointBX - pointAX))); } Otherwise you can cause an exception because the tan function breaks down if the angle is 90 or 0 degrees. pointAX and pointBX are the X coordinates of the points, while pointAY and pointBY are the Y coordinates of the points. This function finds the absolute value of the difference between the coordinates (so the length of the opposite and adjacent sides of the right-angled triangle formed from the two points) and then performs the inverse tan function on them, finding the angle.
score: 4

oracle-database
tags question: http://stackoverflow.com/q/25040826
tags question: http://stackoverflow.com/q/25025167
tags question: http://stackoverflow.com/q/25030413
tags question: http://stackoverflow.com/q/25013677
tags question: http://stackoverflow.com/q/25061895
tag name: oracle-database
tags question: http://stackoverflow.com/q/24919960
tags question: http://stackoverflow.com/q/24968031
tags question: http://stackoverflow.com/q/25057042
tags question: http://stackoverflow.com/q/25052604
tags question: http://stackoverflow.com/q/25044828
tags question: http://stackoverflow.com/q/25051831
tags question: http://stackoverflow.com/q/24929563
type: Tag
tags question: http://stackoverflow.com/q/24923882
tags question: http://stackoverflow.com/q/24912489
tags question: http://stackoverflow.com/q/24937220
tags question: http://stackoverflow.com/q/25017712
tags question: http://stackoverflow.com/q/25061459
tags question: http://stackoverflow.com/q/24933253
tags question: http://stackoverflow.com/q/25016272
tags question: http://stackoverflow.com/q/25020392
tags question: http://stackoverflow.com/q/24987298
tags question: http://stackoverflow.com/q/24958214
tags question: http://stackoverflow.com/q/25021329
tags question: http://stackoverflow.com/q/25051294
tags question: http://stackoverflow.com/q/25011320
tags question: http://stackoverflow.com/q/24913918
tags question: http://stackoverflow.com/q/24912919
tags question: http://stackoverflow.com/q/25051827
tags question: http://stackoverflow.com/q/25031114
tags question: http://stackoverflow.com/q/25065275
tags question: http://stackoverflow.com/q/25041089
tags question: http://stackoverflow.com/q/25040344

http://stackoverflow.com/a/24957515
score: 2
has comment: http://stackoverflow.com/comment/38790989
downvote count: 0
type: Answer
has body: I don't believe there is risk in doing that, but it's unnecessary. Have your one developer change his function call. // this is the same var myClazz = thatClazz.clone(); // as this var myClazz = new Clazz(thatClazz); The new method uses something called a Copy Constructor which in my opinion looks cleaner than using .clone(). Further, a discussion should be had with your development team about modifying code that other modules are dependent on. Any methods or properties that are not private should have references checked before a change.
upvote count: 2
has comment: http://stackoverflow.com/comment/38791054
has comment: http://stackoverflow.com/comment/38791011
answers question: http://stackoverflow.com/q/24957366

http://stackoverflow.com/a/35607527
score: 1
downvote count: 0
has body: If you don't mind using 3rd party libraries, my cyclops-react lib has extensions for all JDK Collection types, with a large number of powerful operaitons attached, so you could implement this like so :- CollectionX&lt;String&gt; col = CollectionX.fromCollection(orgCol); col.zipWithIndex() .toMap(k-&gt;k.v1, v-&gt;v.v2); cyclops-react Collection extensions are eager, so you would get better performance with our Stream extension, ReactiveSeq (which extends jOOλ's Seq, which in turn is an extension of JDK's java.util.stream.Stream, it also implements the reactive-streams api). ReactiveSeq.fromCollection(col) .zipWithIndex() .toMap(k-&gt;k.v1, v-&gt;v.v2);
type: Answer
answers question: http://stackoverflow.com/q/25041177
upvote count: 1

http://stackoverflow.com/comment/38842899
type: Comment
score: 8
comment on: http://stackoverflow.com/q/24985465
has text: C'mon. You loop runs only when `i < 5`. So `i = 5` cannot possibly happen.
type: QuestionComment

http://stackoverflow.com/a/37108289
type: Answer
answers question: http://stackoverflow.com/q/24948517
has body: Q. How to remove JRE System Library from project? Ans: Go to project then Right click on project---> Build Path-->Configure build path Now there are 4 tabs Source, Projects, Libraries, Order and Export Go to Libraries tab --> click on JRE System Library --> Then Remove it. Q. How to add JRE System Library to project? Ans: Go to project then Right click on project---> Build Path-->Configure build path Now there are 4 tabs Source, Projects, Libraries, Order and Export Go to Libraries tab --> Click on Add Library (shown at the right side) --> select JRE System Library --> Next-->click Alternate JRE --> select Installed JRE--> Finish --> Apply--> OK.
score: 0

http://stackoverflow.com/q/25017285
has comment: http://stackoverflow.com/comment/38931408
downvote count: 0
tagged with: http-authentication
tagged with: spring-security
has body: I have two Java wepapps potentially on different domains/servers using Spring Security for authentication. The first is handling authentication locally storing users in the application database. For the second, I would like to authenticate users using the same users accounts than the first webapp with single sign on (if a user is authenticated in the first webapp, it shouldn't have to enter his info again in the second). I identified three potential ways to do this but it doesn't seem very straightforward: Shared cookies: Using a shared session cookie and the same database for the two applications. It seem relatively easy to do but the two webapps need to be on the same domain which isn't necessarily the case for my applications. Directory service: Using a central directory service (LDAP) which would be used by the two webapps to handle authentication. It seem pretty heavy to implement and the users can't be stored in the first webapp database anymore. The existing users accounts would need to be migrated into the LDAP and it would not be possible to create new users using the first webapp. OAuth: It seem to be be possible to make the first webapp handle external authentications requests by providing an OAuth api (like Google sign on kind of service). That would allow the second webapp to use this api to authenticate the users, but I'm not sure that the signin process would be totally transparent to handle single sign on. It doesn't seem very easy to implement either, as it would necessitate the development of a complete OAuth api in the first webapp. I also looked at this service https://auth0.com that seem to provide an authentication api that can be interfaced with an external database, but I'm not sure that it can be interfaced with Spring Security and it also mandate the use of an online solution which isn't ideal. I'm not sure that it would handle single sign on either, only shared accounts. Is there any other way to handle this use case that would be more str…
upvote count: 1
answer count: 1
favorite count: 0
tagged with: single-sign-on
type: UnansweredQuestion
has title: Shared authentication and SSO between two webapps
score: 1
linked to: http://stackoverflow.com/q/342378
tagged with: java
tagged with: authentication
has comment: http://stackoverflow.com/comment/38938780
has comment: http://stackoverflow.com/comment/38937235
type: Question
has answer: http://stackoverflow.com/a/25044485

http://stackoverflow.com/comment/38748112
comment on: http://stackoverflow.com/q/24935010
has text: But how can I edit it when I'm not doing it manually, sorry I'm new to this
score: 0
type: Comment
type: QuestionComment

keylistener
tags question: http://stackoverflow.com/q/24965600
type: Tag
tags question: http://stackoverflow.com/q/24940827
tags question: http://stackoverflow.com/q/24932009
tags question: http://stackoverflow.com/q/25007113
tags question: http://stackoverflow.com/q/25028682
tags question: http://stackoverflow.com/q/25049571
tags question: http://stackoverflow.com/q/24912419
tags question: http://stackoverflow.com/q/24986812
tag name: keylistener

http://stackoverflow.com/q/25025667
has body: Thx all for helping &lt;3 So, I have downloaded the ffmpeg library, imported it to eclipse, added it as a library to my android application and tried to use it, it doesn't work. Step by step: Downloaded this file : https://github.com/guardianproject/android-ffmpeg-java Extracted it to an empty folder. At Eclipse, "import" and then I have selected this empty folder. Right click at my project, properties, android, added the ffmpeg library. At my on create I used this code(just for checking): ffmpeg -t 30 -i inputfile.mp3 -acodec copy outputfile.mp3 But I get a lot of errors: Multiple markers at this line - Syntax error on token(s), misplaced construct(s) - Syntax error on token "inputfile", delete this token - Syntax error on token "30", delete this token - Syntax error on token ".", ; expected Can you see my problem?
has comment: http://stackoverflow.com/comment/38946522
tagged with: java
has title: Using ffmpeg library
tagged with: eclipse
has comment: http://stackoverflow.com/comment/38952264
type: Question
has comment: http://stackoverflow.com/comment/38944973
has comment: http://stackoverflow.com/comment/38919169
linked to: http://stackoverflow.com/q/25002545
score: 0
tagged with: android
answer count: 0
tagged with: ffmpeg
type: UnansweredQuestion

http://stackoverflow.com/comment/38986041
has text: This still works in the IDE, but nulls out in the exported jar :(
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25060849

http://stackoverflow.com/comment/38817944
has text: Well, in my case I need to generate a list with Linux processes - so this list id very dynamic and it's changed in every run. Can you show me some example with dynamically generated list of data where the size is changed in every run?
comment on: http://stackoverflow.com/a/24971500
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/38982474
type: Comment
comment on: http://stackoverflow.com/a/24963268
type: AnswerComment
has text: You did come up with a workaround on your own, but I believe that I came up with an answer to the original problem. If you believe that as well, mark it as such, otherwise dont. Now that you can't mark comments as an answer.
score: 0

http://stackoverflow.com/comment/38758698
type: QuestionComment
score: 2
has text: Try it. And `""+i` (your first example is wrong).
comment on: http://stackoverflow.com/q/24940454
type: Comment

http://stackoverflow.com/a/24991985
has comment: http://stackoverflow.com/comment/38856718
has comment: http://stackoverflow.com/comment/39083528
has comment: http://stackoverflow.com/comment/39084661
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38882821
has comment: http://stackoverflow.com/comment/38856195
has comment: http://stackoverflow.com/comment/39082300
score: 58
has body: There is no such thing as a EOF character. The operating system knows exactly how many bytes a file contains (this is stored alongside other metadata like permissions, creation date, and the name), and hence can tell programs that try to read the eleventh byte of a ten byte file: You've reached the end of file, there are no more bytes to read. In fact, the "EOF" value returned for example by C functions like getchar is explicitly an int value outside the range of a byte, so it cannot possibly be stored in a file! Sometimes, certain file formats insist on adding NUL terminators (probably because that's how strings are usually stored in C), though usually these delimit multiple records in a single file, not the file as a whole. And such decoration usually disqualifies a file from being considered a "text file". ASCII codes like ETX and NUL date back to the days of teletypewriters and friends. NUL is used in C for in-memory strings, but this has no bearing on file systems.
type: Answer
accepted answer of: http://stackoverflow.com/q/24991803
has comment: http://stackoverflow.com/comment/39083618
has comment: http://stackoverflow.com/comment/39083002
upvote count: 59
answers question: http://stackoverflow.com/q/24991803
has comment: http://stackoverflow.com/comment/39084575
has comment: http://stackoverflow.com/comment/38856507
downvote count: 1
has comment: http://stackoverflow.com/comment/39084479
has comment: http://stackoverflow.com/comment/38856363
has comment: http://stackoverflow.com/comment/38856465

http://stackoverflow.com/comment/38933454
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25032126
has text: Running tests by `mvn clean install` does seem to show the same problems. Does that indicate a surefire problem? We don't have parallel or forking explicitly configured in our surefire configuration
score: 0

http://stackoverflow.com/comment/38799392
comment on: http://stackoverflow.com/q/24962250
has text: No, there's nothing wrong with that.
type: Comment
type: QuestionComment
score: 3

http://stackoverflow.com/comment/38978397
type: QuestionComment
has text: I think i found some good solution in: is this the way to go as of now, or is there anything newer more handy : http://doc.scalatest.org/2.2.0/index.html#org.scalatest.concurrent.AsyncAssertions
comment on: http://stackoverflow.com/q/25048463
score: 0
type: Comment

http://stackoverflow.com/comment/38813142
type: Comment
score: 0
type: AnswerComment
has text: will the instance of process be eligible for garbage collection as well?
comment on: http://stackoverflow.com/a/24969279

http://stackoverflow.com/comment/38883662
type: AnswerComment
comment on: http://stackoverflow.com/a/25007065
type: Comment
has text: @developer This is essentially an example based on the answer of vandale, so if you find it useful, an up-vote is appreciated, but the credit should go to vandale as he responded first...IMHO
score: 0

http://stackoverflow.com/comment/38850872
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24951788
has text: What did you write in the `.bat` file ? And what files do you have in the same folder as the bat file ?
score: 0

http://stackoverflow.com/a/31644622
score: 4
has comment: http://stackoverflow.com/comment/53100338
has body: I had the same problem even though I had: a freshly downloaded JDK 1.8.0 JAVA_HOME is set java -version on command line reports 1.8 Java in control panel is set to 1.8 downloaded Eclipse Mars Eclipse only let me choose a compiler compliance level op to 1.7 in the compiler preferences, even though my installed JRE is 1.8.0. I also couldn't see a 1.8 in the Execution Environments underneath Installed JREs, only a JavaSE-1.7 (which I haven't even got installed!). When I clicked on that, it shows "jdk1.8.0" as a compatible JRE, so I selected that, but still no change. Then I unzipped Eclipse Mars into a brand new directory, created a new project, and now I can select 1.8, hurrah! That greatly reduced the "Duplicate methods named spliterator..." errors I was getting when compiling my code under Java 1.8, however, there is still one left: Duplicate default methods named spliterator with the parameters () and () are inherited from the types List and Set. However, that's likely because I'm extending AbstractList and implementing Set, so I've fixed that for now by removing the implements Set because it doesn't really add anything in my case (other than signifying that my collection has only unique elements)
upvote count: 5
answers question: http://stackoverflow.com/q/24947844
type: Answer
downvote count: 1

http://stackoverflow.com/q/24965215
has answer: http://stackoverflow.com/a/24965290
type: AnsweredQuestion
has title: Get Factorials using String value
accepted answer: http://stackoverflow.com/a/24965290
tagged with: java
has comment: http://stackoverflow.com/comment/38805272
has comment: http://stackoverflow.com/comment/38805070
type: Question
answer count: 2
tagged with: data-structures
score: 0
has comment: http://stackoverflow.com/comment/38805066
possible better answer: http://stackoverflow.com/a/24965326
has body: i did up a class named "Factorial" using Recursion and it works perfectly, but this is when i input an integer value only. Code is below import java.util.*; public class Factorial { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub int x, i; Scanner keyboard = new Scanner(System.in); System.out.println("Enter a Factorial"); x=keyboard.nextInt(); i = factorial(x); System.out.println(i); } public static int factorial(int x) { int result; if(x==1) return 1; result = factorial(x-1) * x; return result; } } But now i want to tweak the code so that instead of accepting integer values, i would enter a String value like "4!" or "10!" or "100!" and the code would extract and convert the numerical values so that it would then be passed into the factorial class. I was wondering if there is a fast way of doing this. Any help would be appreciated. Thanks :)
linked to: http://stackoverflow.com/q/2338790
has answer: http://stackoverflow.com/a/24965326
has comment: http://stackoverflow.com/comment/38805122
has comment: http://stackoverflow.com/comment/38805168
tagged with: recursion

http://stackoverflow.com/q/25006463
tagged with: android
has answer: http://stackoverflow.com/a/25006603
has title: ADT can't find installed JREs on Mac
tagged with: java
type: Question
tagged with: adt
tagged with: eclipse
score: 0
answer count: 1
has body: I have ADT Installed. v23.0.2. I tried to import simple java project, but found no installed JRE to compile the code. I then installed JDK &amp; JRE from Java SE downloads. I yet don't see any JRE in the list. Anything am I missing? any hooks ?
linked to: http://stackoverflow.com/q/14341865
type: UnansweredQuestion

http://stackoverflow.com/q/25029189
has title: Give color to a buffered image in java
accepted answer: http://stackoverflow.com/a/25029797
has comment: http://stackoverflow.com/comment/38925757
has comment: http://stackoverflow.com/comment/38925649
has comment: http://stackoverflow.com/comment/38925695
has answer: http://stackoverflow.com/a/25029797
possible better answer: http://stackoverflow.com/a/25029212
has body: I have a buffered image that looks something like this. How do I give it color? I am new to image processing in java any help would be greatly appreciated. This is a sample of the code that generates this picture. public BufferedImage getDifferenceImage(BufferedImage img1, BufferedImage img2) { int width1 = img1.getWidth(); // Change - getWidth() and getHeight() for BufferedImage int width2 = img2.getWidth(); // take no arguments int height1 = img1.getHeight(); int height2 = img2.getHeight(); if ((width1 != width2) || (height1 != height2)) { System.err.println("Error: Images dimensions mismatch"); System.exit(1); } // NEW - Create output Buffered image of type RGB BufferedImage outImg = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB); // Modified long diff; int result; // Stores output pixel for (int i = 0; i &lt; height1; i++) { for (int j = 0; j &lt; width1; j++) { int rgb1 = img1.getRGB(j, i); int rgb2 = img2.getRGB(j, i); int r1 = (rgb1 &gt;&gt; 16) &amp; 0xff; int g1 = (rgb1 &gt;&gt; 8) &amp; 0xff; int b1 = (rgb1) &amp; 0xff; int r2 = (rgb2 &gt;&gt; 16) &amp; 0xff; int g2 = (rgb2 &gt;&gt; 8) &amp; 0xff; int b2 = (rgb2) &amp; 0xff; diff = Math.abs(r1 - r2); // Change diff += Math.abs(g1 - g2); diff += Math.abs(b1 - b2); diff /= 255; // Change - Ensure result is between 0 - 255 // Make the difference image gray scale // The RGB components are all the same result = (diff &lt;&lt; 16) | (diff &lt;&lt; 8) | diff; outImg.setRGB(j, i, result); // Set result } } // Now return return outImg; }
tagged with: pixel
has answer: http://stackoverflow.com/a/25029212
tagged with: image-processing
tagged with: bufferedimage
has comment: http://stackoverflow.com/comment/38925796
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/38925880
has comment: http://stackoverflow.com/comment/38998225
tagged with: image
has comment: http://stackoverflow.com/comment/38960422
has comment: http://stackoverflow.com/comment/38925451
type: Question
has comment: http://stackoverflow.com/comment/38925940
score: 0
answer count: 2

gmail
type: Tag
tags question: http://stackoverflow.com/q/25051878
tag name: gmail

http://stackoverflow.com/q/25036094
favorite count: 0
has title: Scroll AndroidStaggeredGrid to specific position
tagged with: android
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38937987
upvote count: 2
has body: I'm using https://github.com/etsy/AndroidStaggeredGrid/ in my project. Everything works fine, except I can't scroll it to specific position/item at will. What I've tried so far (everything I could think of, enclosed in one piece of code for you to look at): final StaggeredGridView gv = (StaggeredGridView) ma.findViewById(R.id.photosList); gv.setChoiceMode(StaggeredGridView.CHOICE_MODE_SINGLE); gv.setFocusable(true); gv.clearFocus(); gv.post( new Runnable() { @Override public void run() { // #1 approach gv.requestFocusFromTouch(); gv.smoothScrollToPosition(index); // #2 approach gv.setSelection(index); View v = gv.getChildAt(index); if (v != null) { // #3 approach v.requestFocus(); } //v.requestFocusFromTouch(); Utils.log("scroll to " + index); gv.requestLayout(); } }); Nothing seems to work and I'm begining to think this view has some kind of bug related to my issue. Is there someone who can help me in the matter?
tagged with: java
has answer: http://stackoverflow.com/a/30363296
type: Question
accepted answer: http://stackoverflow.com/a/30363296
tagged with: staggered-gridview
score: 2
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/38938353

http://stackoverflow.com/a/25070290
has body: I figured out my errors. I just needed to put the sudo command before running the file. It would look like this --> sudo python setup.py install As for the jni.h error. Below is the code. This website helped me a lot: http://blog.y3xz.com/blog/2011/04/29/installing-jpype-on-mac-os-x Here is a copy of the setup.py for mac installation. I changed some code in these two functions setupMacOSX() and setupInclusion(). from distutils.core import setup as distSetup, Extension import os, os.path, sys class JPypeSetup(object): def __init__(self) : self.extra_compile_args = [] self.macros = [] def setupFiles(self) : cpp_files = [ map(lambda x : "src/native/common/"+x, os.listdir("src/native/common")), map(lambda x : "src/native/python/"+x, os.listdir("src/native/python")), ] all_src = [] for i in cpp_files : all_src += i self.cpp = filter(lambda x : x[-4:] == '.cpp', all_src) self.objc = filter(lambda x : x[-2:] == '.m', all_src) def setupWindows(self): print 'Choosing the Windows profile' self.javaHome = os.getenv("JAVA_HOME") if self.javaHome is None : print "environment variable JAVA_HOME must be set" sys.exit(-1) self.jdkInclude = "win32" self.libraries = ["Advapi32"] self.libraryDir = [self.javaHome+"/lib"] self.macros = [ ("WIN32",1) ] self.extra_compile_args = ['/EHsc'] def setupMacOSX(self): #I changed the line below. This is where my JDK root file was located. self.javaHome = '/Developer/SDKs/MacOSX10.6.sdk/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/' self.jdkInclude = "" self.libraries = ["dl"] #I changed the line below to this: self.libraryDir = [self.javaHome+"/Libraries"] self.macros = [('MACOSX',1)] def setupLinux(self): self.javaHome = os.getenv("JAVA_HOME") if self.javaHome is None : self.javaHome = '/usr/lib/jvm/java-1.5.0-sun-1.5.0.08' # Ubuntu linux # self.javaHome = '/usr/java/jdk1.5.0_05' self.jdkInclude = "linux" self.libraries = ["dl"] self.libraryDir = [self.javaHome+"/lib"] def setupPlatform(self): if sys.platform == 'win32' : self.setup…
score: 0
answers question: http://stackoverflow.com/q/25048190
type: Answer

http://stackoverflow.com/q/25023766
has comment: http://stackoverflow.com/comment/38915767
has title: JAR Export throws Null pointer exception on getClass().getResource()
has body: I cloned this project from GitHub in Eclipse (requires Maven to set up quickly). I may or may not tweak it, but I want to export it into a JAR file. https://github.com/eugener/oxbow When I run the test main method in in src/test/java/org/oxbow/swingbits/dialog/table/filter/TableFilterTest.java it runs fine. But when I export the project into a JAR file and use it on my own JTables, I get a null pointer exception. It apparently lost track of the image icons and cannot import them. java.lang.NullPointerException at javax.swing.ImageIcon.&lt;init&gt;(Unknown Source) at org.oxbow.swingbits.table.filter.TableFilterColumnPopup.buildContent(TableFilterColumnPopup.java:173) at org.oxbow.swingbits.popup.PopupWindow$1.popupMenuWillBecomeVisible(PopupWindow.java:67) at javax.swing.JPopupMenu.firePopupMenuWillBecomeVisible(Unknown Source) at javax.swing.JPopupMenu.setVisible(Unknown Source) at javax.swing.JPopupMenu.show(Unknown Source) at org.oxbow.swingbits.popup.PopupWindow.show(PopupWindow.java:110) at org.oxbow.swingbits.table.filter.TableFilterColumnPopup.showFilterPopup(TableFilterColumnPopup.java:278) at org.oxbow.swingbits.table.filter.TableFilterColumnPopup.mouseReleased(TableFilterColumnPopup.java:237) at java.awt.AWTEventMulticaster.mouseReleased(Unknown Source) at java.awt.Component.processMouseEvent(Unknown Source) I don't know much about Maven other than it organizes a project's setup. Can someone please tell me if I'm missing a step?
type: UnansweredQuestion
tagged with: maven
tagged with: getresource
tagged with: swing
has comment: http://stackoverflow.com/comment/38921768
has comment: http://stackoverflow.com/comment/38920899
tagged with: javax.imageio
tagged with: java
type: Question
score: 0
has answer: http://stackoverflow.com/a/25039302
answer count: 1

http://stackoverflow.com/a/24948557
has body: Posting my code. you can understand the concepts and apply in your project. this will work for a single column and not highlight the entire row import javax.swing.*; import javax.swing.table.*; import java.awt.*; class MyTableCellRender extends DefaultTableCellRenderer { public MyTableCellRender() { setOpaque(true); } public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { String number = (String)value; int val = Integer.parseInt(number); if(val &gt; 5){ if(val &gt;= 5000) { setForeground(Color.black); setBackground(Color.red); } else { setForeground(Color.black); setBackground(Color.yellow); } } else{ setBackground(Color.white); setForeground(Color.black); } setText(value !=null ? value.toString() : ""); return this; } }
type: Answer
has comment: http://stackoverflow.com/comment/38775605
has comment: http://stackoverflow.com/comment/38774362
score: 2
has comment: http://stackoverflow.com/comment/38775641
downvote count: 0
answers question: http://stackoverflow.com/q/24948435
accepted answer of: http://stackoverflow.com/q/24948435
has comment: http://stackoverflow.com/comment/38774319
upvote count: 2
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39133382

http://stackoverflow.com/comment/38851557
has text: How to get myTextView?
type: Comment
comment on: http://stackoverflow.com/a/24989045
score: 0
type: AnswerComment

http://stackoverflow.com/comment/84686471
type: AnswerComment
type: Comment
score: 1
has text: @geoand Since Hibernate 5.2 SessionFactory extends EntityManagerFactory. You would consider problems if binding by type of EntityManagerFactory.
comment on: http://stackoverflow.com/a/25064080

http://stackoverflow.com/q/24951758
has comment: http://stackoverflow.com/comment/38780087
has body: my code retrieves an enormous amount of records which results in out of memory error. I am looking for a way to divide what I want to retrieve and process that data, clean the memory, retrieve the rest again.. I could use Rownum but I don't know for sure that for the next retrieval, it will consider only the remaining, non retrieved records. Could anybody help me? Thanks in advance Sam
has comment: http://stackoverflow.com/comment/38811638
upvote count: 1
tagged with: sql
answer count: 1
has comment: http://stackoverflow.com/comment/38811656
tagged with: javabeans
has title: Is there any way to retrieve the records from database in bunches rather than whole?
favorite count: 0
has comment: http://stackoverflow.com/comment/38779789
has answer: http://stackoverflow.com/a/24951783
has comment: http://stackoverflow.com/comment/38811722
downvote count: 0
type: UnansweredQuestion
score: 1
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/38780030

http://stackoverflow.com/comment/38839399
has text: I think parenthesis `(..)` should be evaluated first in an expression.
comment on: http://stackoverflow.com/q/24983606
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/24926401
type: AnsweredQuestion
downvote count: 0
score: 1
has title: Could not resolve property exception for transient property
favorite count: 0
type: Question
tagged with: hbase
answer count: 2
upvote count: 1
accepted answer: http://stackoverflow.com/a/24927330
has answer: http://stackoverflow.com/a/24926618
tagged with: java
tagged with: hibernate
has body: I am trying to apply hibernate criteria on a class which contains a transient field(A list of objects). When I call criteria.list() it throws exception and says that it is not able to resolve that property as it does not have any mapping. I am applying Hibernate Restrictions only on few mapped fields. The partial structure of the class is like this:- @Table(name = "table_records") public class SampleClass implements Serializable { public SampleClass(){ } @Id @GeneratedValue(strategy = GenerationType.TABLE, generator = "table_records_GEN") private Integer id; @Column(name = "start_datetime") private Date startDatetime; @Column(name = "end_datetime") private Date endDatetime; @Transient public List&lt;SomeObject&gt; records; It contains many other fields as well. I am getting error on records field as it is transient. Please suggest.
possible better answer: http://stackoverflow.com/a/24926618
has answer: http://stackoverflow.com/a/24927330

http://stackoverflow.com/a/25024043
answers question: http://stackoverflow.com/q/25023874
type: Answer
score: 2
downvote count: 0
upvote count: 2
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25023874
has body: Your DateTimeFormat doesn't have the correct symbols. M is for month m is for minutes Z is used for the time zone offset (-0700) DateTimeFormatter dtf = DateTimeFormat.forPattern("yyyyMMddhhmmssZ");

http://stackoverflow.com/comment/38884029
score: 0
has text: I think it uses the name of the arguments passed in the method.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25007286

http://stackoverflow.com/comment/38900643
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25016080
has text: Looks like you have broken something. What are you actually using this for and what os?

http://stackoverflow.com/comment/38807815
has text: @ElliottFrisch i maybe lost with the terminologies here but my main goal is to put those `a` and `b` variable in an `ArrayList`. can it be done?
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/24966678
type: Comment

http://stackoverflow.com/a/24914452
type: Answer
has body: you can always write a web app - everybody has a browser if you want java code to run you need jdk/jre - you could give a zip file containing jar and jre as a clunky way to "install" your app jnlp or webstart can help clients load the right version of jre
downvote count: 1
upvote count: 0
answers question: http://stackoverflow.com/q/24914067
score: -1

http://stackoverflow.com/a/32030402
has comment: http://stackoverflow.com/comment/139513386
downvote count: 0
score: 2
has body: For completeness, this was added in Java 5. Here are the relevant parts of JLS Third Edition, which covers Java 5 and 6: 8.8.7.1 Explicit Constructor Invocations ExplicitConstructorInvocation: NonWildTypeArgumentsopt this ( ArgumentListopt ) ; NonWildTypeArgumentsopt super ( ArgumentListopt ) ; Primary. NonWildTypeArgumentsopt super ( ArgumentListopt ) ; NonWildTypeArguments: &lt; ReferenceTypeList &gt; ReferenceTypeList: ReferenceType ReferenceTypeList , ReferenceType 15.12 Method Invocation Expressions MethodInvocation: MethodName ( ArgumentListopt ) Primary . NonWildTypeArgumentsopt Identifier ( ArgumentListopt ) super . NonWildTypeArgumentsopt Identifier ( ArgumentListopt ) ClassName . super . NonWildTypeArgumentsopt Identifier ( ArgumentListopt ) TypeName . NonWildTypeArguments Identifier ( ArgumentListopt ) Note they are called NonWildTypeArguments. The term "Type Witness" does not appear in the JLS. In JLS SE 8, the invocation specs are rewritten to use the pre-existing notion of TypeArguments; and the word "witness" still appears nowhere. (MethodName already includes TypeName.Identifier, so that fifth method invocation defines the explicit usage of a Type Witness, which is why it is not marked optional.)
upvote count: 2
answers question: http://stackoverflow.com/q/24932177
type: Answer

http://stackoverflow.com/q/24950400
tagged with: swing
type: Question
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24950469
possible better answer: http://stackoverflow.com/a/24950471
has answer: http://stackoverflow.com/a/24950454
has answer: http://stackoverflow.com/a/24950471
score: 0
answer count: 3
upvote count: 1
has title: Is it OK to include Java Swing with JSP?
downvote count: 1
tagged with: jsp
has body: I tried using Swing code in a JSP page. To my surprise it does work well and fine. But I cannot judge if it is OK to use Swing with JSP? Basically I want to display some pop up reports from Database. I was thinking to display a JFrame pop up/ applet to do the trick. But do a web browser require any additional plugin for this? Or is it fine to do such a thingy? Any guidance will be helpful.
favorite count: 0
accepted answer: http://stackoverflow.com/a/24950469
tagged with: java

http://stackoverflow.com/q/25030212
linked to: http://stackoverflow.com/q/5928225
accepted answer: http://stackoverflow.com/a/25030319
has title: Linux command "write all used jars by JVM to file" within Java
tagged with: jvm
tagged with: linux
has comment: http://stackoverflow.com/comment/38933390
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/25030361
tagged with: java
has answer: http://stackoverflow.com/a/25030361
has comment: http://stackoverflow.com/comment/38927251
type: Question
has body: I want to know which jars are loaded by all the different running JVM's. If I type "lsof -p $PID | grep jar >> /somefile" from the bash/command, it works beautifully! (replacing $PID with an actual process id). However, I would like to be able to do this from within a Java program. I would expect the following code to work but no file gets written: public static void printCustomCommand(){ String[] pids = {"pidof java"}; String s; try { Process pidProcess = Runtime.getRuntime().exec("pidof java"); BufferedReader br = new BufferedReader(new InputStreamReader(pidProcess.getInputStream())); pids = br.readLine().split(" "); for (String pid : pids){ String cmd = "lsof -p " + pid + " | grep jar &gt;&gt; /somepath/mydumpfile"; Process p; p = Runtime.getRuntime().exec(cmd); System.out.println(p.waitFor()); } //pids = new String(bo).split(" "); } catch (IOException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } When I print the p.waitFor() command, it returns a 1 always, meaning according to the API documentation "something is incorrect". http://docs.oracle.com/javase/6/docs/api/java/lang/Process.html#waitFor%28%29
has comment: http://stackoverflow.com/comment/38927559
has answer: http://stackoverflow.com/a/25030319
score: 0
tagged with: bash
answer count: 2

http://stackoverflow.com/comment/38805847
type: Comment
score: 0
has text: But he isn't using buttons is he? `"One on the keyboard Sorry, shortened it – Chris"`
comment on: http://stackoverflow.com/a/24965645
type: AnswerComment

http://stackoverflow.com/comment/38924304
has text: the problem is it can not make string "\/Date(1440959400000+0530)\/" like this. because of "\". JSON is comming like this "ValueDate":"\/Date(1440959400000+0530)\/"
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25028479

http://stackoverflow.com/a/24937575
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/24937042
type: Answer
score: 2
accepted answer of: http://stackoverflow.com/q/24937042
upvote count: 2
has body: Since you're extending the android.support.v4.app.Fragment for your Fragment you need to use getSupportFragmentManager() rather than getFragmentManager(). In this case be sure to extend FragmentActivity
has comment: http://stackoverflow.com/comment/38752966

http://stackoverflow.com/comment/38925484
comment on: http://stackoverflow.com/q/25025271
score: 0
type: QuestionComment
type: Comment
has text: @GregS Thanks for the feedback. Could you elaborate a bit on why those internal classes shouldn't be used? This may not be most reliable source, but the classes are used in this [tutorial](http://www.java2s.com/Tutorial/Java/0490__Security/CreatingaCertificateinJava.htm)

http://stackoverflow.com/q/24966853
has body: I am new to work by CPLEX. My simplified optimization problem is: objective function: Maximize z1 + z2 + z3 Subject to: c1: x1 - 3 x2 + x3 &lt;= 30 c2: x1 + x2 + x3 &gt;= z1 ... Bounds x1=[0,1] x2=[0,1] ... To model this problem, my code is: public static void main(String[] args) { try { IloCplex cplex = new IloCplex(); IloNumVar[] z = cplex.numVarArray(3, 0.0, 1.0); IloLinearNumExpr objectiveExpr = cplex.linearNumExpr(); IloLinearNumExpr constraintExpr1 = cplex.linearNumExpr(); IloLinearNumExpr constraintExpr3 = cplex.linearNumExpr(); IloNumVar[] x = cplex.numVarArray(3, 0.0, 1.0); for (int i = 1; i &lt; 3; i++){ objectiveExpr.addTerm(1, z[i]); } IloObjective obj = cplex.maximize(objectiveExpr); cplex.add(obj); constraintExpr1.addTerm(1, x[1]); constraintExpr1.addTerm(-3, x[2]); constraintExpr1.addTerm(1, x[3]); cplex.addLe(constraintExpr1, 30); constraintExpr2.addTerm(-1, x[1]); constraintExpr2.addTerm(1, x[2]); constraintExpr2.addTerm(1, x[3]); cplex.addGe(constraintExpr2, z[1]); . . . } catch (IloException e){ System.err.println("Concert exception '" + e + "' caught"); } } The generated model of this code is: objective function: Maximize x1 + 2 x2 + 3 x3 Subject To: c1: x7 - 3 x8 + x9 &lt;= 30 c2: - x1 - x7 + x8 + x9 &lt;= 0 Bounds 0 &lt;= x1 &lt;= 1 ... If it starts to model the constraints from x4 instead of x7, I could distinguish x and z easily.
tagged with: cplex
has comment: http://stackoverflow.com/comment/38809149
score: 0
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/38808468
answer count: 1
has title: creating two kinds of dependent variable using cplex and java
tagged with: optimization
has answer: http://stackoverflow.com/a/24978341
tagged with: linear-programming
type: UnansweredQuestion

http://stackoverflow.com/a/24937731
type: AcceptedAnswer
score: 8
upvote count: 8
type: Answer
has comment: http://stackoverflow.com/comment/38754951
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24937684
has body: I think the best you can do is do it manually. The reason? You will understand what the code does. If you use any tool, you can be sure that in your case, there are going to be errors. And searching for the errors afterwards will be a hell of work.
answers question: http://stackoverflow.com/q/24937684

http://stackoverflow.com/a/24973890
type: Answer
upvote count: 17
has body: I know that the JVM memory model is made for lowest common denominator of CPUs, so it has to assume the weakest possible model of a cpu on which the JVM can run (eg ARM). That's not correct. The JMM resulted from a compromise among a variety of competing forces: the desire for a weaker memory model so that programs can go faster on hardware that have weak memory models; the desire of compiler writers who want certain optimizations to be allowed; and the desire for the result of parallel Java programs to be correct and predictable, and if possible(!) understandable to Java programmers. See Sarita Adve's CACM article for a general overview of memory model issues. Considering that x64 has a fairly strong memory model, what synchronization practices can I ignore assuming I know my program will only run on [x64] CPUs? None. The issue is that the memory model applies not only to the underlying hardware, but it also applies to the JVM that's executing your program, and mostly in practice, the JVM's JIT compiler. The compiler might decide to apply certain optimizations that are allowed within the memory model, but if your program is making unwarranted assumptions about the memory behavior based on the underlying hardware, your program will break. You asked about x64 and atomic 64-bit writes. It may be that no word tearing will ever occur on an x64 machine. I doubt that any JIT compiler would tear a 64-bit value into 32-bit writes as an optimization, but you never know. However, it seems unlikely that you could use this feature to avoid synchronization or volatile fields in your program. Without these, writes to these variables might never become visible to other threads, or they could arbitrarily be re-ordered with respect to other writes, possibly leading to bugs in your program. My advice is first to apply synchronization properly to get your program correct. You might be pleasantly surprised. The synchronization operations have been heavily optimized and can be very fast…
has comment: http://stackoverflow.com/comment/38918470
has comment: http://stackoverflow.com/comment/38908711
score: 17
has comment: http://stackoverflow.com/comment/38865146
has comment: http://stackoverflow.com/comment/38918579
has comment: http://stackoverflow.com/comment/38962934
has comment: http://stackoverflow.com/comment/38874732
has comment: http://stackoverflow.com/comment/38931351
downvote count: 0
has comment: http://stackoverflow.com/comment/38916360
answers question: http://stackoverflow.com/q/24918252

http://stackoverflow.com/q/24917931
has comment: http://stackoverflow.com/comment/38716641
answer count: 2
score: 5
downvote count: 0
favorite count: 0
tagged with: arraylist
possible better answer: http://stackoverflow.com/a/24918153
upvote count: 5
accepted answer: http://stackoverflow.com/a/24918222
linked to: http://stackoverflow.com/q/4697371
has comment: http://stackoverflow.com/comment/38716604
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38716993
tagged with: multithreading
has answer: http://stackoverflow.com/a/24918222
has comment: http://stackoverflow.com/comment/38716501
type: Question
has answer: http://stackoverflow.com/a/24918153
has body: i have an ArrayList that's used to buffer data so that other threads can read them this array constantly has data added to it since it's reading from a udp source, and the other threads constantly reading from that array.Then the data is removed from the array. this is not the actual code but a simplified example : public class PacketReader implements Runnable{ pubic static ArrayList&lt;Packet&gt; buffer = new ArrayList() ; @Override public void run(){ while(bActive){ //read from udp source and add data to the array } } public class Player implements Runnable(){ @Override public void run(){ //read packet from buffer //decode packets // now for the problem : PacketReader.buffer.remove(the packet that's been read); } } The remove() method removes packets from the array and then shifts all the packets on the right to the left to cover the void. My concern is : since the buffer is constantly being added to and read from by multiple threads , would the remove() method make issues since its gonna have to shift packets to the left? i mean if .add() or .get() methods get called on that arraylist at the same time that shift is being done would it be a problem ? i do get index out of bounds exception sometimes and its something like : index : 100 size 300 , which is strange cuz index is within size , so i want to know if this is what may possibly be causing the problem or should i look for other problems . thank you
tagged with: java
has title: multiple threads accessing an ArrayList

http://stackoverflow.com/comment/38777663
type: AnswerComment
comment on: http://stackoverflow.com/a/24950525
has text: Spring has a dedicated `@RestController` annotation with additional behavior.
type: Comment
score: 2

http://stackoverflow.com/comment/38742387
comment on: http://stackoverflow.com/q/24932105
type: QuestionComment
type: Comment
score: 0
has text: I have hundreds of Java projects. They are not eclipse projects. The normal process is creating a new project using the wizard, and changing the location to the project's source directory, and then continuing.

http://stackoverflow.com/comment/38934111
type: Comment
type: QuestionComment
has text: I think `SOAPMessageContext extends MessageContext`. In the mentioned link, you should get `HttpExchange` way for JAX-WS based ws then get remote address.
comment on: http://stackoverflow.com/q/25033435
score: 0

http://stackoverflow.com/a/25028650
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/25028626
upvote count: 2
has body: The class should be (Executable Class should definitely contain the main method with same declaration as below) Class MyClassName { // Methods here public static void main (String args[]) { // Code here } } To Compile, it should be: javac MyClassName.java On successful compilation, MyClassName.class would be generated in your folder. To run, it should be java MyClassName In case your java is in say D:/JavaWorkDir/src, You need to compile and run from the folder D:/JavaWorkDir/src. Also Ensure that your classpath is set appropiately.
type: Answer

http://stackoverflow.com/comment/38844395
type: Comment
has text: ok that's all I wanted to know. thank you ! sorry if I asked the question in a wrong way . I still have to get used to this forum !
comment on: http://stackoverflow.com/a/24986130
type: AnswerComment
score: 0

http://stackoverflow.com/q/25023132
accepted answer: http://stackoverflow.com/a/25023216
has comment: http://stackoverflow.com/comment/38915046
has comment: http://stackoverflow.com/comment/38914413
type: AnsweredQuestion
has title: Where to place a properties file so the java command will see it in the classpath
tagged with: java
possible better answer: http://stackoverflow.com/a/25023207
has body: We have a jar which needs to read a properties file. The properties file needs to edited without rebuilding the application, therefore it is excluded from the build. In order for the application to see the properties file, it is placed it a folder which is on the java classpath. The format of the Windows command line used to run the application is as follows: java -cp application.jar;.\lib_folder\*; com.company.Start Java correctly picks up all the jar files in the lib_folder. The properties file is placed in the same folder, but the application cannot see it and is throwing a FileNotFoundException. Are we doing anything obviously wrong? Thanks very much
type: Question
has answer: http://stackoverflow.com/a/25023336
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/25023207
has answer: http://stackoverflow.com/a/25023216

hbase
tags question: http://stackoverflow.com/q/24926401
type: Tag
tags question: http://stackoverflow.com/q/24923407
tag name: hbase

http://stackoverflow.com/comment/38989205
type: Comment
has text: This is only as accurate as your log calculations are
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25063019

http://stackoverflow.com/a/25003015
answers question: http://stackoverflow.com/q/25001020
score: 1
has body: Cited from: https://github.com/junit-team/junit/wiki/Parameterized-tests The custom runner Parameterized implements parameterized tests. When running a parameterized test class, instances are created for the cross-product of the test methods and the test data elements. Thus, I assume No, that's not possible. If you want to do such a thing I guess that you either (1) will need to construct two test classes one for each test to be executed with the first collection and one for each test to be executed with the second collection or (2) will need to use another mechanism besides the @Parameters annotation, maybe hand-crafted.
downvote count: 0
type: Answer
upvote count: 1

http://stackoverflow.com/comment/39031752
type: Comment
score: 0
comment on: http://stackoverflow.com/a/25072921
has text: I don't understand, please be more clear " would work in the class I declared it in"?. (I have made a few changes in my answer try it)
type: AnswerComment

http://stackoverflow.com/comment/38807664
type: QuestionComment
comment on: http://stackoverflow.com/q/24966611
score: 0
has text: Profile the code or add timing statements to see where the time is being spent. I think a table named SYSTEM is a bad idea.
type: Comment

http://stackoverflow.com/a/24999172
answers question: http://stackoverflow.com/q/24999122
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24999122
type: Answer
has comment: http://stackoverflow.com/comment/38868676
score: 1
has comment: http://stackoverflow.com/comment/38870016
has body: You are calling getNodeType() on a NodeList object (n). You need to call this function on a Node object. Example : n.item(temp).getNodeType();
upvote count: 1
type: AcceptedAnswer

http://stackoverflow.com/comment/38796912
score: 0
type: AnswerComment
type: Comment
has text: I tried that as Eclipse suggested this as well, and it caused a fatal exception at runtime when I tested on the Genymotion emulator.
comment on: http://stackoverflow.com/a/24960760

http://stackoverflow.com/q/25001462
type: AnsweredQuestion
has title: JSONObject parse with gson
downvote count: 0
score: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: gson
has answer: http://stackoverflow.com/a/25001508
type: Question
accepted answer: http://stackoverflow.com/a/25001508
has comment: http://stackoverflow.com/comment/38872899
has comment: http://stackoverflow.com/comment/38872978
upvote count: 1
has comment: http://stackoverflow.com/comment/38872837
answer count: 1
favorite count: 0
tagged with: android
has body: I want to parse my JSONObject with gson. I write some code but doesn't work. public class User { @SerializedName("Email") public static String Email; @SerializedName("Id") public static int Id; @SerializedName("Picture") public static String Picture=null; @SerializedName("UserName") public static String UserName; } In my class: User result=new Gson().fromJson(response,User.class); My JSONObject: { "Email": "", "Id": 1, "Picture": null, "UserName": "User1" }

http://stackoverflow.com/comment/38808190
type: Comment
type: AnswerComment
has text: it did put 2 people in with their id. So I think it worked as you planned but I am not sure if it is what I am looking for. Where is this information saved. it looks a lot like an arraylist. In my project I put students into an arraylist from a CSV.txt then add or take away points. I want these points and names to be saved to DB then after a month of running this program I want to export to excel and wipe the DB. I know an array list will lose the data when I close the program but will this? If it does then you got it right, and please direct me towards a tutorial to help me with the DB
comment on: http://stackoverflow.com/a/24963627
score: 0

http://stackoverflow.com/comment/38923201
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25027303
has text: I created a database from SQLite browser and put it into the assets folder of my project. Am I doing in the right way?

http://stackoverflow.com/a/25039871
type: Answer
answers question: http://stackoverflow.com/q/25038891
score: 0
has body: Use that to iterate over the map and write nice sentences :) for (Entry&lt;Integer, Integer&gt; entry : tokensLength.entrySet()){ System.out.println("There are "+entry.getValue()+" words of length "+entry.getKey()); }

http://stackoverflow.com/a/25020125
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38930288
has comment: http://stackoverflow.com/comment/38910053
has comment: http://stackoverflow.com/comment/38909245
type: Answer
answers question: http://stackoverflow.com/q/25018627
has comment: http://stackoverflow.com/comment/38911037
has comment: http://stackoverflow.com/comment/38928222
accepted answer of: http://stackoverflow.com/q/25018627
has comment: http://stackoverflow.com/comment/38909815
has body: In your code you haven't added any items to the collection. This is why nothing is getting marshalled. The following works for me: Java Model UzivatelSave Same as from your question. Uzivatel public class Uzivatel { } Demo Code Demo import java.util.*; import javax.xml.bind.*; public class Demo { public static void main(String[] args) throws Exception { JAXBContext jc = JAXBContext.newInstance(UzivatelSave.class); List&lt;Uzivatel&gt; uzivatelArrayList = new ArrayList&lt;Uzivatel&gt;(); uzivatelArrayList.add(new Uzivatel()); uzivatelArrayList.add(new Uzivatel()); UzivatelSave uzivatelSave = new UzivatelSave(); uzivatelSave.setUzivatel(uzivatelArrayList); Marshaller marshaller = jc.createMarshaller(); marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); marshaller.marshal(uzivatelSave, System.out); } } Output &lt;?xml version="1.0" encoding="UTF-8" standalone="yes"?&gt; &lt;Uzivatelia&gt; &lt;Uzivatel/&gt; &lt;Uzivatel/&gt; &lt;/Uzivatelia&gt;
score: 0

http://stackoverflow.com/comment/38751814
has text: why do you do that `db = this.getWritableDatabase();`? simply don't.
score: 0
comment on: http://stackoverflow.com/q/24935807
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38786813
type: Comment
has text: Sorry, I don't understand how this is meant to work?
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/24955676

http://stackoverflow.com/comment/38796252
score: 0
type: Comment
type: QuestionComment
has text: You have to create a new `Case` instance for every set of values you're scanning! Add these instances to your array list then.
comment on: http://stackoverflow.com/q/24960513

http://stackoverflow.com/comment/38857160
score: 0
type: AnswerComment
type: Comment
has text: cell extends from the array list created before.
comment on: http://stackoverflow.com/a/24990388

http://stackoverflow.com/comment/38932003
comment on: http://stackoverflow.com/a/25031933
has text: Well, this is SSO. You want to identify the user (= get its name) by his account he is using on his Windows machine.
type: Comment
score: 1
type: AnswerComment

http://stackoverflow.com/q/24949842
answer count: 1
downvote count: 0
tagged with: eclipse-plugin
favorite count: 0
has answer: http://stackoverflow.com/a/24950244
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24950244
score: 1
tagged with: java
upvote count: 1
type: Question
has title: How can I access variable resolving of Eclipse run configurations for an Eclipse plugin?
has body: I want to extend the Sysdeo Tomcat Plugin to be capable of resolving variables like you can specify in run configurations for Java applications, e.g. ${workspace_loc}. I have tried to use this, but the resulting array has no contents: ResourcesPlugin.getWorkspace().getPathVariableManager().getPathVariableNames(); Using this one does not give me the wanted variables: JavaCore.getClasspathVariableNames(); Further I search for the code doing the actual variable replacement in a string.
tagged with: eclipse

http://stackoverflow.com/a/25008741
answers question: http://stackoverflow.com/q/25008658
type: Answer
score: 2
upvote count: 2
has body: You are getting an exception on that line because cur.next.data gets tested before cur.next!=null. Swap them over and the &amp;&amp; will be short circuited correctly avoiding the exception.
downvote count: 0

http://stackoverflow.com/q/25044828
has comment: http://stackoverflow.com/comment/38955553
tagged with: java
has comment: http://stackoverflow.com/comment/38955602
has comment: http://stackoverflow.com/comment/38955329
has answer: http://stackoverflow.com/a/25062337
accepted answer: http://stackoverflow.com/a/25062337
type: Question
has body: I currently have a web app that has certain classes able to connect to my database, but one other class cant.For whatever reason, I have started to get this exception for one of my classes. Here is what I have done: I am working with Java 7 and have ojdbc7 in both my class path and lib folder I have multiple classes who can connect to the url file, yet my other class cant and throws "java.sql.SQLException: No suitable driver found for jdbc:oracle:thin:@someurl" My class is able to access the database AFTER I have connected to it in another class I have a config.properties file that contains the URL, so I know the URL is not at fault and never changes Here is my code where the program fails. I don't connect to the database until I call this method too: public SimpleEntry&lt;String, String&gt; loadOrders(File file) { SimpleEntry&lt;String, String&gt; response = new SimpleEntry&lt;String, String&gt;( "", ""); PreparedStatement st = null; ResultSet rs = null; Connection con = null; try { Scanner scan = new Scanner(file); String header = ""; String trailer = ""; int orderCtr = 0; int valueCtr = 0; String request = ""; ArrayList&lt;HashMap&lt;String, String&gt;&gt; orders = new ArrayList&lt;HashMap&lt;String, String&gt;&gt;(); log.info("Scanning content"); // start to scan content while (scan.hasNextLine()) { String line = scan.nextLine(); Scanner sc = new Scanner(line); sc.useDelimiter("\t"); String type = sc.next(); // differentiates between header, trailer, and content if (type.equals("H")) { header = line; } else if (type.equals("T")) { trailer = line; break; } else { // begin to enter in data appropriately from method's // parameter // key of map = column, value = data being inserted HashMap&lt;String, String&gt; order = new HashMap&lt;String, String&gt;(); // Format: /* * CLIENT_CUSTOMER_ID, FIRST_NAME, LAST_NAME,___, ADDRESS1, * ADDRESS2, CITY, STATE, POSTAL_CODE, PHONE, EMAIL_ADDRESS, * STORE_NUMBER, DELIVERY_METHOD,___, REWARD_VALUE,___,___, * CARD_ACTIVE_DATE, C…
has comment: http://stackoverflow.com/comment/38957200
has comment: http://stackoverflow.com/comment/38956851
score: 0
has comment: http://stackoverflow.com/comment/38955192
tagged with: sql
has title: java.sql.SQLException: No suitable driver found for jdbc:oracle:thin
answer count: 1
has comment: http://stackoverflow.com/comment/38955897
has comment: http://stackoverflow.com/comment/38987594
has comment: http://stackoverflow.com/comment/38957250
tagged with: oracle-database
tagged with: jdbc
linked to: http://stackoverflow.com/q/8053095
type: AnsweredQuestion

http://stackoverflow.com/a/25358397
downvote count: 0
upvote count: 2
answers question: http://stackoverflow.com/q/25010496
type: Answer
score: 2
has body: As an update, I had a look at the JCPP preprocessor and got it working by just wrapping it in a Reader using the CppReader that is included in said preprocessor. This is not really the best (in terms of efficiency at least) approach, you should probably build a TokenStream from JCPP's token stream since here we are lexing twice (once by JCPP in order for it to be able to pre-process and then again by ANTLR) but as a way to get it going it works and at least in my basic test it seems to be preprocessing correctly. So, anyway, here's the code from the question, updated, to preprocess using JCPP: public class AntlrTestMain { public static void main(String[] args) { String mainFileName = "C:\\Users\\Public\\t.c"; try { // Construct the preprocessor with the main file to look at Preprocessor pp = new Preprocessor(new File(mainFileName)); // Set up the preprocessor - you probably want to set more stuff // here than just the include path - have a look in the javadoc List&lt;String&gt; systemInclude = new ArrayList&lt;String&gt;(); systemInclude.add("C:\\MYCPPCOMPILER\\include"); pp.setSystemIncludePath(systemInclude); // Get the parser by wrapping up the preprocessor in a reader CParser parser = new CParser( new CommonTokenStream( new CLexer( new ANTLRInputStream(new CppReader(pp))))); // Use ANTLR to do whatever you want... parser.setBuildParseTree(true); MyListener listener = new MyListener(); ParseTreeWalker.DEFAULT.walk(listener, parser.compilationUnit()); } catch (IOException e) { e.printStackTrace(); } } } You will need these imports for the above code: import java.io.File; import java.io.IOException; import java.util.ArrayList; import java.util.List; import org.anarres.cpp.CppReader; import org.anarres.cpp.Preprocessor; import org.antlr.v4.runtime.ANTLRInputStream; import org.antlr.v4.runtime.CommonTokenStream; import org.antlr.v4.runtime.tree.ParseTreeWalker; import cparser.CLexer; import cparser.CParser;

http://stackoverflow.com/comment/38730889
type: Comment
comment on: http://stackoverflow.com/a/24925134
has text: Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/57888/discussion-between-askmaniac-and-elliott-frisch).
score: 0
type: AnswerComment

http://stackoverflow.com/a/25059410
type: Answer
accepted answer of: http://stackoverflow.com/q/25058715
answers question: http://stackoverflow.com/q/25058715
type: AcceptedAnswer
has body: I have just tested something similar on my local machine using your code. It seems to work fine from what I can see. The only other issue I can see is - if you check the JAR (you can de-compile it), make sure the image you are trying to retrieve is in there and that the filename matches.
score: 0

http://stackoverflow.com/q/24984158
has comment: http://stackoverflow.com/comment/38840498
has body: i am currently doing Android multiple quiz game but i am a bit confused on how to display all the six Questions on a TextView and four Answers on Buttons? also, im not sure how to match the correct/incorrect answer in Android (because it involves Android Syntax). PS: when player press the button whether its correct of incorrect player will move to the next new questions +answers and would it be possible if i want to store the questions and answers on txt file? here is what i have done so far... public class play extends Activity implements OnClickListener { private int correctanswers; private TextView questionstextview; private TextView questionnumber; private TextView playerfeedback; private int totalanswer; private int score; private List&lt;Question&gt; QuestionList; Button answer1,answer2,answer3,answer4; Button AnswerButtons [] = {answer1,answer2,answer3,answer4}; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.play); QuestionList = new ArrayList&lt;Question&gt;(); ArrayList &lt;String&gt; answer = new ArrayList&lt;String&gt;(); answer.add("8"); answer.add("9"); answer.add("3"); answer.add("1"); QuestionList.add(new Question("what is 4+4", answer, 0)); answer.add("17"); answer.add("20"); answer.add("15"); answer.add("14"); QuestionList.add(new Question("what is 7+8?", answer, 3)); answer.add("20"); answer.add("30"); answer.add("19"); answer.add("34"); QuestionList.add(new Question("what is 10+10?", answer, 0)); answer.add("12"); answer.add("11"); answer.add("13"); answer.add("14"); QuestionList.add(new Question("what is 6+6?", answer, 0)); answer.add("6"); answer.add("5"); answer.add("4"); answer.add("7"); QuestionList.add(new Question("what is 4+3?", answer, 3)); answer.add("7"); answer.add("9"); answer.add("10"); answer.add("11"); QuestionList.add(new Question("what is 3+7?", answer, 2)); questionstextview = (TextView) findViewById (R.id.questionstextview); questionnumber = (TextView) …
tagged with: android
type: AnsweredQuestion
tagged with: syntax
has title: Display array on Android button and textview
accepted answer: http://stackoverflow.com/a/24985149
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/38841910
tagged with: arrays
score: 0
answer count: 1
tagged with: button
has answer: http://stackoverflow.com/a/24985149

http://stackoverflow.com/q/24952015
tagged with: getter-setter
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/38815837
favorite count: 0
tagged with: immutability
has comment: http://stackoverflow.com/comment/38884337
accepted answer: http://stackoverflow.com/a/24988519
type: AnsweredQuestion
score: 3
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/38782287
type: Question
has body: I have maven findbug plugin version 2.5.4, and in my code it shows me error: .getDateRlpx() may expose internal representation by returning Price.dateRlpx .setDateRlpx(Date) may expose internal representation by storing an externally mutable object into Price.dateRlpx However in my code I use: public Date getDateRlpx() { return DateUtil.immutableDate(dateRlpx); } public void setDateRlpx(final Date dateRlpx) { this.dateRlpx = DateUtil.immutableDate(dateRlpx); } And my immutableDate: public static Date immutableDate(final Date sourceDate) { if (sourceDate == null) { return null; } return new Date(sourceDate.getTime()); } Why does findbug show this error? I created a new Date object. I even tried simple return new Date(dateRlpx.getTimes()) but it also did not work. I could not find any solution.
tagged with: encapsulation
tagged with: findbugs
has title: Findbug immutable date fixes do not work
has answer: http://stackoverflow.com/a/24988519

http://stackoverflow.com/q/25007532
has answer: http://stackoverflow.com/a/25007591
accepted answer: http://stackoverflow.com/a/25007591
has title: StringOutOfBoundsException for substring
has body: I'm currently trying to the run the following on a text file (sample.text) that contains the following lines: personPersistenceType=SQLite3 personDbConnectionString=person.sqlite3 However I'm getting an StringOutOfBoundsException (result -1). I understand that it means it can't find the = symbol, but I'm not sure why. I'm trying to get everything before the = symbol to be a String key and everything after the = symbol for a String value. import java.util.Scanner; public class TextReader { private Scanner input = new Scanner("sample.txt"); public void loadFile(){ while(input.hasNextLine()){ String line = input.nextLine(); //acquires line String key = line.substring(0, line.indexOf('=')); //key String value = line.substring(line.indexOf('=') + 1); //value config.setProperty(key, value); } } }
has answer: http://stackoverflow.com/a/25007561
type: AnsweredQuestion
tagged with: java
type: Question
possible better answer: http://stackoverflow.com/a/25007561
score: 0
answer count: 2

http://stackoverflow.com/comment/38816208
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24969545
has text: @ErwinBolwidt ?? Minimal – Use as little code as possible that still produces the same problem, Complete – Provide all parts needed to reproduce the problem. That means it has to be Minimal **and** Complete?

http://stackoverflow.com/q/25032000
tagged with: loops
has comment: http://stackoverflow.com/comment/38930540
answer count: 7
has comment: http://stackoverflow.com/comment/38930472
has answer: http://stackoverflow.com/a/25032082
has body: Sorry if this question was asked (probably many times), but I couldn't find an answer. I'm learning Java and I've made a simple code. It's asking for 2 numbers, comparing it and uses If to give some results. It's working good, but I try to loop it. gram is in loop while i give first number value as 10. This won't work like this, because "First cannot be resolved to a variable" because it's inside a loop. Ok I understand, but is there any way I can make this work with variable inside loop ? import java.util.Scanner; public class Loop { public static void main(String[] args) { do { System.out.println("give me 2 numbers: "); String FirstNum, SecNum; Scanner FirstRead = new Scanner(System.in); Scanner SecRead = new Scanner(System.in); FirstNum = FirstRead.nextLine(); SecNum = SecRead.nextLine(); int First = Integer.parseInt(FirstNum); // changing String to int int Second = Integer.parseInt(SecNum); // changing String to int // Playing with loop if (First == Second) { System.out.println("First " + First + " is same as "+ Second); } else { System.out.println("Number " + First + " is different then " + Second); } } while(First == 10); System.out.print("We're done here, because first number is 10"); } }
has comment: http://stackoverflow.com/comment/38930571
has answer: http://stackoverflow.com/a/25032116
has answer: http://stackoverflow.com/a/25032301
has comment: http://stackoverflow.com/comment/38930512
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38930568
has comment: http://stackoverflow.com/comment/38930776
has comment: http://stackoverflow.com/comment/38930514
has answer: http://stackoverflow.com/a/25032221
has answer: http://stackoverflow.com/a/25032278
accepted answer: http://stackoverflow.com/a/25032301
type: Question
linked to: http://stackoverflow.com/q/7370174
has comment: http://stackoverflow.com/comment/38930531
has comment: http://stackoverflow.com/comment/38930582
possible better answer: http://stackoverflow.com/a/25032043
has answer: http://stackoverflow.com/a/25032439
has answer: http://stackoverflow.com/a/25032043
score: 0
tagged with: java
has title: Java "while" - variable inside the loop

http://stackoverflow.com/comment/38820760
type: AnswerComment
comment on: http://stackoverflow.com/a/24973617
has text: The problem is not in the array execution but in the `ArrayList` recursive call execution.
type: Comment
score: 0

http://stackoverflow.com/comment/38862478
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24995695
has text: Sounds logic but if you take this rule literally, the rule would be still true if you are able to create objects of a class extending `Class`.

http://stackoverflow.com/comment/38899285
type: QuestionComment
comment on: http://stackoverflow.com/q/25014355
type: Comment
has text: Thank you Eypros for your Help, But I know that `first.migrationMap` shouldn't have a large size because the `for` loop executed only 198 times but the added items in `first.migrationMap` are 1341312!. `first.migrationMap` should have only one item (size=1). Even though I tried by increasing my VM memory to 1500m but the result was the same before.
score: 0

http://stackoverflow.com/comment/38988109
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25062506
score: 2
has text: And please follow the java code convention. Methods shouldn't start with capitals: `setNumber()` instead of `Setnumber()`

http://stackoverflow.com/comment/38998263
comment on: http://stackoverflow.com/q/25067021
type: Comment
score: 0
has text: ??????? is correct, the problem is that you cannot see the characters it represents, because the font does not have glyphs for those characters. (so then the font uses ?'s instead)
type: QuestionComment

soap
tags question: http://stackoverflow.com/q/25032814
tags question: http://stackoverflow.com/q/24919047
tags question: http://stackoverflow.com/q/25030989
tags question: http://stackoverflow.com/q/24917712
tags question: http://stackoverflow.com/q/25059114
type: Tag
tags question: http://stackoverflow.com/q/25060937
tags question: http://stackoverflow.com/q/25009365
tags question: http://stackoverflow.com/q/24991871
tags question: http://stackoverflow.com/q/24927864
tags question: http://stackoverflow.com/q/25020392
tags question: http://stackoverflow.com/q/24915008
tags question: http://stackoverflow.com/q/25003958
tags question: http://stackoverflow.com/q/24990801
tags question: http://stackoverflow.com/q/25033435
tags question: http://stackoverflow.com/q/25051294
tags question: http://stackoverflow.com/q/25045688
tags question: http://stackoverflow.com/q/24998524
tags question: http://stackoverflow.com/q/24994544
tags question: http://stackoverflow.com/q/24938472
tags question: http://stackoverflow.com/q/25052913
tags question: http://stackoverflow.com/q/25045147
tags question: http://stackoverflow.com/q/24998830
tags question: http://stackoverflow.com/q/24923755
tags question: http://stackoverflow.com/q/25049734
tags question: http://stackoverflow.com/q/25038393
tags question: http://stackoverflow.com/q/25018587
tags question: http://stackoverflow.com/q/24998257
tags question: http://stackoverflow.com/q/24960172
tags question: http://stackoverflow.com/q/25015416
tag name: soap

http://stackoverflow.com/comment/38754800
type: Comment
has text: Glad you found a solution. Personally, I don't think this makes your tests neater.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/24937704

http://stackoverflow.com/comment/38922980
comment on: http://stackoverflow.com/a/24993785
score: 0
type: AnswerComment
has text: That would be using jar xvf to unpack other packages and then using mv to move their classes to the target folder and then using jar cvf to create the target jar. Is it the elegant way? Is there any alternative ways? @Keshava
type: Comment

permissions
tag name: permissions
tags question: http://stackoverflow.com/q/25048190
type: Tag
tags question: http://stackoverflow.com/q/24964393

http://stackoverflow.com/comment/38993774
type: Comment
type: QuestionComment
has text: better to share the code to reproduce the issue. The issue in your code itself.
score: 0
comment on: http://stackoverflow.com/q/25065506

http://stackoverflow.com/q/24939965
tagged with: locking
accepted answer: http://stackoverflow.com/a/24943174
has comment: http://stackoverflow.com/comment/38760549
has title: Java synchronized block with while loop and Thread.sleep()
score: 0
answer count: 1
tagged with: multithreading
has answer: http://stackoverflow.com/a/24943174
has body: I have two HashMaps that I would like to synchronize in a class. The reason I'm maintaining two maps is that I dispatch a task to different servers, and I maintain the original task object in one HashMap&lt;String, Task&gt;, and at the same time I manage the response status in another HashMap&lt;String, HashMap&lt;InetAddress, TaskResponse&gt;. The keys of both HashMaps are String which is unique to each Task object. So my code goes like this: HashMap&lt;String, Map&lt;InetAddress, TaskResponse&gt;&gt; taskResponseMap = new HashMap&lt;&gt;(); HashMap&lt;String, Task&gt; taskMap = new HashMap&lt;&gt;(); public void endpointHasRespondedCallback(TaskResponse taskResponse, InetAddress from) { // Callback threads gets blocked here! synchronized(taskResponseMap) { synchronized (taskMap) { Map&lt;InetAddress, TaskResponse&gt; taskResponses = taskResponseMap.get(taskResponse.taskUuid); if (taskResponses == null || !taskResponses.containsKey(from)) { // The response does not exists probably due to timeout return; } taskResponses.put(from, taskResponse); } } } public void sendTaskToAllEndpoints(Task task) { long taskStartedAt = System.currentTimeMillis(); HashMap&lt;InetAddress, TaskResponse&gt; taskResponses = new HashMap&lt;&gt;(); taskResponseMap.put(task.taskUuid, taskResponses); taskMap.put(task.taskUuid, task); for (InetAddress dest : getDestinationNodes()) { sendTaskTo(dest, task); messageResponses.put(dest, TaskResponse.emptyTaskResponse()); } // Should wait for response to comeback till the timeout is over while (System.currentTimeMillis() &lt; taskStartedAt + timeoutInMillis) { Thread.sleep(1000); synchronized(taskResponseMap) { synchronized (taskMap) { if(isTaskOver(task.taskUuid)) { Map&lt;InetAddress, TaskResponse&gt; responses = taskResponseMap.remove(task.taskUuid); taskMap.remove(task.taskUuid); task.taskIsDone(responses); return; } } } } // If the task is still sitting there, then it must have timed out! synchronized(taskResponseMap) { synchronized (taskMap) …
has comment: http://stackoverflow.com/comment/38762982
has comment: http://stackoverflow.com/comment/38759833
type: AnsweredQuestion
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/4437527

http://stackoverflow.com/q/25043935
tagged with: dereference
tagged with: java
has answer: http://stackoverflow.com/a/25044103
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/38953283
has title: Check if folder is empty without reference issues
has answer: http://stackoverflow.com/a/25044094
has comment: http://stackoverflow.com/comment/38953398
has answer: http://stackoverflow.com/a/25044453
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25044103
possible better answer: http://stackoverflow.com/a/25044094
has body: The code below sorts an array of files that it reads from a directory. The only problem is that if the folder is empty then I get a null pointer exception. I have tried a few different ways of checking first if the folder is empty and then executing the below code, but they all used if statements which took this code out of scope. Is there a way I could check if the directory is empty and if it is skip over this code? //sort array listOfFiles by time (oldest to newest) File folder = new File(dbBackupLocation + "/" + dbHost); File[] listOfFiles = folder.listFiles(); Arrays.sort(listOfFiles, new Comparator&lt;File&gt;() { @Override public int compare(File f1, File f2) { return Long.valueOf(f1.lastModified()).compareTo(f2.lastModified()); } }); Edit: NullPointerException on line Arrays.sort(listOfFiles, new Comparator&lt;File&gt;() { I used Elliott Frisch code: File folder = new File(dbBackupLocation + "/" + dbHost); File[] listOfFiles = folder.listFiles(); if (listOfFiles != null &amp;&amp; listOfFiles.length &gt; 0) { // The array isn't empty. Arrays.sort(listOfFiles, new Comparator&lt;File&gt;() { @Override public int compare(File f1, File f2) { return Long.valueOf(f1.lastModified()) .compareTo(f2.lastModified()); } }); } But when I try to use listOfFiles like: for(File s : listOfFiles) { i++; } I am apparently dereferencing it?
type: Question

http://stackoverflow.com/a/25068215
has comment: http://stackoverflow.com/comment/39002542
has comment: http://stackoverflow.com/comment/39003103
has comment: http://stackoverflow.com/comment/39028357
has comment: http://stackoverflow.com/comment/39003369
has comment: http://stackoverflow.com/comment/39001846
has comment: http://stackoverflow.com/comment/39002010
has comment: http://stackoverflow.com/comment/39002876
has comment: http://stackoverflow.com/comment/39003231
has comment: http://stackoverflow.com/comment/39002448
answers question: http://stackoverflow.com/q/25067538
score: 1
has comment: http://stackoverflow.com/comment/39002576
has comment: http://stackoverflow.com/comment/39003057
has comment: http://stackoverflow.com/comment/39003119
upvote count: 1
has comment: http://stackoverflow.com/comment/39002165
has comment: http://stackoverflow.com/comment/39003214
has comment: http://stackoverflow.com/comment/39028195
has comment: http://stackoverflow.com/comment/39002378
has comment: http://stackoverflow.com/comment/39001289
has comment: http://stackoverflow.com/comment/39003088
has comment: http://stackoverflow.com/comment/39027170
has comment: http://stackoverflow.com/comment/39003193
has comment: http://stackoverflow.com/comment/39001740
has comment: http://stackoverflow.com/comment/39001638
has comment: http://stackoverflow.com/comment/39002861
has comment: http://stackoverflow.com/comment/39002692
has comment: http://stackoverflow.com/comment/39003428
has comment: http://stackoverflow.com/comment/39000072
downvote count: 0
has comment: http://stackoverflow.com/comment/39002849
has comment: http://stackoverflow.com/comment/39002910
has body: From the looks of your HQL, you'd like to join the two tables using stratety in the Customer table and product in the Rate table. This would imply that strategy is a foreign key. If this is indeed a one-to-one relationship, then inside of CardDetails, try this: @OneToOne @JoinColumn(name = "product", referencedColumnName = "strategy") private EmployeeDetails employeeDetails; This assumes you don't already have product mapped as a property in CardDetails, if you do, you'll need to do it this way, otherwise Hibernate will complain about duplicate field mappings. @Column(name = "product", columnDefinition = "char") private String product; @OneToOne @JoinColumn(name = "product", referencedColumnName = "strategy", insertable = false, updatable = false) private EmployeeDetails employeeDetails; If it needs to be a one-to-many relationship, then do it this way: @Column(name = "product", columnDefinition = "char") private String product; @OneToMany @JoinColumn(name = "product", referencedColumnName = "strategy", insertable = false, updatable = false) private List&lt;EmployeeDetails&gt; employeeDetails;
has comment: http://stackoverflow.com/comment/39002826
has comment: http://stackoverflow.com/comment/39003351
has comment: http://stackoverflow.com/comment/39003574
has comment: http://stackoverflow.com/comment/39002860
type: Answer
has comment: http://stackoverflow.com/comment/39002719
has comment: http://stackoverflow.com/comment/39003460

http://stackoverflow.com/comment/38881440
type: Comment
has text: So, if you already have a `sleep` and it's throwing an `InterruptedException`, why don't you just catch the exception and break the loop?
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25003107

http://stackoverflow.com/comment/38841635
comment on: http://stackoverflow.com/q/24984787
has text: [`java.util.set`](http://docs.oracle.com/javase/7/docs/api/java/util/Set.html) offers an `addAll` (union, or 'or' method) and a `retainAll` (intersection, or 'and' method). So perhaps you're best off using `Set`s that support those operations if you can manage it, or else converting your lists to sets if it's not too expensive, and leveraging what already exists.
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/comment/38875096
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25002093
type: Comment
has text: Ah very well wasn't aware of that, thanks! I'm currently checking out the link Stanislav left below in the answer. If you do have time I kindly ask you to check it out and give me your thoughts on it, whether I should use Base64 encoding or the method provided in the link - https://gist.github.com/slevental/0c902da60a1f6f931420

http://stackoverflow.com/comment/38724507
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24922153
has text: can you try moving @ClassRule part to `SomeTest`

http://stackoverflow.com/a/24937591
answers question: http://stackoverflow.com/q/24937539
type: Answer
score: 2
upvote count: 3
downvote count: 1
has body: This is also a problem for EasyMock Basically whenever you use a Matcher on one argument, you need to use them on all the arguments when(queryBus.handle(isA(VehicleCollection.class), any(GetVehicle.class))).thenAnswer(null); Should work I added isA(Class) which creates a matcher to make sure the argument type matches the given class.
has comment: http://stackoverflow.com/comment/38759616

http://stackoverflow.com/comment/38755313
has text: I think every one can understand this personally which can affect on the answer and depending on that, it doesn't matter how much experience has the person, he/she will gave an answer which is very possible that it is not correct. I've asked this question to many people and they gave me different answers. The part of them looks to the class/interface as top level and the other part is not agree with that because it is against to the class definition (so class can be also not top level).
comment on: http://stackoverflow.com/a/24929637
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/38953324
has text: @Andreas I believe your comment actually answers the question
comment on: http://stackoverflow.com/q/25037568
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38951780
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24989404
has text: @ChrisO see edit. Thats what I kind of want to do.
score: 0

http://stackoverflow.com/comment/38852797
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24990304
has text: 1) For better help sooner, post an [MCVE](http://stackoverflow.com/help/mcve) (Minimal, Complete, Verifiable Example). 2) Use a logical & consistent code formatting style! The code indentation is intended to help people follow the program flow. 3) A single blank line of white space is *always* enough. Blank lines after `{` or before `}` are also typically redundant. 4) *"The Center Panel Class.."* which is a `Center_Panel` should just be a `JPanel`. [Prefer composition to inheritance](http://en.wikipedia.org/wiki/Composition_over_inheritance).

http://stackoverflow.com/a/52493605
downvote count: 0
type: Answer
has body: You can also solve this issue by adding these lines in the pom file: org.apache.hadoop hadoop-client x.x.x The HDFS version numbers are listed in this site
answers question: http://stackoverflow.com/q/25022657
upvote count: 2
score: 2

http://stackoverflow.com/q/25019784
has comment: http://stackoverflow.com/comment/38908216
has comment: http://stackoverflow.com/comment/38907988
has answer: http://stackoverflow.com/a/25073862
has comment: http://stackoverflow.com/comment/38918968
has comment: http://stackoverflow.com/comment/39048187
answer count: 1
favorite count: 0
tagged with: cordova
upvote count: 5
tagged with: android
has title: Chromium WebView does not exist
type: AnsweredQuestion
has body: I am trying to create a Hello World app using Phonegap but it crashes when I call run the application on emulator. I followed the guideline here. Here is what I have on MainActivity.java : package com.example.hello; import android.os.Bundle; import org.apache.cordova.*; public class HelloWorld extends CordovaActivity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); super.init(); // Set by <content src="index.html" /> in config.xml super.loadUrl(Config.getStartUrl()); //super.loadUrl("file:///android_asset/www/index.html"); } } Here is my AndroidManifest.xml : <?xml version='1.0' encoding='utf-8'?> <supports-screens android:anyDensity="true" android:largeScreens="true" android:normalScreens="true" android:resizeable="true" android:smallScreens="true" android:xlargeScreens="true" /> <uses-permission android:name="android.permission.INTERNET" /> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> <uses-sdk android:minSdkVersion="10" android:targetSdkVersion="20" /> Here is the first errors I get : Chromium WebView does not exist FATAL EXCEPTION: main java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.deneme/com.example.deneme.MainActivity}: java.lang.UnsupportedOperationException Can you tell me what is wrong with the application? Thanks.
downvote count: 0
linked to: http://stackoverflow.com/q/25003504
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/25073862
score: 5
has comment: http://stackoverflow.com/comment/39047724

http://stackoverflow.com/q/25062436
duplicate of: http://stackoverflow.com/q/18552005
favorite count: 0
linked to: http://stackoverflow.com/q/18552005
has comment: http://stackoverflow.com/comment/38989024
linked to: http://stackoverflow.com/q/22789413
has title: Is there a mapIndex stream function in java 8?
answer count: 0
type: UnansweredQuestion
upvote count: 1
tagged with: java-8
has body: I want to do this: Foo[] foos = new Foo[6]; Blah[] blahs = new Blah[6]; ..... Arrays.stream(foos) .mapIndex((Foo foo,int index) -&gt; "" + foo[index] + blahs[index]) .collect(...) Is there any standard way to do this? Maybe a standard jdk map "mapindex" function?
score: 1
tagged with: java
type: Question
downvote count: 0

http://stackoverflow.com/q/24967459
has body: This program is supposed to print an error if you enter too many seats. If i enter an invalid number of seats ex: economy section has 8 seats. but if I enter a number greater than that it, the program doesn't go on to the else statement and print the error message. Instead it just goes through the if statement and does the calculations with the invalid seat number. import java.util.Scanner; public class FlightProfit { String location; int TOLEDO_FARE = 200; int HOUSTON_FARE = 300; int BOISE_FARE = 400; int economySeats; int businessSeats; int firstClassSeats; int economySales; int businessSales; int firstClassSales; //int totalSales = economySales + businessSales + firstClassSales; Scanner in = new Scanner(System.in); public int addEconomySeats() { System.out.print("Enter number of economy seats 1-8: "); economySeats = in.nextInt(); if(economySeats &gt; 0 || economySeats &lt; 9) { return economySeats; } else { System.out.println("Error: Only 8 seats available in economy."); } return 0; } public int addBusinessSeats() { System.out.print("Enter number of business seats sold: "); businessSeats = in.nextInt(); if(businessSeats &gt; 0 || economySeats &lt; 7) { return businessSeats; } else { System.out.println("Error: Only 6 seats available in business."); } return 0; } public int addFirstClassSeats() { System.out.print("Enter number of first class seats sold: "); firstClassSeats = in.nextInt(); if(firstClassSeats &gt; 0 || firstClassSeats &lt; 5) { return firstClassSeats; } else { System.out.println("Error: Only 4 seats available in first class."); } return 0; } public void getProfit(String loc) { location = loc; if(location.equalsIgnoreCase("toledo")) { economySales = economySeats * TOLEDO_FARE; businessSales = businessSeats * (2 * TOLEDO_FARE); firstClassSales = firstClassSeats * (4 * TOLEDO_FARE); System.out.println("Economy Sales: " + economySeats + " seats: " + economySales); System.out.println("Business Sales: " + businessSeats + " seats: " + businessSales); System…
accepted answer: http://stackoverflow.com/a/24967466
has answer: http://stackoverflow.com/a/24968366
tagged with: if-statement
upvote count: 0
answer count: 3
has answer: http://stackoverflow.com/a/24967481
favorite count: 0
has title: program will not go to else statement
has answer: http://stackoverflow.com/a/24967466
possible better answer: http://stackoverflow.com/a/24967481
score: -3
type: AnsweredQuestion
tagged with: java
downvote count: 3
type: Question

http://stackoverflow.com/a/24917246
has comment: http://stackoverflow.com/comment/38714920
type: AcceptedAnswer
downvote count: 0
has body: Your alias name is sc, your column name is user_id, so it should be "from Student_Course as sc where sc.user_id=?" instead.
upvote count: 2
type: Answer
score: 2
accepted answer of: http://stackoverflow.com/q/24917093
has comment: http://stackoverflow.com/comment/38716223
answers question: http://stackoverflow.com/q/24917093

http://stackoverflow.com/q/24994544
has comment: http://stackoverflow.com/comment/38859948
tagged with: java
has comment: http://stackoverflow.com/comment/38861230
has body: After I getting my response in SOAP I have as a result Object like this: Object result = envelope.getResponse(); result :[['1/10/2014 11:10:00 PM',1.5,2.2,55.9],['10/10/2014 12:30:00 AM',88.88,88.12,88.99],.....] casting it to SoapObject throws : "java.lang.ClassCastException: org.ksoap2.serialization.SoapPrimitive" SoapObject response = (SoapObject) envelope.getResponse(); // throws error So I tried: SoapPrimitive resultsString = (SoapPrimitive)envelope.getResponse(); and I getting a result the same result Object. ADDED: tried SoapObject response = (SoapObject)envelope.bodyIn; and got a result: GetCodesResponse{GetCodesResult=[['1/10/2014 11:10:00 PM',1.5,2.2,55.9]....];} It all return String , and I don't have an option to iterate through it. How can I run loop through result, create an Object type MyCustomClass with the contractor MyCustomClass(Data d,double a, double b, double c) from each Array element and insert them into ArrayList&lt;MyCustom&gt;
has comment: http://stackoverflow.com/comment/38861149
has comment: http://stackoverflow.com/comment/38861956
tagged with: arraylist
score: 0
has comment: http://stackoverflow.com/comment/38860619
has title: Looping through SOAP array Object response
tagged with: soap
linked to: http://stackoverflow.com/q/5799775
has comment: http://stackoverflow.com/comment/38860340
answer count: 0
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/5167341
type: Question

http://stackoverflow.com/a/24931763
score: 0
type: Answer
has body: To answer your specific question, Iterables has a find method which takes a Predicate. I am not sure how "fancy" it is, you would have to implement a Predicate class which does the id comparison. I will echo @JoachimIsaksson, though, this seems like you really would benefit from a Map&lt;Integer,MyObject&gt;.
answers question: http://stackoverflow.com/q/24931525

http://stackoverflow.com/a/51361376
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/25009717
upvote count: 2
type: Answer
has body: I've just cleaned up my disk space and restart computer. That have helped me.

http://stackoverflow.com/comment/39255838
score: 0
has text: Changing the color to 'transparent' doesn't remove the excess space. It just matches the space's color to that of the background.
type: AnswerComment
comment on: http://stackoverflow.com/a/25200752
type: Comment

http://stackoverflow.com/comment/38701269
type: Comment
comment on: http://stackoverflow.com/q/24910262
type: QuestionComment
score: 0
has text: In this `\ncommand1\n command2 \n`, you want double spaces at the center?

http://stackoverflow.com/comment/38783117
has text: What does it means `I used some sort of "\033[31;1m%1$d\033[0m" to change color`? Which color you tried to change?
comment on: http://stackoverflow.com/q/24953653
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25019324
tagged with: zeromq
has comment: http://stackoverflow.com/comment/38907905
tagged with: java
has comment: http://stackoverflow.com/comment/38907633
has answer: http://stackoverflow.com/a/25080662
type: Question
has comment: http://stackoverflow.com/comment/38908261
has comment: http://stackoverflow.com/comment/38907864
has answer: http://stackoverflow.com/a/25100202
has comment: http://stackoverflow.com/comment/38907481
linked to: http://stackoverflow.com/q/24804359
has comment: http://stackoverflow.com/comment/38907750
has answer: http://stackoverflow.com/a/25151745
tagged with: ios
accepted answer: http://stackoverflow.com/a/25151745
upvote count: 11
has comment: http://stackoverflow.com/comment/38907725
has comment: http://stackoverflow.com/comment/38909917
has comment: http://stackoverflow.com/comment/38908084
linked to: http://stackoverflow.com/q/10829371
answer count: 3
tagged with: android
has comment: http://stackoverflow.com/comment/38925973
has comment: http://stackoverflow.com/comment/38907052
favorite count: 0
has title: How to synchronize data amongst devices in Wi-Fi
has comment: http://stackoverflow.com/comment/38917633
has comment: http://stackoverflow.com/comment/39011838
has comment: http://stackoverflow.com/comment/38908508
has body: I am developing an app for iOS and Android. The basic functionality is to keep a certain set of data synchronized across all devices in a Wi-Fi network without a central server. Every device can modify that set of data. The current approach is to discover the other devices via Bonjour/Zeroconf and then send the "change messages" to all devices via ZeroMQ. As both Frameworks cause quite a lot of problems to implement I am asking if this is the correct way to accomplish this. I had most of the logic implemented with Bonjour and HTTP-Requests sent to all devices. The problem was simply network requests which would not get received even after three tries because the network failed. I want to have some kind of reconstruction of a general state or a more reliable messaging framework. Would some kind of Gossip approach to spread the information as well as discover all devices be better?
has comment: http://stackoverflow.com/comment/38960536
score: 11
has comment: http://stackoverflow.com/comment/39020006
has comment: http://stackoverflow.com/comment/38909077
type: AnsweredQuestion
downvote count: 0
possible better answer: http://stackoverflow.com/a/25100202

http://stackoverflow.com/comment/38910003
has text: I am not allowed to post code specifics online unfortunately but i can say since each of the projects has a different POM and they all work for everyone else on my team and none work for me that is likely not the issue.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25020838

http://stackoverflow.com/a/24947520
downvote count: 0
has comment: http://stackoverflow.com/comment/38773611
has comment: http://stackoverflow.com/comment/38775078
has comment: http://stackoverflow.com/comment/38772156
type: Answer
has body: What you have String item_list = itemList.toString(); You need to parse items_list which is a JSONArray. JSONArray itemList = new JSONArray(c.getString("item_list")); // loop through the array itemList and get the items for(int i=0;i&lt;itemList.length();i++) { String item = itemList.getString(i); // item at index i } Now you can add the strings to a list/array and then do what is required.
has comment: http://stackoverflow.com/comment/38772735
has comment: http://stackoverflow.com/comment/38772168
accepted answer of: http://stackoverflow.com/q/24947477
upvote count: 5
answers question: http://stackoverflow.com/q/24947477
score: 5
type: AcceptedAnswer

http://stackoverflow.com/a/24914245
has body: When you want to update an adapter, you can't just update the list of objects: you must update the adapter too. To do that, I always use this method : void updateAdapter() { //Delete the content of the adapter adapter.clear(); //Add new content to the adapter (datas is an arrayList of MyObject) for (MyObject obj : datas) { adapter.add(obj); } adapter.notifyDataSetChanged(); listView.setAdapter(adapter); } Hope it'll help
downvote count: 1
score: -1
has comment: http://stackoverflow.com/comment/38718701
upvote count: 0
answers question: http://stackoverflow.com/q/24913970
type: Answer

http://stackoverflow.com/q/24989790
accepted answer: http://stackoverflow.com/a/24989946
has comment: http://stackoverflow.com/comment/38851208
has answer: http://stackoverflow.com/a/24990004
has comment: http://stackoverflow.com/comment/38851202
has comment: http://stackoverflow.com/comment/38851190
answer count: 4
favorite count: 0
linked to: http://stackoverflow.com/q/23653778
has comment: http://stackoverflow.com/comment/38852082
has answer: http://stackoverflow.com/a/24989946
tagged with: android
score: -4
has title: Whats wrong with my code? Android simple list view example
has comment: http://stackoverflow.com/comment/38851275
has body: I am creating simple listview from string array. i watched many tutorials all are saying the same just 3 lines enough to make it work.I am doing the same but still getting NPE , almost frustrated with this issue. Could not figure out whats went wrong please help me. My code is here: Mainfiest: &lt;uses-sdk android:minSdkVersion="16" android:targetSdkVersion="18" /&gt; MainActivity.java public class MainActivity extends Activity { ListView lv; String[] days = new String[] { "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday"}; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); lv = (ListView) findViewById(R.id.listView1); if (savedInstanceState == null) { getFragmentManager().beginTransaction().add(R.id.container, new PlaceholderFragment()).commit(); } ArrayAdapter&lt;String&gt; adapter = new ArrayAdapter&lt;String&gt;(this, android.R.layout.simple_list_item_1, days); lv.setAdapter(adapter); } public static class PlaceholderFragment extends Fragment { public PlaceholderFragment() { } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_main, container, false); return rootView; } } }
downvote count: 4
has comment: http://stackoverflow.com/comment/38851061
type: AnsweredQuestion
upvote count: 0
has answer: http://stackoverflow.com/a/24989919
has comment: http://stackoverflow.com/comment/38851140
tagged with: java
type: Question
possible better answer: http://stackoverflow.com/a/24989919
has answer: http://stackoverflow.com/a/24990092
has comment: http://stackoverflow.com/comment/38851018
has comment: http://stackoverflow.com/comment/38851200
tagged with: listview

http://stackoverflow.com/a/24998677
downvote count: 0
has comment: http://stackoverflow.com/comment/38880766
has comment: http://stackoverflow.com/comment/38868492
upvote count: 2
type: Answer
answers question: http://stackoverflow.com/q/24998580
score: 2
has body: You can use some html: String adam = "Adam"; String str = "Na Adam ne ne yere Hawa: Na Adam xwoo xbabarima"; String newString = str.replaceAll("Adam", adam); t.setText(Html.fromHtml(newString));
has comment: http://stackoverflow.com/comment/38867819
has comment: http://stackoverflow.com/comment/38868326
has comment: http://stackoverflow.com/comment/38868105
has comment: http://stackoverflow.com/comment/38868673

http://stackoverflow.com/a/59089502
score: 1
has body: I would think that in the case of using .scheduleWithFixedDelay(...) (or scheduleAtFixedRate(...)), the get() method of the returned ScheduledFuture&lt;?&gt; feels indeed as an odd fit. I believe you won't ever receive anything from the get() method, just expect an exception to be thrown from it, when Runnable is cancelled. Surely one can see a use-case for this ;-) see JavaDoc https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/ScheduledExecutorService.html#scheduleAtFixedRate-java.lang.Runnable-long-long-java.util.concurrent.TimeUnit- Returns: a ScheduledFuture representing pending completion of the task, and whose get() method will throw an exception upon cancellation
downvote count: 0
answers question: http://stackoverflow.com/q/25049021
type: Answer
upvote count: 1

http://stackoverflow.com/q/25056107
has answer: http://stackoverflow.com/a/25068987
tagged with: full-text-search
has answer: http://stackoverflow.com/a/25110477
has body: I am working on Java project [Maven]. I am confused in one point. I don't know what is logiclaly corect. Problem is as follows :- Sentence is given, and from their I have extract some particular words. Solution that I found I make one regex and put in Constants class. Whenever I have to add more words, I simply appended words in regex. This solves the problem. I am confused here I am thinking, if I put numbers of text files in resources folder where each text file denotes one regex expression. REGEX = (?:A|B|C|D) A, B, C, D = Word(String) Is it a good idea ? If not please suggest any other.
type: UnansweredQuestion
has title: Best way to store words for given scenerio
tagged with: maven
tagged with: regex
tagged with: project
tagged with: java
has comment: http://stackoverflow.com/comment/38976793
type: Question
has comment: http://stackoverflow.com/comment/38976607
score: 0
answer count: 2

http://stackoverflow.com/comment/38793780
type: Comment
has text: *"How to convert java or class file to exe file"* Why? Java has [Java Web Start](http://stackoverflow.com/tags/java-web-start/info) to launch rich client apps. JWS works on Windows, OS X and *nix.
score: 0
comment on: http://stackoverflow.com/q/24959282
type: QuestionComment

jar
tags question: http://stackoverflow.com/q/24919624
tags question: http://stackoverflow.com/q/24981078
tags question: http://stackoverflow.com/q/24948050
tags question: http://stackoverflow.com/q/25043162
tags question: http://stackoverflow.com/q/24939448
tags question: http://stackoverflow.com/q/24938123
tags question: http://stackoverflow.com/q/25068400
tags question: http://stackoverflow.com/q/25052998
tags question: http://stackoverflow.com/q/25047912
tags question: http://stackoverflow.com/q/25020890
tags question: http://stackoverflow.com/q/24940217
tags question: http://stackoverflow.com/q/24930062
tags question: http://stackoverflow.com/q/25048280
tags question: http://stackoverflow.com/q/24924088
tags question: http://stackoverflow.com/q/24954952
tags question: http://stackoverflow.com/q/24984437
tags question: http://stackoverflow.com/q/24997280
tags question: http://stackoverflow.com/q/24993736
tags question: http://stackoverflow.com/q/24929469
tags question: http://stackoverflow.com/q/24949045
tags question: http://stackoverflow.com/q/24944304
tags question: http://stackoverflow.com/q/25040118
type: Tag
tags question: http://stackoverflow.com/q/24991507
tags question: http://stackoverflow.com/q/24930336
tags question: http://stackoverflow.com/q/24909667
tags question: http://stackoverflow.com/q/24997128
tags question: http://stackoverflow.com/q/25001624
tags question: http://stackoverflow.com/q/25056800
tags question: http://stackoverflow.com/q/25038986
tags question: http://stackoverflow.com/q/25009024
tags question: http://stackoverflow.com/q/25068178
tags question: http://stackoverflow.com/q/25058715
tags question: http://stackoverflow.com/q/25047740
tags question: http://stackoverflow.com/q/24928673
tags question: http://stackoverflow.com/q/24916770
tags question: http://stackoverflow.com/q/24975930
tag name: jar
tags question: http://stackoverflow.com/q/24965015
tags question: http://stackoverflow.com/q/25044052
tags question: http://stackoverflow.com/q/24958303
tags question: http://stackoverflow.com/q/24976166
tags question: http://stackoverflow.com/q/25016591
tags question: http://stackoverflow.com/q/24961180
tags question: http://stackoverflow.com/q/25060206
tags question: http://stackoverflow.com/q/24990187
tags question: http://stackoverflow.com/q/25051032
tags question: http://stackoverflow.com/q/25002230
tags question: http://stackoverflow.com/q/25030048
tags question: http://stackoverflow.com/q/24948632
tags question: http://stackoverflow.com/q/25051683
tags question: http://stackoverflow.com/q/25047187
tags question: http://stackoverflow.com/q/24941004
tags question: http://stackoverflow.com/q/24923561
tags question: http://stackoverflow.com/q/25061695
tags question: http://stackoverflow.com/q/24963702
tags question: http://stackoverflow.com/q/24914067
tags question: http://stackoverflow.com/q/25060178
tags question: http://stackoverflow.com/q/24952825
tags question: http://stackoverflow.com/q/25005946
tags question: http://stackoverflow.com/q/24945083
tags question: http://stackoverflow.com/q/24964598
tags question: http://stackoverflow.com/q/24914555
tags question: http://stackoverflow.com/q/24986376

http://stackoverflow.com/q/24999229
has comment: http://stackoverflow.com/comment/38868744
has body: I am preparing for the OCA Java SE 7 from a Enthuware question book and I get a different output when I compile in Eclipse running Java 1.7 compiler: public class TestClass { void probe(int x) { System.out.println("In ...");} //1 void probe(Integer x) { System.out.println("In Integer");} //2 void probe(long x) { System.out.println("In long");} //3 void probe(Long x) { System.out.println("In LONG");} //4 public static void main(String[] args){ Integer a = 4; new TestClass().probe(a); //5 int b = 4; new TestClass().probe(b); //6 } } The books output is: 'In Integer and In long' and the output in Eclipse shows 'In Integer and In...'. Please help me verify which is the correct answer. Thanks!
has comment: http://stackoverflow.com/comment/38870549
type: AnsweredQuestion
tagged with: overloading
possible better answer: http://stackoverflow.com/a/38239483
accepted answer: http://stackoverflow.com/a/24999554
has answer: http://stackoverflow.com/a/38239483
tagged with: java
tagged with: eclipse
type: Question
score: 0
has comment: http://stackoverflow.com/comment/42706069
answer count: 2
has title: Compiler has different output than OCAJP preparation book Overloading methods
has answer: http://stackoverflow.com/a/24999554

http://stackoverflow.com/a/25048638
accepted answer of: http://stackoverflow.com/q/25048620
has comment: http://stackoverflow.com/comment/38962728
answers question: http://stackoverflow.com/q/25048620
has body: Don't use the keyword new as a variable name. Try something like String str = value + scale; The Java tutorial on variables states, towards the bottom: Also keep in mind that the name you choose must not be a keyword or reserved word. Here are Java's keywords, and new is one of them.
type: AcceptedAnswer
type: Answer
score: 8
downvote count: 0
upvote count: 8

http://stackoverflow.com/q/24986279
favorite count: 0
upvote count: 8
has comment: http://stackoverflow.com/comment/38844659
has comment: http://stackoverflow.com/comment/38852639
tagged with: lambda
tagged with: java-8
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38844977
has answer: http://stackoverflow.com/a/25101439
tagged with: java
type: Question
has title: Java 8 generics + exceptions compile time error when using a lambda expression
has comment: http://stackoverflow.com/comment/38844598
has comment: http://stackoverflow.com/comment/38844635
accepted answer: http://stackoverflow.com/a/25101439
has comment: http://stackoverflow.com/comment/38884355
has body: A couple of days ago, I started refactoring some code to use the new Java 8 Streams library. Unfortunately, I ran into a compile time error when performing Stream::map with a method which is declared to throw a generic E that is further specified to be a RuntimeException. Interesting enough, the compile time error goes away when I switch to using a method reference. Is this a bug, or is my method reference not equivalent to my lambda expression? (Also, I know I can replace p->p.execute(foo) with Parameter::execute. My actual code has additional parameters for the execute method). Error message Error:(32, 43) java: unreported exception E; must be caught or declared to be thrown Code import java.util.ArrayList; import java.util.List; public class JavaBugTest { interface AbleToThrowException&lt;E extends Exception&gt; { } interface Parameter { public &lt;E extends Exception&gt; Object execute(AbleToThrowException&lt;E&gt; algo) throws E; } interface ThrowsRuntimeException extends AbleToThrowException&lt;RuntimeException&gt; { } static ThrowsRuntimeException foo; public static Object manualLambda(Parameter p) { return p.execute(foo); } public static void main(String[] args) { List&lt;Parameter&gt; params = new ArrayList&lt;&gt;(); params.stream().map(p -&gt; p.execute(foo)); // Gives a compile time error. params.stream().map(JavaBugTest::manualLambda); // Works fine. } } System setup OS: Windows x64 Java compiler version: Oracle JDK 1.8.0_11 IDE: Intellij
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/38859579
tagged with: generics
score: 8

http://stackoverflow.com/q/24989103
tagged with: swing
answer count: 1
has title: Repaint through ActionListener not getting executed
has answer: http://stackoverflow.com/a/24989176
tagged with: java
type: UnansweredQuestion
has body: I have tried reading similar questions on stack overflow, but I am not able to get a concrete solution. So, I am posting it back. I am calling repaint on the click of a button. As in paint function, I draw the objects randomly. I suppose they should move, when I click the button. But, nothing happens when I click the button. Does anybody knows why such a behavior is happening and how to solve this? import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.ArrayList; import java.util.Collections; import java.util.Random; import javax.swing.BorderFactory; import javax.swing.BoxLayout; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.SwingUtilities; import javax.swing.WindowConstants; @SuppressWarnings("serial") public class Filter extends JFrame { public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { public void run() { Filter mainFrame = new Filter(); mainFrame.setVisible(true); } }); } public Filter() { //Creating the JFrame main window setSize(800, 500); setTitle("Particle Filter"); setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); setLocation(100, 100); getContentPane().setLayout(new BoxLayout(this.getContentPane(), BoxLayout.X_AXIS)); //creates two panels content and sidebar. Sidebar has null layout JPanel content = new JPanel(); content.setPreferredSize(new Dimension(700,500)); content.setBackground(Color.LIGHT_GRAY); this.getContentPane().add(content); JPanel sidebar = new JPanel(); sidebar.setBackground(Color.LIGHT_GRAY); sidebar.setPreferredSize(new Dimension(100,500)); this.getContentPane().add(sidebar); sidebar.setLayout(null); //creates three buttons in sidebar JButton start_button = new JButton("START"); start_button.setBounds(10, 75, 77, 23); start_button.addActionListener(new MainPanel()); sidebar.add(start_button); JButton stop_button = new JButton("STOP"); …
type: Question
score: 0

http://stackoverflow.com/q/25050073
has answer: http://stackoverflow.com/a/31733960
downvote count: 0
accepted answer: http://stackoverflow.com/a/31733960
favorite count: 0
has title: Why does an Apache CXF 2.7.8 in WebLogic Application Server 12c client ignore FIN from the server?
possible better answer: http://stackoverflow.com/a/25434785
has comment: http://stackoverflow.com/comment/38965409
tagged with: web-services
type: AnsweredQuestion
tagged with: cxf
tagged with: java
has body: I have an Apache CXF 2.7.8 consumer calling another SOAP web service. In my development environment (Tomcat 6.0, jdk1.7.0_51, Windows 7) everything works charmingly. However; when I deploy the code to a test environment (WebLogic 12.1, jdk1.7.0_51, RHEL 6), I get a javax.xml.ws.WebServiceException: Could not send Message exception, caused by java.net.SocketTimeoutException: Read time out after x millis on every second request. Both the development and test instances call the exact same server. When I perform a network trace, I see that CXF sends many requests using the same socket connection (thanks to HTTP Keep-Alive). Eventually, the server sends a FIN indicating that the client should stop using this connection (and establish a new one, if need be). The client acknowledges the FIN, but then continues to send the next request on the same socket, despite having been told to disconnect (and acknowledging that directive). The server then sends an RST (as expected), telling the client to go away. The client then tries again. Eventually, enough time has elapsed that we reach the Read timeout, and the SocketTimeoutException above is thrown. (As an aside: On the windows development platform, the client honors the FIN and establishes a new socket connection for the next request). When I disable HTTP Keep-Alive (using the instructions here), the Server sends the FIN after only a single request is sent by the client (exactly as it should). The client still acknowledges the FIN with an ACK for that frame, and then boldly continues trying to use that socket. I would love to have HTTP Keep-Alive working, but I would settle for the darn thing working without it. Are there any recommended solutions or next steps for troubleshooting?
tagged with: http
type: Question
has answer: http://stackoverflow.com/a/25434785
tagged with: weblogic
score: 5
upvote count: 5
has comment: http://stackoverflow.com/comment/38965203
answer count: 2
has comment: http://stackoverflow.com/comment/51482110
linked to: http://stackoverflow.com/q/5270981

http://stackoverflow.com/q/25043513
tagged with: build
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/25043589
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/70368132
has title: Not abstract and does not override abstract method
answer count: 3
has body: I'm having an issue with this piece of Java code. When trying to build the program to which this code belongs too, I get back this error : [javac] C:\eRA\cc284-src\reporting\jsp\test\net\sourceforge\cruisecontrol\mock\MockServletRequest.java:59: error: MockServletRequest is not abstract and does not override abstract method &lt;T&gt;upgrade(Class&lt;T&gt;) in HttpServletRequest Here is my code: package net.sourceforge.cruisecontrol.mock; import java.io.BufferedReader; import java.io.IOException; import java.io.UnsupportedEncodingException; import java.security.Principal; import java.util.Enumeration; import java.util.Locale; import java.util.Map; import java.util.HashMap; import java.util.Collections; import java.util.ArrayList; import javax.servlet.RequestDispatcher; import javax.servlet.ServletInputStream; import javax.servlet.http.Cookie; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpSession; public class MockServletRequest implements HttpServletRequest { private String contextPath = ""; private String servletPath; private Map params = new HashMap(); private String pathInfo; private Locale locale; public void httpservletrequest() { } public MockServletRequest() { } public MockServletRequest(String contextPath, String servletPath) { this.contextPath = contextPath; this.servletPath = servletPath; } public Object getAttribute(String name) { return null; } public Enumeration getAttributeNames() { return null; } public String getCharacterEncoding() { return null; } public int getContentLength() { return 0; } public String getContentType() { return null; } public ServletInputStream getInputStream() throws IOException { return null; } public String getParameter(String paramName) { ArrayList values = (ArrayList) params.get(paramName); if (values == null || values.isEmpty()) { return null; // param not found } return (String) values.get(0); } public Enumeration getParameterNames() { return Collections.enumeration(params.keySet()); } public St…
has comment: http://stackoverflow.com/comment/38952389
has answer: http://stackoverflow.com/a/25043733
favorite count: 0
has answer: http://stackoverflow.com/a/37459668
upvote count: 2
type: UnansweredQuestion

http://stackoverflow.com/comment/38775665
type: Comment
type: QuestionComment
has text: Show the method `setProfileId` in `ProfilePictureView`.
comment on: http://stackoverflow.com/q/24940816
score: 0

http://stackoverflow.com/comment/38702689
has text: Well what is already in your .m2 folder currently?
score: 0
comment on: http://stackoverflow.com/q/24910955
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38922665
comment on: http://stackoverflow.com/q/25027534
has text: Oh, I should clarify something in my main post. doing so now... but, my 'map' is a randomly generated thing each time is my issue... but I thank you a tonne for the bufferedImage referral!
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/24947266
type: Question
tagged with: akka
downvote count: 0
favorite count: 0
tagged with: maven-shade-plugin
has body: How can I run SUIM examples which package Akka in a fat jar? Following the project's readme, I get the error below, to the effect that Akka configuration elements are missing. I'm using Maven as a build tool. Several sites say I can fix this problem by using the Maven shade plugin. Building with the shade plugin as recommended, I still get the same error. So I suppose I'm doing it wrong. Can someone spot what I'm missing - or point out what additional thing I need to be doing? I've added the shade plugin config below to the examples pom in the SUIM source code and rebuilt. Naturally, I expect the author was able to run this, somehow without the shade plugin. So if there's a way to bypass that entirely, please let me know. Configuration: org.apache.maven.plugins maven-shade-plugin 2.3 <shadedArtifactAttached>true</shadedArtifactAttached> allinone *:* *:* META-INF/*.SF META-INF/*.DSA META-INF/*.RSA reference.conf META-INF/spring.handlers META-INF/spring.schemas edu.cmu.lti.suim.examples.App package shade Error: $ java -cp ./suim-examples/target/suim-examples-0.0.1-SNAPSHOT-jar-with-dependencies.jar edu.cmu.lti.suim.examples.App local[2] SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder". SLF4J: Defaulting to no-operation (NOP) logger implementation SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details. Exception in thread "main" com.typesafe.config.ConfigException$Missing: No configuration setting found for key 'akka.remote.log-received-messages' at com.typesafe.config.impl.SimpleConfig.findKey(SimpleConfig.java:126) at com.typesafe.config.impl.SimpleConfig.find(SimpleConfig.java:146) at com.typesafe.config.impl.SimpleConfig.find(SimpleConfig.java:151) at com.typesafe.config.impl.SimpleConfig.find(SimpleConfig.java:151) at com.typesafe.config.impl.SimpleConfig.find(SimpleConfig.java:119) at com.typesafe.config.impl.SimpleConfig.find(SimpleConfig.java:157) at com.typesafe.config.impl.SimpleConfig.getBoolean(SimpleConfig.java:167…
answer count: 0
type: UnansweredQuestion
tagged with: maven
upvote count: 1
has title: How can I run SUIM examples which package Akka in a fat jar?
score: 1
tagged with: java

http://stackoverflow.com/comment/38742962
type: Comment
has text: While your observations are correct `KeyStroke.getKeyStroke('e')` or `KeyStroke.getKeyStroke(Character.valueOf('e'), 0)` result in a `keycode` of `0`, not `VK_E` or `69`...
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24932445

http://stackoverflow.com/a/25001429
type: Answer
upvote count: 1
downvote count: 1
answers question: http://stackoverflow.com/q/25001331
score: 0
has body: Use a ConcurrentHashMap&lt;Integer, MyClass&gt; to store your data. This data structure can safely be shared and updated between multiple threads.

http://stackoverflow.com/comment/38798374
comment on: http://stackoverflow.com/q/24941686
has text: For a complete list of dependencies and detailed complication instructions, please see the [wiki on github](https://github.com/kwhat/jnativehook/wiki/How-to-build-JNativeHook-from-source#system-requirements-2). If you're building form src, please consider building the trunk. Version 1.1 has a lot of problems in it that have already been resolved. Version 1.2 RC 1 is a little late, but binaries should be ready as soon as I finish up a few of the [outstanding issues](https://code.google.com/p/jnativehook/issues/list).
score: 0
type: Comment
type: QuestionComment

joystick
type: Tag
tags question: http://stackoverflow.com/q/24941832
tag name: joystick

http://stackoverflow.com/comment/38832955
type: AnswerComment
score: 0
type: Comment
has text: however I tired to Override my registration but still no joy, if you can give me more advice about it that would be amazing, I checked the code for registration is posted now. thanks
comment on: http://stackoverflow.com/a/24979940

http://stackoverflow.com/q/24935991
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/72961534
has title: Is it possible to overload javax validation annotations to read in multiple data types?
tagged with: validation
has body: I'm using custom validations from javax.validator; @Min, @Max. I've made custom annotations though. Is there a way to use a single annotation for multiple datatypes? If my annotation is roughly: @Target( { METHOD, FIELD, ANNOTATION_TYPE }) @Retention(RUNTIME) @Constraint(validatedBy = CustomValidator.class) @Documented public @interface CustomAnnotation{ /* Annotation code */ } and my validator is roughly: public class CustomValidator implements ConstraintValidator&lt;CustomAnnotation, int&gt; { @Override public void initialize(CustomAnnoation constraintAnnotation) { /* Init Code */ } @Override public boolean isValid(int object, ConstraintValidatorContext constraintContext) { /* isValid Code */ } } This would make an annotation that only accepts int inputs. How could I overload the annotation to also accept, say doubles?
score: 0
type: UnansweredQuestion
tagged with: annotations
tagged with: java
has answer: http://stackoverflow.com/a/24936556

http://stackoverflow.com/a/25031697
score: 0
has body: Check are you getting same response while orientation changes or without orientation changes? If yes, then use global variable (bitmap) for storing downloaded image using asynctask. Then inside "onConfigurationChanged(..)" set that downloaded image to your ImageView. This will surely solve your problem.
type: Answer
answers question: http://stackoverflow.com/q/25031159

http://stackoverflow.com/a/24944648
score: 0
type: Answer
answers question: http://stackoverflow.com/q/24944454
has body: I apologize if i'm not understanding the question, but what about nested for loops? for(int i = 0; i &lt; params.size(); i++) { for(int j = 0; j &lt; params.get(i).size(); j++) { } } Would this work? edit: I figured out what algorithm you work looking for and the recursive solution is: public static String recursive(List&lt;Object[]&gt; params) { String result = ""; if(Params.isEmpty()) return result; Object[] objects = params.remove(0); for(Object i : objects) { result += i.toString(); List&lt;Object[]&gt; newParams = new ArrayList&lt;&gt;(newParams); result += recursive(newParams); } return result; }

spring-validator
tags question: http://stackoverflow.com/q/25037473
tag name: spring-validator
tags question: http://stackoverflow.com/q/25056937
type: Tag

http://stackoverflow.com/a/25008611
has body: I don't have a clear answer for you but I'll provide you with the steps to get the assembly and you can dissect it based on your use case. Make sure that your method that you are interested in is compiled to assembly I usually use 2 for loops to ruin escape analysis and make sure my code is not marked NOP Make sure you are running a debug JVM build or have built the HotSpot disassembler - instructions to build on a Mac. Run your program with java -XX:+UnlockDiagnosticVMOptions -XX:+PrintAssembly Be ready to see some optimised code. Also there is a GUI tool for analysing and visualising the log file of the JIT compiler, it is called JITWatch. Here is the class I whipped up to test this with, probably somewhat verbose but got myMethod and doSomething both to compile to assembly. public class Question { public static void main(String[] args) { long result = 0; for (int i = 0; i &lt; 100; i++) { for (int j = 0; j &lt; 100; j++) { result += myMethod(); } } System.out.println(result); } private static long myMethod() { try { return doSomething(); } catch (Exception e) { return 100; } } private static long doSomething() { if (System.currentTimeMillis() % 2 == 0) return System.currentTimeMillis(); else throw new RuntimeException(); } }
type: Answer
score: 3
answers question: http://stackoverflow.com/q/25007427
upvote count: 3
downvote count: 0

swing
tags question: http://stackoverflow.com/q/24981186
tags question: http://stackoverflow.com/q/25009445
tags question: http://stackoverflow.com/q/24977871
tags question: http://stackoverflow.com/q/24913058
tags question: http://stackoverflow.com/q/24978799
tags question: http://stackoverflow.com/q/24986736
tags question: http://stackoverflow.com/q/24964794
tags question: http://stackoverflow.com/q/24989103
tags question: http://stackoverflow.com/q/24945292
tags question: http://stackoverflow.com/q/25019050
tags question: http://stackoverflow.com/q/24961677
tags question: http://stackoverflow.com/q/24937213
tags question: http://stackoverflow.com/q/24985784
tags question: http://stackoverflow.com/q/25007809
tags question: http://stackoverflow.com/q/24999622
tags question: http://stackoverflow.com/q/24986768
tags question: http://stackoverflow.com/q/24968105
tags question: http://stackoverflow.com/q/24918884
tags question: http://stackoverflow.com/q/24963807
tags question: http://stackoverflow.com/q/24918877
tags question: http://stackoverflow.com/q/25028884
tags question: http://stackoverflow.com/q/24953653
tags question: http://stackoverflow.com/q/24918931
tags question: http://stackoverflow.com/q/24914907
tags question: http://stackoverflow.com/q/24966974
tags question: http://stackoverflow.com/q/25025715
tags question: http://stackoverflow.com/q/24971437
tags question: http://stackoverflow.com/q/25007113
tags question: http://stackoverflow.com/q/24923159
tags question: http://stackoverflow.com/q/24943241
tags question: http://stackoverflow.com/q/24980758
tags question: http://stackoverflow.com/q/25041263
tags question: http://stackoverflow.com/q/25030089
tags question: http://stackoverflow.com/q/25058795
tags question: http://stackoverflow.com/q/25057147
tags question: http://stackoverflow.com/q/25031328
tags question: http://stackoverflow.com/q/25010068
tags question: http://stackoverflow.com/q/25018884
tags question: http://stackoverflow.com/q/25053364
tags question: http://stackoverflow.com/q/24927025
tags question: http://stackoverflow.com/q/24952514
tags question: http://stackoverflow.com/q/25002954
tags question: http://stackoverflow.com/q/25008513
tags question: http://stackoverflow.com/q/24963190
tags question: http://stackoverflow.com/q/25007303
tags question: http://stackoverflow.com/q/25061538
tags question: http://stackoverflow.com/q/24975362
tags question: http://stackoverflow.com/q/24992469
tags question: http://stackoverflow.com/q/24932977
tags question: http://stackoverflow.com/q/24913954
tags question: http://stackoverflow.com/q/25048193
tags question: http://stackoverflow.com/q/25000035
tags question: http://stackoverflow.com/q/25005302
tags question: http://stackoverflow.com/q/24988797
type: Tag
tags question: http://stackoverflow.com/q/25032880
tags question: http://stackoverflow.com/q/25002050
tags question: http://stackoverflow.com/q/25068926
tags question: http://stackoverflow.com/q/24981422
tags question: http://stackoverflow.com/q/24981478
tags question: http://stackoverflow.com/q/25015808
tags question: http://stackoverflow.com/q/24955331
tags question: http://stackoverflow.com/q/24964856
tags question: http://stackoverflow.com/q/24979898
tags question: http://stackoverflow.com/q/24971336
tags question: http://stackoverflow.com/q/24983411
tags question: http://stackoverflow.com/q/25003990
tags question: http://stackoverflow.com/q/24925714
tags question: http://stackoverflow.com/q/24975898
tags question: http://stackoverflow.com/q/24975286
tags question: http://stackoverflow.com/q/24964539
tags question: http://stackoverflow.com/q/24988444
tags question: http://stackoverflow.com/q/24921877
tags question: http://stackoverflow.com/q/24985939
tags question: http://stackoverflow.com/q/25036047
tags question: http://stackoverflow.com/q/25056675
tags question: http://stackoverflow.com/q/25068976
tags question: http://stackoverflow.com/q/24978917
tags question: http://stackoverflow.com/q/25062274
tags question: http://stackoverflow.com/q/25068749

http://stackoverflow.com/a/27015346
score: 1
accepted answer of: http://stackoverflow.com/q/25013251
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/25013251
type: Answer
has comment: http://stackoverflow.com/comment/98900724
has body: Since It seems that there is no easy way to do this, I wrote a workaround. If I enable Logging on the finest level, too many details are reported. So I wrote my own Log Message Filter. Logger wsitlogger = Logger.getLogger("com.sun.xml.wss.logging.impl.opt.signature"); wsitlogger.setLevel(Level.FINEST); TextAndLevelFilter logFilter= new TextAndLevelFilter(Level.INFO); logFilter.addPrefix("WSS1764"); wsitlogger.setFilter(logFilter); and my TextLevelFilter.java: public class TextAndLevelFilter implements Filter { private static final int offValue = Level.OFF.intValue(); private final int levelValue; private final Collection&lt;String&gt; prefixes = new LinkedList&lt;&gt;(); public TextAndLevelFilter(Level level) { this.levelValue = level.intValue(); } public void addPrefix(String prefix) { prefixes.add(prefix); } @Override public boolean isLoggable(LogRecord record) { final String message = record.getMessage(); for (String prefix : prefixes) { if (message.startsWith(prefix)) { return true; } } return record.getLevel().intValue() &gt;= levelValue &amp;&amp; levelValue != offValue; } }
upvote count: 1

http://stackoverflow.com/q/24927310
score: 0
answer count: 1
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24928415
tagged with: java
has body: I got a special character from ASCII value and created a presentation by inputting that character using docx4j library. If I want to print "£" mark it print with "Â£". Is there a special way to input special characters to the PPT. I used following code. String iChar = new Character((char)163).toString(); t.setTextContent(iChar);
type: Question
tagged with: docx4j
has comment: http://stackoverflow.com/comment/38737117
has title: Input Special characters to PPTX using docx4j

http://stackoverflow.com/comment/38862405
has text: can you please show code for how to pass "Path" to intent ?
type: Comment
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/24995868

http://stackoverflow.com/comment/38858044
type: Comment
score: 0
comment on: http://stackoverflow.com/a/24978806
has text: @user3859736 See the additions to my answer.
type: AnswerComment

http://stackoverflow.com/q/24966920
has comment: http://stackoverflow.com/comment/38808220
tagged with: class
has body: This is my code so far, I am uncertain of how to make it so the output is in descending order or from highest to lowest. Any help would be very much appreciated.
has comment: http://stackoverflow.com/comment/38808247
answer count: 1
tagged with: arrays
has comment: http://stackoverflow.com/comment/38808329
score: 0
accepted answer: http://stackoverflow.com/a/24967011
has comment: http://stackoverflow.com/comment/38808382
has answer: http://stackoverflow.com/a/24967011
type: Question
type: AnsweredQuestion
has title: How to put letter frequency code in descending order
has comment: http://stackoverflow.com/comment/38808281
tagged with: java

http://stackoverflow.com/q/24992701
has comment: http://stackoverflow.com/comment/38856774
has answer: http://stackoverflow.com/a/24992789
favorite count: 0
has comment: http://stackoverflow.com/comment/38856607
accepted answer: http://stackoverflow.com/a/24992988
answer count: 4
type: AnsweredQuestion
score: 3
has comment: http://stackoverflow.com/comment/38856861
downvote count: 0
possible better answer: http://stackoverflow.com/a/24992836
tagged with: java
has answer: http://stackoverflow.com/a/24992988
duplicate of: http://stackoverflow.com/q/7679819
has answer: http://stackoverflow.com/a/24992836
tagged with: collections
type: Question
has body: I want a HashMap where the keys are ordered in the way I added them. So I am using LinkedHashMap. It has a predictable iteration order. If you use put, the inserted key will be at the end of the map's key set. Would it be possible to use put, inserting the key/object pair at a specific position? For instance, I'd like to put something at index 2, effectively making this pair the third entry upon iteration.
linked to: http://stackoverflow.com/q/7679819
has comment: http://stackoverflow.com/comment/38856445
upvote count: 3
has answer: http://stackoverflow.com/a/30526920
has title: Putting a pair at a specific position in a LinkedHashMap

http://stackoverflow.com/a/29027265
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/24924484
has body: I found some Java implementation here : https://github.com/Matroska-Org/jebml but didn't use it by myself.
type: Answer
upvote count: 1
accepted answer of: http://stackoverflow.com/q/24924484
score: 1

http://stackoverflow.com/comment/62129493
has text: And this is for beryllium
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/37302561

http://stackoverflow.com/q/24916160
has answer: http://stackoverflow.com/a/24916263
type: Question
score: 0
tagged with: jsoup
answer count: 1
tagged with: http-get
tagged with: android
tagged with: http://stackoverflow.com/tag/html
accepted answer: http://stackoverflow.com/a/24916263
has title: HTML code retrieved using HttpGet does not return the full page
has body: When trying to pull all of the HTML code off of this website http://www.gasbuddy.com/GB_Price_List.aspx I run into the problem that only half of the page is put into my String. I have tried several methods found all over SO, and other sources from Google searching, and none have worked to solve my issue. This is my code that retrieves the page: private class InternetGasBuddyConnection extends AsyncTask&lt;String, String, String&gt; { protected String doInBackground(String... urls) { StringBuilder response = new StringBuilder(30000); DefaultHttpClient client = new DefaultHttpClient(); HttpGet httpGet = new HttpGet(URL); String result = ""; try { HttpResponse execute = client.execute(httpGet); InputStream content = execute.getEntity().getContent(); BufferedReader buffer = new BufferedReader(new InputStreamReader(content)); String s = ""; while ((s = buffer.readLine()) != null) response.append(s); Log.d("before changing and parsing", response.toString()); Document doc = Jsoup.parse(response.toString(), URL); result = response.toString(); Log.d("no parsing", result.toString()); result = doc.toString(); Log.d("after parsing", result); } catch (Exception e) { Log.e("Darrell", result, e); e.printStackTrace(); } return result; } @Override public void onPostExecute(final String result) { Log.d("onPostExcecute()", result); htmlDoc = result; } } when I call the Log.d("after parsing", result); code, it displays this in my logcat: 07-23 13:19:57.833: D/after parsing(32136): &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; 07-23 13:19:57.833: D/after parsing(32136): &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt; 07-23 13:19:57.833: D/after parsing(32136): &lt;head&gt; 07-23 13:19:57.833: D/after parsing(32136): &lt;title&gt;USA and Canada Current Average Gas Prices By City/State/Province - GasBuddy.com&lt;/title&gt; 07-23 13:19:57.833: D/after parsing(32136): &lt;base id="ctl00_head_base" href="http…
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/q/24914370
accepted answer: http://stackoverflow.com/a/24914457
has comment: http://stackoverflow.com/comment/38710093
tagged with: jpa
tagged with: session
has title: Can you do bulk delete in one transaction using JPA and Hibernate?
possible better answer: http://stackoverflow.com/a/63358545
has answer: http://stackoverflow.com/a/63358545
has answer: http://stackoverflow.com/a/24914457
answer count: 2
upvote count: 7
favorite count: 0
has body: So, I've been pounding my head against a wall trying to speed up the deletion process from my database. I'm relatively new to Hibernate, and I was wondering if it's possible to do multiple operations within one transaction. I'm not too worried about a transaction failing to delete, so the idea of rolling back all of the deletes doesn't bother me. If it helps to provide the table descriptions I can do that also. The idea though is I have to delete the contents within each for loop before deleting the contents outside of it. My code private void deleteTrackItems() { Session session = m_databaseConnection.getSession(); Transaction tx = null; try { final List<TrackItem> trackItems = loadAllTrackItemByTrackID( track.getId(), session); // Deletes all Track Items for the given track List<Long> trackItemIds = new ArrayList(); for (TrackItem trackItem : trackItems) { trackItemIds.add(trackItem.getId()); // this is test code 189 through 214 Set<TrackPoint> trackPoints = trackItem.getTrackPoints(); for (TrackPoint trackPoint : trackPoints) { // load track final List<TrackPointDetail> trackPointDetails = loadAllTrackPointDetailByTrackID( trackPoint.getId(), session); for (TrackPointDetail trackPointDetail : trackPointDetails) { // delete track point details deleteObject(trackPointDetail, session); } // delete track point deleteObject(trackPoint, session); } // get the track informations final Set<TrackInformation> trackInformations = trackItem .getTrackInformations(); // for each track information for (TrackInformation trackInformation : trackInformations) { deleteTrackInformation(trackInformation, session); } deleteObject(trackItem, session); } } catch (Exception ex) { System.out.println(ex); tx.rollback(); } finally { if (session != null) { session.close(); } } } /** * @param p_objectToDelete The object to delete * @param p_session the hibernate session * @return Returns the {@link Runnable} */ protected void deleteObject(Object p_objectToDelete, final Session p_session) { //…
type: AnsweredQuestion
downvote count: 0
tagged with: transactions
score: 7
tagged with: java
tagged with: hibernate
type: Question

http://stackoverflow.com/comment/38934084
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25032437
type: AnswerComment
has text: changed my answer after I saw the stack trace, see if this helps

http://stackoverflow.com/q/24975469
possible better answer: http://stackoverflow.com/a/24975522
score: 1
has answer: http://stackoverflow.com/a/24976059
tagged with: java
has answer: http://stackoverflow.com/a/77543412
has answer: http://stackoverflow.com/a/24975522
has title: Bijection between Java float and integer keeping order
tagged with: int
linked to: http://stackoverflow.com/q/11825719
tagged with: casting
has answer: http://stackoverflow.com/a/24975518
downvote count: 0
answer count: 7
has answer: http://stackoverflow.com/a/24975511
favorite count: 0
has answer: http://stackoverflow.com/a/24975547
linked to: http://stackoverflow.com/q/1088216
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24975511
has body: Both int and float in Java are 32 bits size values. Is it possible to program a pair of functions int toInt(float f); float toFloat(int n); such that if f1 and f2 are arbitrary float non-NaN values and i1 and i2 are arbitraty int values: f1 &lt; f2 if and only if toInt(f1) &lt; toInt(f2) f1 &gt; f2 if and only if toInt(f1) &gt; toInt(f2) f1 == f2 if and only if toInt(f1) == toInt(f2) toInt(toFloat(i1) == i1 toFloat(toInt(f1)) == f1 Edit: I have edited the question to exclude NaN values for float, thanks to the answers clarifying what happens with those.
upvote count: 1
has answer: http://stackoverflow.com/a/24975544
type: Question

http://stackoverflow.com/comment/38761809
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24941884
type: AnswerComment
has text: You should change the output to refer to it as `"Option 1 (var) \"\"+i "`.

http://stackoverflow.com/q/25060651
duplicate of: http://stackoverflow.com/q/3767365
type: Question
possible better answer: http://stackoverflow.com/a/25060711
type: AnsweredQuestion
has body: Here is a code snippet from the head first design patterns book: public class LowerCaseInputStream extends FilterInputStream { public LowerCaseInputStream(InputStream in) { super(in); } public int read() throws IOException { int c = super.read(); return (c == -1 ? c : Character.toLowerCase((char)c)); } public int read(byte[] b, int offset, int len) throws IOException { int result = super.read(b, offset, len); for (int i = offset; i &lt; offset+result; i++) { b[i] = (byte)Character.toLowerCase((char)b[i]); } return result; } } There is another toy example in the same chapter: public class Mocha extends CondimentDecorator { Beverage beverage; public Mocha(Beverage beverage) { this.beverage = beverage; } public String getDescription() { return beverage.getDescription() + ", Mocha"; } public double cost() { return .20 + beverage.cost(); } } These two are quite similar except that the Macha class has a concrete object inside that it initialize and use, while the LowerCaseInputStream class initializes an InputStream object by super(in) and later seems to make use of this object by using the super.read() function. I am a bit confused about how the super function works here. In the Mocha example, it's very clear that it wraps a beverage object inside and calls its methods and modifies the results, while in the LowerCaseInputStream class it's not straight-forward how the behavior modification happened.
tagged with: oop
has answer: http://stackoverflow.com/a/25060711
has comment: http://stackoverflow.com/comment/38984713
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/38984660
downvote count: 0
has answer: http://stackoverflow.com/a/25060706
has answer: http://stackoverflow.com/a/25060772
tagged with: decorator
favorite count: 0
has comment: http://stackoverflow.com/comment/38984740
has title: How the super function works in java?
answer count: 4
linked to: http://stackoverflow.com/q/3767365
accepted answer: http://stackoverflow.com/a/25060706
has answer: http://stackoverflow.com/a/25060728
upvote count: 1

http://stackoverflow.com/a/24937196
upvote count: 1
has comment: http://stackoverflow.com/comment/38753014
has comment: http://stackoverflow.com/comment/38763684
downvote count: 0
has body: As far as I know there is no way of telling the compiler that your code is actually correct. You can try replacing the ? with Object: Value&lt;Object&gt; value = null; Future&lt;Optional&lt;Object&gt;&gt; future = submit(value);
has comment: http://stackoverflow.com/comment/38752724
has comment: http://stackoverflow.com/comment/38752639
has comment: http://stackoverflow.com/comment/38752876
type: Answer
answers question: http://stackoverflow.com/q/24936842
has comment: http://stackoverflow.com/comment/38752344
score: 1

http://stackoverflow.com/comment/38764094
type: Comment
comment on: http://stackoverflow.com/a/24943052
has text: But it **DOESN'T** cancel out the hash tag. There's nothing in the URL spec that says it does. So Java interprets the # correctly as a start of an anchor, and that's what you see in your servlet.
score: 2
type: AnswerComment

http://stackoverflow.com/a/24936911
upvote count: 1
has body: The close of the context is handed off as an asynchronous task to a ThreadPoolExecutor. However, the ThreadPoolExecutor has been terminated and rejects the task. It's not clear to me why the pool would have been terminated, but my guess is that there is a shutdown in progress (or a bug ?). I would imagine that the resources allocated by the context would be cleaned up eventually anyways, so the only recommendation I can make is that you always close your context in code wrapped in a try/catch withing the finally block of your method. public ConnectionFactory getConnectionFactory() { Context context = null; try { // create context here // lookup here // return ConnFactory here } catch (Exception e) { // log error, throw exception etc. } finally { if(context!=null) try { context.close(); } catch (Exception ex} { /* No Op */ } } } For JNDI contexts this is usually legit since there is nothing you can do about a failed close and there is no point failing after an otherwise successful operation. Moreover, if there is a serious issue in the JNDI service (such as the async thread pools spuriously being terminated) I would think the exact symptoms and diagnosis would be available and visible elsewhere. I would not pollute this otherwise simple code with anything else.
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/24932056
score: 1

http://stackoverflow.com/q/25028381
tagged with: regex
type: AnsweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/25028416
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/38934782
type: Question
has title: How can I remove characters around words?
has answer: http://stackoverflow.com/a/25032482
has answer: http://stackoverflow.com/a/25034421
accepted answer: http://stackoverflow.com/a/25034421
upvote count: 1
has answer: http://stackoverflow.com/a/25028791
has body: I need to remove all characters that are not alphabetical from the beginning and end of each word. For example: --Hello&amp; World-@ 1234... Should look like: Hello World 1234 I tried replaceAll, but I have no idea how many different characters I need to remove or what those characters are. I tried the following, but it didn't work. word = resultString.replaceAll("[^a-zA-Z_0-9|$a-zA-Z_0-9]|^-|$-|^--|$--|^---|$---|\\$", ""); There were still words that showed up with dashes. Is there another way to do this without using replaceAll?
tagged with: string
answer count: 4
favorite count: 0
possible better answer: http://stackoverflow.com/a/25028416

http://stackoverflow.com/a/57127695
score: 7
answers question: http://stackoverflow.com/q/24955817
downvote count: 0
has comment: http://stackoverflow.com/comment/118637197
type: Answer
has body: You can just add this property in your application.property files to disable hibernate validation spring.jpa.properties.javax.persistence.validation.mode=none
upvote count: 7

http://stackoverflow.com/comment/38716691
comment on: http://stackoverflow.com/a/24917913
type: AnswerComment
type: Comment
has text: That removes it from all items. Kinda not what you asked for but what ever :-)
score: 1

http://stackoverflow.com/q/24938333
has comment: http://stackoverflow.com/comment/38765972
has comment: http://stackoverflow.com/comment/38769295
tagged with: obfuscation
tagged with: lambda
has comment: http://stackoverflow.com/comment/38864497
tagged with: java-8
type: AnsweredQuestion
tagged with: syntax
has comment: http://stackoverflow.com/comment/38754495
tagged with: java
has comment: http://stackoverflow.com/comment/38798233
linked to: http://stackoverflow.com/q/1642028
has comment: http://stackoverflow.com/comment/38765811
accepted answer: http://stackoverflow.com/a/24938462
type: Question
has comment: http://stackoverflow.com/comment/38754607
has comment: http://stackoverflow.com/comment/38757771
has comment: http://stackoverflow.com/comment/38765855
has comment: http://stackoverflow.com/comment/38759386
downvote count: 4
has comment: http://stackoverflow.com/comment/38764147
upvote count: 79
answer count: 1
has comment: http://stackoverflow.com/comment/38754403
score: 75
has title: What does the -> <- operator do?
has answer: http://stackoverflow.com/a/24938462
favorite count: 0
has comment: http://stackoverflow.com/comment/38754511
has comment: http://stackoverflow.com/comment/38757994
has body: I recently came upon the following code: IntPredicate neg = x -&gt; x &lt;- x; What is this, some sort of reverse double lambda?

http://stackoverflow.com/comment/38830222
type: Comment
score: 1
comment on: http://stackoverflow.com/a/24978551
type: AnswerComment
has text: I don't think that this is true **for every base**. In fact, I'm pretty sure that it will (or can) work much faster when a "power of 2" base is used, because no division operations are required in such case.

http://stackoverflow.com/comment/38835050
type: QuestionComment
type: Comment
has text: You want to display a file content in one column of JTable or want to display content in JTextArea got from one column of JTable.
comment on: http://stackoverflow.com/q/24981422
score: 0

http://stackoverflow.com/q/25033781
linked to: http://stackoverflow.com/q/14972199
has title: making javafx application fade over a period
tagged with: user-interface
has body: i need to create a java notification that once show fades over time and then is destroyed, but if the user mouses over it it should become alive. I essentially need to set the transparency of the entire notification (background, labels and image views) over a period to fully transparent. I've searched the web and can't find a straightforward way to do it in javafx any help?
type: Question
score: 0
tagged with: java
tagged with: javafx
has comment: http://stackoverflow.com/comment/38934191
answer count: 1
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25033909

http://stackoverflow.com/q/25016794
has answer: http://stackoverflow.com/a/25017239
score: 0
upvote count: 1
answer count: 1
downvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/38902030
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38901969
has title: Connecting Java application to a database on a remote server
tagged with: java
tagged with: mysql
has body: I am developing a Java application that needs a database. I know how to connect my application to a database that is stored in my local hard disk, but I need help to connect to a remote database. String host="jdbc:derby://localhost:1527/Test"; Connection con=null; String uname="admins"; String pass="admins"; try { con=DriverManager.getConnection(host, uname, pass); } catch (SQLException ex) { } The above code allows me to connect to a local database. What changes should I apply to connect to a database that is stored in a remote server?
type: Question
tagged with: database
has comment: http://stackoverflow.com/comment/38902482

http://stackoverflow.com/q/24982697
tagged with: multithreading
type: Question
has title: Why does the join() now work here?
has comment: http://stackoverflow.com/comment/38837571
tagged with: join
tagged with: java
has body: i am trying to sum up all numbers from 1 to n with the help of multiple threads. This is my thread: public class MyThread implements Runnable { //Limits int lowerLimit; int upperLimit; MyInteger result; //Constructor public MyThread(int lowerLimit, int upperLimit, MyInteger result){ this.lowerLimit = lowerLimit; this.upperLimit = upperLimit; this.result = result; } @Override public void run() { //Sums up the numbers in the given interval for(int i= lowerLimit; i &lt;= upperLimit;i++){ result.add(i); } } } It gets an upper and lower limit and a result which is shared over all threads. This is my test class: public class Sum { public static long sumThreads(int numberThreads, int n) { Thread[] threads = new Thread[numberThreads]; MyInteger result = new MyInteger(0); // Creates new threads and starts them for (int i = 0; i &lt; numberThreads; i++) { threads[i] = new Thread(new MyThread(i * n / numberThreads + 1, (i + 1) * n / numberThreads, result)); threads[i].start(); } // Waits for all thread to continue with the return for (int i = 0; i &lt; threads.length; i++) { try { threads[i].join(); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } return result.getValue(); } public static void main(String[] args) { System.out.println(sumThreads(10, 1000)); } } If i use only one thread, the result is correct. If i use multiple threads, the result is sometimes correct and most of the times too low - which means, that the threads did not finish calculating yet. But how is this possible? My for-loop waits for each thread to be finished so the method first returns the result when all thread have calculated their parts. Best Regards Edit : MyInteger class look like this: public class MyInteger { private long value; public MyInteger(int value) { this.value = value; } public long getValue() { return value; } public void setValue(int value) { this.value = value; } public void add(int summand){ value += summand; } public void sub(int decr){ …
answer count: 1
score: 0
has comment: http://stackoverflow.com/comment/38837572
has answer: http://stackoverflow.com/a/24982826
type: UnansweredQuestion

http://stackoverflow.com/comment/38703540
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24911434
has text: My first thought would be to use view navigators. I have done it by calculating the values in SSJS, but letting the view do it for you is better.
score: 0

http://stackoverflow.com/q/24945083
favorite count: 0
type: UnansweredQuestion
tagged with: android
tagged with: maven
has title: Conversion to Dalvik format failed eclipse android-suport-v4.jar error
score: 1
tagged with: java
has body: Building the Schildbash Wallet in Eclipse windows 7 wallet 3.53 action-bar-sherlock 4.1.0 maven 3.0.5 ant 1.9.4 eclipse kepler When I run a clean build in eclipse I get this awesome jar issue: Console Log: [2014-07-24 12:54:42 - wallet] Dx trouble writing output: already prepared [2014-07-24 12:54:43 - Dex Loader] Unable to execute dex: Multiple dex files define Landroid/support/v4/app/_ActionBarSherlockTrojanHorse$OnCreateOptionsMenuListener; [2014-07-24 12:54:43 - wallet] Conversion to Dalvik format failed: Unable to execute dex: Multiple dex files define Landroid/support/v4/app/_ActionBarSherlockTrojanHorse$OnCreateOptionsMenuListener; I've tried unchecking the .jar library in the java build path of the wallet, and tinkering with my android-suport-v4.jar file. I've tried deleteing my livbs folder in the action sidebar but that didn't work either. Anyone know how to resolve this issue?
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/38833276
tagged with: eclipse
has answer: http://stackoverflow.com/a/24965017
downvote count: 0
answer count: 1
tagged with: jar

http://stackoverflow.com/a/24954381
downvote count: 0
upvote count: 2
accepted answer of: http://stackoverflow.com/q/24954341
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24954341
type: Answer
has comment: http://stackoverflow.com/comment/38784682
has body: total = total.add(diff); Immutable type, like String. Some IDEs give a warning.
score: 2

http://stackoverflow.com/comment/38997241
type: Comment
has text: I just implemented and tested things, out. Where finishing only the activities I was done with ( in the sense that if I had actvities A, B,C It would go A opens B, B opens C,C closes, B closes, A opens B, B opens C etc... However, while this did help, I still got out of memory after a 40MB allocation...
comment on: http://stackoverflow.com/a/25056655
type: AnswerComment
score: 0

http://stackoverflow.com/q/24919751
has comment: http://stackoverflow.com/comment/38720017
has comment: http://stackoverflow.com/comment/38719840
downvote count: 0
has comment: http://stackoverflow.com/comment/38719934
has comment: http://stackoverflow.com/comment/38720041
favorite count: 0
type: UnansweredQuestion
has body: I'm currently trying to write down a concept how I could solve following thing: In Java I'm currently scraping a web-page with articles. If any of these articles get available or change somehow it should give me an alert. The scraping of all the articles is pretty fast. But I actually also want to implement that it also checks every article itself if like a size of an article got available. But since this is just another page open for every article it will take much longer. (This is actually another problem which I need to solve) Now my current question is, how could I found out if something has changed? Would it be a good aproach to save every article in a database. On the next check it would save all the articles in another database and compare them? Like saving all every article in a bean and then in an array and compare the two arrays if they are different? I currently don't really see a light at the end of the tunnel how I could solve that in a good and beautiful way. Every comment would be appreciated. thanks in advance
answer count: 0
upvote count: 3
tagged with: screen-scraping
tagged with: java
tagged with: web-scraping
type: Question
has comment: http://stackoverflow.com/comment/38719992
score: 3
tagged with: scraper
has title: Scraping (multiple) web-page(s) and detect changes

http://stackoverflow.com/comment/38878417
type: Comment
has text: -1 Pointless. Instead of parsing integers, you parse them twice. Instead of parsing from a String, you parse from a File. Instead of putting them in a list, you send them to the console.
comment on: http://stackoverflow.com/a/25004103
score: 0
type: AnswerComment

http://stackoverflow.com/comment/38773867
score: 0
type: Comment
has text: Sir, this is the first time I have heard of TreeMap. I will check it out.
type: AnswerComment
comment on: http://stackoverflow.com/a/24947570

http://stackoverflow.com/comment/38705709
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24912105
has text: The reason i use a one hex value instead of a separate red,green, blue and alpha values is that it will be easier to read (and possibly faster) in combo with my game engine, as my game engine's graphics class stores pixel colors for THE WHOLE SCREEN in one big array.

http://stackoverflow.com/q/24974526
has body: I want to write java code to get Memory and CPU usage of a Java server thats run on local host. It's better if I can get values by PID (process ID) like in jconsole. How can I do that? I'm new to Java and I have less experience about these things.
has title: Retrieve memory usage and CPU usage from jvm
linked to: http://stackoverflow.com/q/6284384
has answer: http://stackoverflow.com/a/25046734
has answer: http://stackoverflow.com/a/24981428
tagged with: java
duplicate of: http://stackoverflow.com/q/6284384
tagged with: memory
downvote count: 1
has comment: http://stackoverflow.com/comment/38822889
has comment: http://stackoverflow.com/comment/38822504
type: Question
answer count: 2
upvote count: 0
tagged with: memory-footprint
tagged with: jvm
score: -1
favorite count: 0
tagged with: cpu-usage
type: UnansweredQuestion

http://stackoverflow.com/a/63072790
answers question: http://stackoverflow.com/q/24917194
upvote count: 6
has body: You can make it even simplier, if you want to avoid extra structures. service: mappings: key1: value1 key2: value2 @Configuration @EnableConfigurationProperties public class ServiceConfigurationProperties { @Bean @ConfigurationProperties(prefix = "service.mappings") public Map<String, String> serviceMappings() { return new HashMap<>(); } } And then use it as usual, for example with a constructor: public class Foo { private final Map<String, String> serviceMappings; public Foo(Map<String, String> serviceMappings) { this.serviceMappings = serviceMappings; } }
has comment: http://stackoverflow.com/comment/117782698
downvote count: 1
score: 5
type: Answer

http://stackoverflow.com/q/25049822
has answer: http://stackoverflow.com/a/25051117
linked to: http://stackoverflow.com/q/25028915
has comment: http://stackoverflow.com/comment/38965127
type: Question
has comment: http://stackoverflow.com/comment/38964691
answer count: 2
has answer: http://stackoverflow.com/a/25050705
has comment: http://stackoverflow.com/comment/38965237
score: 0
tagged with: android
tagged with: android-edittext
has title: get data from edit text within a loop
type: UnansweredQuestion
tagged with: java
has body: doubt regarding my previous show EditText on condition I'm new to this, I'm learning. I have a question, as I can get all the data that has been inserted into the text edit? the edit text and numeric type I have, I need a way to get those values ​​and work with them, try using an array but I get errors. could help me? my code is package com.example.test; import android.app.Activity; import android.os.Bundle; import android.util.Log; import android.view.View; import android.view.ViewGroup.LayoutParams; import android.widget.Button; import android.widget.EditText; import android.widget.LinearLayout; public class MainActivity extends Activity { public static final String TAG = MainActivity.class.getSimpleName(); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); final EditText count = (EditText) findViewById(R.id.count); final Button generate = (Button) findViewById(R.id.generate); final LinearLayout container = (LinearLayout) findViewById(R.id.container); generate.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { int numberOfControlsToGenerate = 0; try { numberOfControlsToGenerate = Integer.parseInt(count.getText().toString().trim()); } catch (NumberFormatException e) { Log.e(TAG, e.getMessage(), e); } if (numberOfControlsToGenerate &gt; 0) { if (container.getChildCount() &gt; 0) { container.removeAllViews(); } for (int counter = 0; counter &lt; numberOfControlsToGenerate; counter++) { addEditText(container); } } } }); } private void addEditText(LinearLayout container) { final LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); EditText editTextToAdd = new EditText(this); editTextToAdd.setLayoutParams(params); container.addView(editTextToAdd); } }

http://stackoverflow.com/q/25028776
has answer: http://stackoverflow.com/a/25028955
has comment: http://stackoverflow.com/comment/38924793
has title: Read file until certain character (BufferedReader)
tagged with: java
downvote count: 1
has comment: http://stackoverflow.com/comment/38924839
type: Question
score: -1
accepted answer: http://stackoverflow.com/a/25028943
has body: Here's my code which is not working: try { while ((line1 = br.readLine()).substring(6).equals(name)) { text = text + line1; //text = text + '\n'; } } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } What I am trying to do is to read a text from a text file: Name: Thailand.jpg. Brief: This is Pattaya Info: Nice city you know Name: Austria.jpg Brief: This is Austria Info: Schwarzenegger was born here Now I want to set only "This is Austria" text. But not able to. Thank you!
answer count: 2
has comment: http://stackoverflow.com/comment/38924820
upvote count: 0
has comment: http://stackoverflow.com/comment/38924886
tagged with: bufferedreader
favorite count: 0
possible better answer: http://stackoverflow.com/a/25028955
has answer: http://stackoverflow.com/a/25028943
type: AnsweredQuestion

http://stackoverflow.com/comment/41588156
type: AnswerComment
comment on: http://stackoverflow.com/a/26469802
has text: As far as I know, this is the only way to do it. I agree, though: it does seem cumbersome.
type: Comment
score: 0

http://stackoverflow.com/q/24995989
downvote count: 0
has comment: http://stackoverflow.com/comment/38888900
score: 1
tagged with: java
type: Question
tagged with: htmlunit
tagged with: flash
upvote count: 1
has comment: http://stackoverflow.com/comment/38889976
has comment: http://stackoverflow.com/comment/38862531
has title: How to enable Flash to HTMLUnit?
answer count: 1
has comment: http://stackoverflow.com/comment/38862876
favorite count: 0
has body: I'm trying to grab html contents by HTMLUnit. Everything went nice, but couldn't get Flash contents those are visible as &lt;img&gt; where its actually in &lt;object&gt;, i have webClient.getOptions().setJavaScriptEnabled(true); webClient.getOptions().setActiveXNative(true); webClient.getOptions().setAppletEnabled(true); webClient.getOptions().setCssEnabled(true); In SO some places i found someone saying HTMLUnit won't support Flash, but those answers seems old, so am raising this question. Someone please help. Thanks.
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/14876147
has answer: http://stackoverflow.com/a/25014661

http://stackoverflow.com/comment/38862474
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24995868
has text: what you try to do is when "," is occurs you have skip rest of text after this char is it ?
score: 0

http://stackoverflow.com/a/24963053
has body: You are comparing the found values to chars. int choice = in.nextInt(); while (choice != '1' //... However, this compares the entered numerical value to the ASCII-code of the character which is 49 for the character '1'. Therefore, your loop will continue until you enter one of the numbers 48 ('0') to 52 ('4'). You should compare to the numbers instead: while (choice != 1 &amp;&amp; choice != 2 &amp;&amp; choice != 3 &amp;&amp; choice != 4 &amp;&amp; choice != 0) { System.out.println("Invalid choice"); } The same goes for while (choice !='0') { rules(); choices(); selected(in); opp(); result(choice, opponent, in); } in your main method -- change this to while (choice != 0) { // change this to 0 instead of '0' rules(); choices(); choice = selected(in); // assign the value to choice opponent = opp(); // assign the value to opponent result(choice, opponent, in); } You also did not assign the return values of the methods to the local variables -- they are never going to change and the loop will never end like that!
has comment: http://stackoverflow.com/comment/38802084
type: Answer
has comment: http://stackoverflow.com/comment/38802655
has comment: http://stackoverflow.com/comment/38803547
has comment: http://stackoverflow.com/comment/38802851
answers question: http://stackoverflow.com/q/24962972
score: 0
has comment: http://stackoverflow.com/comment/38801239

http://stackoverflow.com/comment/38782157
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24951985
has text: Every marker has sideeffect-errors, if they are shown or not. Eclipse try to understand what are sideeffect-errors and mark do NOT mark them, because they are non radical. In your case, a accessible field may exists in the class `java.lang.Object` so i guess any radical-marker you had was like not finding the specified JDK. ;D

http://stackoverflow.com/comment/38846734
type: QuestionComment
comment on: http://stackoverflow.com/q/24984705
score: 0
type: Comment
has text: The code as you have posted it should work, with an initial delay value of 0 specified...

http://stackoverflow.com/comment/38962637
score: 1
comment on: http://stackoverflow.com/q/25044050
has text: None of the code here should be running on the UI thread...
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25056800
type: UnansweredQuestion
has title: Dex cache directory isn't writable: /data/dalvik-cache
has body: Please edit the question if needed. I am Using android UiAutomator. UiAutomation run perfectly , but I want use java reflection on UiAutomator.jar (Which internally contain claasses.dex) So problem is that java reflection API use some.jar file (which contain xyz.class instead of .dex) So how can access this .dex file from UiAutomationTest.jar I am using this tool which convert .dex to .jar( which contain .class files) Link : how to use DEXtoJar I need it programatically. - Now i am unable to load UiAutomator.jar into memory ( for getting .dex file from jar then again convert to claasses.dex to classes.jar-) so it is givng following error. Code snip I am using. @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // Here I am placed my UiAutomationTest.jar which produce from UiAutomation ant build tool. String sourceDir = Environment.getExternalStorageDirectory().toString()+"/UiAutomationTest.jar"; //getApplicationInfo().sourceDir; try { DexFile dexFile = new DexFile(sourceDir); // Exception propagate from here. } catch (IOException e) { e.printStackTrace(); } //exploreJar(); // For exploring jar from dex. } Logcat message: 07-31 15:50:18.339: E/dalvikvm(19748): Dex cache directory isn't writable: /data/dalvik-cache 07-31 15:50:18.339: W/System.err(19748): java.io.IOException: unable to open DEX file 07-31 15:50:18.339: W/System.err(19748): at dalvik.system.DexFile.openDexFile(Native Method) 07-31 15:50:18.339: W/System.err(19748): at dalvik.system.DexFile.&lt;init&gt;(DexFile.java:78) 07-31 15:50:18.339: W/System.err(19748): at com.example.dextestproject.MainActivity.onCreate(MainActivity.java:35) 07-31 15:50:18.349: W/System.err(19748): at android.app.Activity.performCreate(Activity.java:5008) 07-31 15:50:18.349: W/System.err(19748): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079) 07-31 15:50:18.349: W/System.err(19748): at android.app.ActivityThread…
has answer: http://stackoverflow.com/a/28871673
tagged with: android-uiautomator
tagged with: java
linked to: http://stackoverflow.com/q/10214880
type: Question
score: 0
answer count: 1
tagged with: jar
linked to: http://stackoverflow.com/q/5257830
tagged with: android

http://stackoverflow.com/comment/38703158
comment on: http://stackoverflow.com/a/24911159
has text: Wow, this is an even cleaner syntax than I expected! Thanks a lot!
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/25056222
answers question: http://stackoverflow.com/q/25052818
has comment: http://stackoverflow.com/comment/38976786
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/38981962
score: 1
upvote count: 1
downvote count: 0
has body: If your use case is to return the most up-to-date values from the property file, you might consider using Apache Commons Configuration and its FileChangedReloadingStrategy. Using the FileChangedReloadingStrategy the property file is checked for modifications as soon as you access the configuation (based on the modification date of the properties file). If a change has been detected the property file is loaded into the configuration. see http://commons.apache.org/proper/commons-configuration/userguide/howto_filebased.html This will ensure that the properties always reflect the values given in the file. No need to define timers or use scheduling frameworks.
accepted answer of: http://stackoverflow.com/q/25052818

gson
tags question: http://stackoverflow.com/q/24926786
tags question: http://stackoverflow.com/q/25006431
tags question: http://stackoverflow.com/q/24939724
tags question: http://stackoverflow.com/q/25052538
tags question: http://stackoverflow.com/q/24976181
tags question: http://stackoverflow.com/q/24924955
tags question: http://stackoverflow.com/q/24960162
tags question: http://stackoverflow.com/q/25000558
tags question: http://stackoverflow.com/q/25043564
tags question: http://stackoverflow.com/q/24947159
tags question: http://stackoverflow.com/q/25004418
tags question: http://stackoverflow.com/q/24993258
tags question: http://stackoverflow.com/q/25051419
tags question: http://stackoverflow.com/q/25024632
tag name: gson
tags question: http://stackoverflow.com/q/25062298
tags question: http://stackoverflow.com/q/24980579
tags question: http://stackoverflow.com/q/24980476
type: Tag
tags question: http://stackoverflow.com/q/24956396
tags question: http://stackoverflow.com/q/25001462

http://stackoverflow.com/comment/38841742
type: AnswerComment
has text: @camickr there are multiple ways of doing things. you might be right but that does not invalidates my answer.
comment on: http://stackoverflow.com/a/24984657
type: Comment
score: 0

http://stackoverflow.com/q/25017967
tagged with: many-to-many
has answer: http://stackoverflow.com/a/25097708
has comment: http://stackoverflow.com/comment/38909050
has title: ManyToMany relationship update?
score: 0
tagged with: jpa
has comment: http://stackoverflow.com/comment/38904538
answer count: 1
tagged with: persistence
has comment: http://stackoverflow.com/comment/38934973
accepted answer: http://stackoverflow.com/a/25097708
type: AnsweredQuestion
tagged with: java
tagged with: hibernate
type: Question
has body: I'm trying persist a relationship @ManyToMany. I created an association class using @IdClass for association, but doesn't work using persist, works only using merge. I need add others registers but using merge doesn't work because the register is always updated. I want my table in the database looks like this id_aluno | id_graduacao | grau | date 1 1 FIRST 2014-08-02 1 1 SECOND 2014-08-02 1 1 THIRD 2014-08-02 Entities @Entity @Table(name="aluno") public class Aluno implements Serializable{ private static final long serialVersionUID = 1L; @Id @GeneratedValue private Integer id; //informacoes gerais @NotNull private String nome; //historico de graduacao @OneToMany(mappedBy = "aluno") private List&lt;HistoricoDeGraduacao&gt; listaHistoricoGraduacao; public Aluno(){} /** adiciona lista de HistoricoDeGraduacao para aluno */ public void addListaHistoricoGraduacao(HistoricoDeGraduacao hdg){ if(listaHistoricoGraduacao == null){ listaHistoricoGraduacao = new ArrayList&lt;HistoricoDeGraduacao&gt;(); } listaHistoricoGraduacao.add(hdg); } public List&lt;HistoricoDeGraduacao&gt; getListaHistoricoGraduacao() { return listaHistoricoGraduacao; } ///gets e sets @Entity @Table(name="graduacao") public class Graduacao implements Serializable{ private static final long serialVersionUID = 1L; @Id @GeneratedValue private Integer id; @NotNull @Column(unique = true) private String graduacao; @ElementCollection @CollectionTable(name="graus_graduacao", joinColumns=@JoinColumn(name="id_graduacao")) @Column(name="graus") private List&lt;String&gt; graus; @OneToMany(mappedBy = "graduacao") private List&lt;HistoricoDeGraduacao&gt; listaHistoricoGraduacao; public Graduacao() { } /** adiciona historicodegraduacao a graduacao */ public void addHistoricoDeGraduacao(HistoricoDeGraduacao hdg){ if(listaHistoricoGraduacao == null){ listaHistoricoGraduacao = new ArrayList&lt;HistoricoDeGraduacao&gt;(); } listaHistoricoGraduacao.add(hdg); } public List&lt;HistoricoDeGraduacao&gt; getListaHistoricoGraduaca…

http://stackoverflow.com/comment/38834983
comment on: http://stackoverflow.com/a/24980808
has text: Викенд сидя за экраном монитора :) жаль, очень надо разобраться с проблемой.
score: 0
type: AnswerComment
type: Comment

deserialization
type: Tag
tags question: http://stackoverflow.com/q/24921205
tag name: deserialization
tags question: http://stackoverflow.com/q/24982487
tags question: http://stackoverflow.com/q/25006431
tags question: http://stackoverflow.com/q/24983024
tags question: http://stackoverflow.com/q/25064203
tags question: http://stackoverflow.com/q/24957996

http://stackoverflow.com/a/25046601
upvote count: 1
answers question: http://stackoverflow.com/q/25020393
accepted answer of: http://stackoverflow.com/q/25020393
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: Try to get rid of the openjpa.RuntimeUnenhancedClasses property and enhance your Entities properly.
score: 1

http://stackoverflow.com/a/24970394
has body: Besides the XPath option for XML based messages I'm not aware of anything else we've added to ActiveMQ that would allow you to operate on the Message contents. Selecting on the contents of the message would probably add some significant performance overhead and is tricky for things like bytes message etc. There is one options you could try if you really think this is something that you can't live without. We do have a feature where function like calls can be made in the selector and you can add more custom functions which could allow you to back door something in but might require some trickery, see this issue for the details. The commit log on the issue will show you the code added and the test case to give you an idea of how it works.
upvote count: 1
answers question: http://stackoverflow.com/q/24963359
type: Answer
downvote count: 0
score: 1

http://stackoverflow.com/comment/125724474
type: AnswerComment
type: Comment
score: 0
comment on: http://stackoverflow.com/a/71120789
has text: As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer).

http://stackoverflow.com/comment/38887466
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25007457
has text: @BillFromHawaii Try putting `@Transactional` at controller layer.
score: 0

search-engine
type: Tag
tag name: search-engine
tags question: http://stackoverflow.com/q/24940031

http://stackoverflow.com/comment/38933618
has text: Then its better to use text editor
comment on: http://stackoverflow.com/q/25028352
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38909294
type: AnswerComment
type: Comment
has text: The variable "cell" is undefined, did you mean "cellView"? Although then I seem to get a null pointer exception, not sure why.
comment on: http://stackoverflow.com/a/25000611
score: 0

http://stackoverflow.com/comment/38702688
type: Comment
has text: But if the user is typing "\"+"\n", I should respect them as "\"+"n" rather than a new line. So, what I mean is replace the new line and the white space, I guess you misunderstand me but anyway, you answer helps!
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24910643

http://stackoverflow.com/comment/38760831
has text: Yeah i'm an idiot, I changed the order that it was reading the file and it works. Thanks for the help!
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24941596

http://stackoverflow.com/comment/38733888
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24926348
score: 1
has text: A long shot, but could it be the lack of double `\\` for filenames?

http://stackoverflow.com/comment/38700921
type: Comment
comment on: http://stackoverflow.com/a/24909756
has text: To simple to be truth :). When the main window is closed button_2 is deattached from printwindow and resource connector to printWindow is lost which results in resource deletion (dynamic html report)
score: 0
type: AnswerComment

http://stackoverflow.com/comment/38967623
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25051554
has text: Because the body of a class is for declarations, not executable code.

http://stackoverflow.com/q/25063804
has comment: http://stackoverflow.com/comment/38991862
has body: We know that there are two ways to create a Thread in Java. Implementing Runnable Interface Extending the Thread Class [Thread is a Concrete Class with default implementation for run() method] In the second approach, we have to provide the implementation for run() method to have our thread logic, executed. If so, then why JDK developers have not made run() method as abstract in Thread Class? I am interested in knowing the reason behind, providing the default implementation for run() method in Thread Class.
tagged with: threadpool
has answer: http://stackoverflow.com/a/25063873
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38990584
has comment: http://stackoverflow.com/comment/38990533
has answer: http://stackoverflow.com/a/25063890
accepted answer: http://stackoverflow.com/a/25063873
tagged with: multithreading
has title: In Java why Thread class is created as Concrete Class?
has answer: http://stackoverflow.com/a/25063903
possible better answer: http://stackoverflow.com/a/25063890
score: 0
tagged with: java
answer count: 3
tagged with: thread-safety

http://stackoverflow.com/a/24929674
accepted answer of: http://stackoverflow.com/q/24920270
has comment: http://stackoverflow.com/comment/38761864
downvote count: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38779278
upvote count: 2
has body: Your code has several problems: To get measurements from an Analyzer, you need to run its measure() method You are printing rt.MIN which is a constant used to define the default headings corresponding to the measurements, see the source code. Instead, you should use ResultsTable#getValueAsDouble(int column, int row) or getValue(String column, int row) to get your value of interest. Apparently you want to measure the minimum value. You should include Measurements.MIN_MAX into your measurements variable to do so. The code that you recorded seems to be Javascript, not ImageJ macro code, so here are some versions of your script that all take the Blobs sample image (File > Open Samples > Blobs (25K)), set the default threshold and measure the same parameters. ImageJ1 macro: run("Blobs (25K)"); setAutoThreshold("Default"); run("Set Measurements...", "area mean standard modal min median area_fraction limit redirect=None decimal=3"); run("Measure"); Javascript: importClass(Packages.ij.IJ); imp = IJ.openImage("http://imagej.nih.gov/ij/images/blobs.gif"); IJ.setAutoThreshold(imp, "Default"); IJ.run("Set Measurements...", "area mean standard modal min median area_fraction limit redirect=None decimal=3"); IJ.run(imp, "Measure", ""); imp.show(); Beanshell (which is closest to Java code): import ij.IJ; imp = IJ.openImage("http://imagej.nih.gov/ij/images/blobs.gif"); IJ.setAutoThreshold(imp, "Default"); IJ.run("Set Measurements...", "area mean standard modal min median area_fraction limit redirect=None decimal=3"); IJ.run(imp, "Measure", ""); imp.show(); If you want to avoid calls to IJ and use the lower level ImageJ API, this is how it looks in Beanshell: import ij.ImagePlus; import ij.IJ; import ij.measure.Measurements; import ij.measure.ResultsTable; import ij.plugin.filter.Analyzer; ImagePlus imp = IJ.openImage("http://imagej.nih.gov/ij/images/blobs.gif"); // IJ.setAutoThreshold(imp, "Default"); imp.getProcessor().setAutoThreshold("Default"); // IJ.run("Set Measurements...", "…
type: Answer
score: 2
answers question: http://stackoverflow.com/q/24920270

http://stackoverflow.com/q/24962976
downvote count: 4
has body: This is my code: package foo.bar; import org.springframework.beans.factory.BeanFactory; import org.springframework.context.ApplicationContext; import org.springframework.context.support.AbstractApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; public class SpringTest { public static void main(String[] args){ AbstractApplicationContext kontekst = new ClassPathXmlApplicationContext("spring.xml"); kontekst.registerShutdownHook(); Shape trojkat = (Shape) kontekst.getBean("Circle"); trojkat.draw(); } } Circle.class package foo.bar; import javax.annotation.PostConstruct; import javax.annotation.PreDestroy; import javax.annotation.Resource; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.beans.factory.annotation.Required; import org.springframework.stereotype.Component; @Component public class Circle implements Shape{ private Point center; @Override public void draw() { System.out.println("Drawin circle"); System.out.println("the point is x:"+center.getX()+", y="+center.getY()); } public Point getCenter() { return center; } @Resource public void setCenter(Point center) { this.center = center; } @PostConstruct public void initalizeCircle(){ System.out.println("init of circle"); } @PreDestroy public void destroyCricle(){ System.out.println("destroying circle"); } } Spring.xml &lt;?xml version="1.0" encoding="UTF-8"? &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-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd"&gt; &lt;context:annotation-config/&gt; &lt;context:component-scan base-package="foo.bar"/&gt; &lt;…
type: AnsweredQuestion
upvote count: 0
has comment: http://stackoverflow.com/comment/38801013
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/24963127
accepted answer: http://stackoverflow.com/a/24963127
answer count: 1
favorite count: 0
score: -4
has title: context:component -scan not working
tagged with: spring

http://stackoverflow.com/a/56882763
downvote count: 0
answers question: http://stackoverflow.com/q/24976458
score: 1
type: Answer
has body: When it should be an implementation based on java.util.Scanner, you should make it to accept also the end of a line as another delimiter, in addition to comma. If I get the Pattern definition right, the instantiation of Scanner should be: Scanner sc2 = new Scanner( url.openStream() ).useDelimiter( ",|\\R" ); The \R stands for Linebreak matcher: Any Unicode linebreak sequence, is equivalent to \u000D\u000A|[\u000A\u000B\u000C\u000D\u0085\u2028\u2029] Refer to the documentation for java.util.regex.Pattern for the details.
upvote count: 1

http://stackoverflow.com/comment/61131186
type: Comment
comment on: http://stackoverflow.com/a/24938519
has text: And don't forget to support now getter and setter for the id field in the entity class!.. (I forgot it and was searching much time for that)
type: AnswerComment
score: 2

android-activity
tags question: http://stackoverflow.com/q/24964694
tags question: http://stackoverflow.com/q/24976683
tags question: http://stackoverflow.com/q/25051497
tags question: http://stackoverflow.com/q/24948880
tags question: http://stackoverflow.com/q/25022182
tags question: http://stackoverflow.com/q/25044098
tags question: http://stackoverflow.com/q/25027911
tags question: http://stackoverflow.com/q/25014340
tags question: http://stackoverflow.com/q/24939170
tags question: http://stackoverflow.com/q/24913090
tags question: http://stackoverflow.com/q/25000671
tag name: android-activity
tags question: http://stackoverflow.com/q/25006682
tags question: http://stackoverflow.com/q/24909523
tags question: http://stackoverflow.com/q/25002281
tags question: http://stackoverflow.com/q/24962789
tags question: http://stackoverflow.com/q/24916819
tags question: http://stackoverflow.com/q/24978382
tags question: http://stackoverflow.com/q/25010612
tags question: http://stackoverflow.com/q/24975365
tags question: http://stackoverflow.com/q/24986930
tags question: http://stackoverflow.com/q/25038910
tags question: http://stackoverflow.com/q/24997930
tags question: http://stackoverflow.com/q/25039741
tags question: http://stackoverflow.com/q/25002788
tags question: http://stackoverflow.com/q/24947029
tags question: http://stackoverflow.com/q/25002917
tags question: http://stackoverflow.com/q/24982685
tags question: http://stackoverflow.com/q/24965825
tags question: http://stackoverflow.com/q/24937042
tags question: http://stackoverflow.com/q/24994884
tags question: http://stackoverflow.com/q/24944458
type: Tag

http://stackoverflow.com/q/24968990
type: UnansweredQuestion
tagged with: java
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/38811988
has comment: http://stackoverflow.com/comment/38811996
tagged with: servlets
has answer: http://stackoverflow.com/a/24969167
has title: Learning servlets: HTTP Status 404 - /Controller
upvote count: 0
answer count: 1
tagged with: jsp
tagged with: tomcat
favorite count: 0
has body: (Resolved!) I'm following a tutorial on servlets but I'm getting stuck quite early. For some reason I get a 404 as soon as the controller is called (Controller.java below). The idea is that the form in index.jsp should call a controller (form action="Controller") in order to determine which page the information in the form should be sent to, depending on which button in the form was pressed (currently only one, confirmButton). However, I keep getting a 404 when Controller is called. ...help? index.jsp Simple Edit Page This is a simple HTML page that has a form in it. If there is a value for the hobby in the query string, then it is used to initialize the hobby element. Hobby: web.xml <?xml version="1.0" encoding="UTF-8"?> Controller controller.Controller Controller /controller/Controller Controller.java package controller; import java.io.IOException; import javax.servlet.RequestDispatcher; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; public class Controller extends HttpServlet { protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String address; if (request.getParameter("processButton") != null) { address = "Process.jsp"; } else if (request.getParameter("confirmButton") != null) { address = "Confirm.jsp"; } else { address = "index.jsp"; } RequestDispatcher dispatcher = request.getRequestDispatcher(address); dispatcher.forward(request, response); } } placement of files: src/controller/Controller.java web/WEB-INF/classes/controller/Controller.class
score: -1

http://stackoverflow.com/q/24918877
tagged with: layout-manager
has answer: http://stackoverflow.com/a/24920626
has comment: http://stackoverflow.com/comment/38719591
has answer: http://stackoverflow.com/a/24919954
tagged with: jlabel
has title: Swing Component not displaying on the frame
has body: I don't understand why the RackBuilder object I added to the frame does not get displayed. The code runs and the frame gets generated. I expect to see a panel with 42 rows, each row containing a JLabel "test". Is there something incorrect/missing from my constructor? public class RackBuilderTool extends JPanel{ public RackBuilderTool() { super(new GridLayout(42, 0)); for (int i = 0; i &lt; 42; i++) { add(new JLabel("test")); } } private static void createAndShowGUI() { JFrame frame = new JFrame("Rack Builder Tool"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); RackBuilderTool rackBuilder = new RackBuilderTool(); rackBuilder.setOpaque(true); frame.setContentPane(rackBuilder); frame.pack(); frame.setVisible(true); } public static void main(String[] args) { javax.swing.SwingUtilities.invokeLater(new Runnable() { public void run() { createAndShowGUI(); } }); } } Thanks!
type: UnansweredQuestion
score: 0
tagged with: swing
has comment: http://stackoverflow.com/comment/38719213
tagged with: java
tagged with: jpanel
type: Question
has comment: http://stackoverflow.com/comment/38719659
answer count: 2
has comment: http://stackoverflow.com/comment/38719162

http://stackoverflow.com/q/24953829
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/24992013
accepted answer: http://stackoverflow.com/a/24992013
has body: I like to access a STS/WS-Trust protected SOAP service with CXF. As I am forced to reduce dependencies I use CXFBusFactory instead of spring configuration. This means I am forced to configure by code and this is quite less documentated and popular on the web. Can anyone point out which configuration settings are missing and how to set them by code? I got: private static void testSo(String endpointUrl, String username, String password) { String busFactory = System.getProperty(BusFactory.BUS_FACTORY_PROPERTY_NAME); try { // Setup the system properties to use the CXFBusFactory not the SpringBusFactory System.setProperty(BusFactory.BUS_FACTORY_PROPERTY_NAME, "org.apache.cxf.bus.CXFBusFactory"); CXFBusFactory bf = new CXFBusFactory(); Bus bus = bf.createBus(); bus.getFeatures().add(new org.apache.cxf.feature.LoggingFeature()); STSClient stsClient = new STSClient(bus); stsClient.setWsdlLocation("https://example.com/adfs/services/trust/mex"); stsClient.setServiceName("{http://docs.oasis-open.org/ws-sx/ws-trust/200512/}SecurityTokenService"); stsClient.setEndpointName("{http://docs.oasis-open.org/ws-sx/ws-trust/200512/}CustomBinding_IWSTrustFeb2005Async"); bus.setProperty("ws-security.callback-handler", "com.example.ClientCallbackHandler"); bus.setProperty("ws-security.username", username); bus.setProperty("ws-security.password", password); bus.setProperty("ws-security.sts.client", stsClient); BusFactory.setDefaultBus(bus); BusFactory.setThreadDefaultBus(bus); URL wsdlUrl = new URL(endpointUrl + "?singleWsdl"); Service ss = OrganizationService.create(wsdlUrl, SERVICE_NAME); IOrganizationService port = ss.getPort(IOrganizationService.class); ColumnSet cs = new ColumnSet(); cs.setAllColumns(true); Entity e = port.retrieve("account", "323223", cs); } catch (Exception ex) { ex.printStackTrace(); } finally { // clean up the system properties if (busFactory != null) { System.setProperty(BusFactory.BUS_FACTORY_PROPERTY_NAME, busFactory); } else { System.clearProperty(BusFactory.BU…
answer count: 1
downvote count: 0
favorite count: 0
tagged with: ws-trust
has title: Configure CXF for STS/WS-Trust by code
type: AnsweredQuestion
score: 3
tagged with: cxf
upvote count: 3

http://stackoverflow.com/a/24990006
score: 5
type: Answer
accepted answer of: http://stackoverflow.com/q/24988527
answers question: http://stackoverflow.com/q/24988527
upvote count: 5
type: AcceptedAnswer
downvote count: 0
has body: The Apache Thrift C# library doesn't have a TSerializer presently. However it does have a TMemoryBuffer (essentially a transport that reads/writes memory) which works perfectly for this kind of thing. Create a TMemoryBuffer, construct a protocol (like TBinaryProtocol) and then serialize your messages and send them as blobs from the TMemoryBuffer. For example: TMemoryBuffer trans = new TMemoryBuffer(); //Transport TProtocol proto = new TCompactProtocol(trans); //Protocol PNWF.Trade trade = new PNWF.Trade(initStuff); //Message type (thrift struct) trade.Write(proto); //Serialize the message to memory byte[] bytes = trans.GetBuffer(); //Get the serialized message bytes //SendAMQPMsg(bytes); //Send them! To receive the message you just do the reverse. TMemoryBuffer has a constructor you can use to set the received bytes to read from. public TMemoryBuffer(byte[] buf); Then you just call your struct Read() method on the read side I/O stack. This isn't much more code (maybe less) than using the Java TSerializer helper and it is a bit more universal across Apache Thrift language libraries. You may find TMemoryBuffer is the way to go everywhere!

http://stackoverflow.com/q/24981889
score: 0
tagged with: alfresco
has body: I succeded to add content to alfresco using java with FileInfo fI=serviceRegistry.getFileFolderService().create(fileInfo.getNodeRef(), "test.docx", ContentModel.TYPE_CONTENT); serviceRegistry.getFileFolderService().getWriter(fI.getNodeRef()).putContent(new File("C:\\......\\test.docx")); but my purpose is to add a content that is not indexable so it doesn't appear in any lucene results , is that possible ?
has comment: http://stackoverflow.com/comment/38838802
accepted answer: http://stackoverflow.com/a/25191327
has title: add non-indexable document to alfresco using java
type: Question
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25191327
has comment: http://stackoverflow.com/comment/38876559
tagged with: java
has comment: http://stackoverflow.com/comment/38954981
answer count: 1
tagged with: lucene

http://stackoverflow.com/a/26657775
downvote count: 1
has body: I had the same problem when I tried to use a good looking GCM server example found at http://hmkcode.com/android-google-cloud-messaging-tutorial/ Apart from changing the keys and IDs, the only thing I had to add to make it work is the following line in front of the "public class..." line: @JsonAutoDetect(fieldVisibility = Visibility.ANY) I added this line in the Content.java and the POST2GCM.java file then it was all good to go! working fine!
type: Answer
upvote count: 0
answers question: http://stackoverflow.com/q/24982754
score: -1

http://stackoverflow.com/comment/38852287
type: Comment
type: QuestionComment
has text: The threads execute some MapReduce code that it could take a while. So, I don't want to have the user waiting for the answer. Does it make sense?
score: 0
comment on: http://stackoverflow.com/q/24989925

http://stackoverflow.com/comment/38901769
score: 0
type: AnswerComment
type: Comment
has text: What do you get by calling `System.getenv("JBOSS_HOME")`?
comment on: http://stackoverflow.com/a/25015336

http://stackoverflow.com/comment/117700426
comment on: http://stackoverflow.com/a/49298039
type: Comment
has text: @ThomasW Yes, I completely agree it would be better if Thymeleaf made checking enums easier so we didn't have to do this.
score: 0
type: AnswerComment

http://stackoverflow.com/q/24954818
score: 2
has answer: http://stackoverflow.com/a/24957442
downvote count: 0
has body: I'm fairly new to database management. I'm just trying to connect to the database and retrieve and display a table in the command prompt. The database is not on my computer. I am fairly certain that the url is the problem. The code: import java.io.*; import java.sql.*; class transfer{ //driver and DB URLs final static String driver = "com.microsoft.sqlserver.jdbc.SQLServerDriver"; final static String DB_SQL = "jdbc:microsoft:sqlserver://localhost:1433;" + "database=DataDB;" + "user=sa;" + "password=1234"; //Database Username and password final static String user1 = "sa"; final static String pass1 = "1234"; static ResultSet rs; public static void main(String args[]) throws SQLException, ClassNotFoundException{ Connection conn_sql = null; Statement stmt_sql = null; //Statement stmt_ora = null; //Register JDBC driver Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver"); //Open Connection System.out.println("Connecting to SQL database..."); conn_sql = DriverManager.getConnection(DB_SQL, user1, pass1); //Execute Query String sql_query; System.out.println("Creating statement for SQL..."); stmt_sql = conn_sql.createStatement(); sql_query = "Select * from attendancesummary"; rs = stmt_sql.executeQuery(sql_query); System.out.println("SQL table details"); System.out.println("Creating statement for SQL..."); while(rs.next()){ //Retrieve data int cno = rs.getInt("CardNo"); int in_time = rs.getInt("entry"); int out_time = rs.getInt("Exittm"); String name = rs.getString("Name"); int date = rs.getInt("TrDate"); //Display data System.out.print("Employee ID: "+cno); System.out.print("\tName: "+name); System.out.print("\tDate:"+date); System.out.print("\tEntry: "+in_time); System.out.print("\tExit: "+out_time); } } } The database name is DataDB and the table that I want to retrieve and display is attendancesummary. I have set my path as "C:\Program Files\Java\jdk1.8.0_11\bin";"C:\Program Files\Microsoft JDBC Driver 4.0 for SQL Server\sqljdbc_4.0\enu\sqljdbc4.jar" The code co…
type: AnsweredQuestion
tagged with: sqlconnection
tagged with: java
has answer: http://stackoverflow.com/a/24954941
type: Question
upvote count: 2
possible better answer: http://stackoverflow.com/a/24954941
has title: ClassNotFoundException when trying to connect to SQL server 2005 with Java
linked to: http://stackoverflow.com/q/9407986
has answer: http://stackoverflow.com/a/24954957
accepted answer: http://stackoverflow.com/a/24954957
has comment: http://stackoverflow.com/comment/38811245
tagged with: sql-server
answer count: 3
tagged with: classnotfoundexception
tagged with: jdbc
favorite count: 0

http://stackoverflow.com/a/25012564
has comment: http://stackoverflow.com/comment/38976115
has comment: http://stackoverflow.com/comment/38946026
has comment: http://stackoverflow.com/comment/38898063
upvote count: 2
has comment: http://stackoverflow.com/comment/38940982
has comment: http://stackoverflow.com/comment/38927427
has body: Are you adding the mapping you created when bootstrapping the validator factory? It needs to be done like so: Validator validator = configuration.addMapping( constraintMapping ) .buildValidatorFactory() .getValidator();
has comment: http://stackoverflow.com/comment/38969176
has comment: http://stackoverflow.com/comment/38940904
type: Answer
has comment: http://stackoverflow.com/comment/38947525
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/38983896
has comment: http://stackoverflow.com/comment/38948127
answers question: http://stackoverflow.com/q/24994652

http://stackoverflow.com/a/24994212
has comment: http://stackoverflow.com/comment/38859769
has comment: http://stackoverflow.com/comment/38859484
type: Answer
has comment: http://stackoverflow.com/comment/38859700
has body: The whole problem was that your panel didn't have focus, and thusly couldn't recieve any input events. After following this answer, adding 2 lines solved the problem: public GamePanel() { ... setFocusable(true); //add this anywhere in this constructor } public MainFrame() { ... frame.add(gamepanel); gamepanel.requestFocusInWindow(); //add this after adding the panel to your frame and making it visible } EDIT: Also, you code has several bugs: Moving up should be y--, since top-left corner has coordinates [0,0] and the x axis is going to right and y is going down (unlike in math class) You should never call Thread.sleep() inside paint() method, since that method has to be as fast as possible. You are "starting" a new thread using thread.run(), use thread.start() instead, that will acctually start a new thread instead of just calling the run method in current thread. Change the if to while in your loop method, also remove the loop call from the paint method to solve previous two mistakes. These are not to criticise you (everyone was starting at some point) but to help you.
score: 1
accepted answer of: http://stackoverflow.com/q/24993711
has comment: http://stackoverflow.com/comment/38859783
answers question: http://stackoverflow.com/q/24993711
has comment: http://stackoverflow.com/comment/38859188
upvote count: 1
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/24940742
has answer: http://stackoverflow.com/a/24940950
has body: I have been trying to learn Java 8's new functional interface features, and I am having some difficulty refactoring code that I have previously written. As part of a test case, I want to store a list of read names in a Map structure in order to check to see if those reads have been "fixed" in a subsequent section of code. I am converting from an existing Map> data structure. The reason why I am flattening this datastructure is because the outer "String" key of the original Map is not needed in the subsequent analysis (I used it to segregate data from different sources before merging them in the intermediate data). Here is my original program logic: public class MyClass { private Map&lt;String, Map&lt;String, Short&gt;&gt; anchorLookup; ... public void CheckMissingAnchors(...){ Map&lt;String, Boolean&gt; anchorfound = new HashMap&lt;&gt;(); // My old logic used the foreach syntax to populate the "anchorfound" map for(String rg : anchorLookup.keySet()){ for(String clone : anchorLookup.get(rg).keySet()){ anchorfound.put(clone, false); } } ... // Does work to identify the read name in the file. If found, the boolean in the map // is set to "true." Afterwards, the program prints the "true" and "false" counts in // the map } } I attempted to refactor the code to use functional interfaces; however, I getting errors from my IDE (Netbeans 8.0 Patch 2 running Java 1.8.0_05): public class MyClass { private Map&lt;String, Map&lt;String, Short&gt;&gt; anchorLookup; ... public void CheckMissingAnchors(...){ Map&lt;String, Boolean&gt; anchorfound = anchorLookup.keySet() .stream() .map((s) -&gt; anchorlookup.get(s).keySet()) // at this point I am expecting a // Stream&lt;Set&lt;String&gt;&gt; which I thought could be "streamed" for the collector method // ; however, my IDE does not allow me to select the "stream()" method .sequential() // this still gives me a Stream&lt;Set&lt;String&gt;&gt; .collect(Collectors.toMap((s) -&gt; s, (s) -&gt; false); // I receive an error for the prec…
favorite count: 0
has title: Java 8 Map KeySet Stream not working as desired for use in Collector
tagged with: collections
tagged with: java-8
has answer: http://stackoverflow.com/a/24948110
type: AnsweredQuestion
score: 3
tagged with: java-stream
upvote count: 3
tagged with: java
tagged with: set
type: Question
accepted answer: http://stackoverflow.com/a/24940950
answer count: 2
downvote count: 0
possible better answer: http://stackoverflow.com/a/24948110

mongodb
tags question: http://stackoverflow.com/q/25047673
tag name: mongodb
tags question: http://stackoverflow.com/q/25048048
tags question: http://stackoverflow.com/q/24965110
tags question: http://stackoverflow.com/q/25054717
tags question: http://stackoverflow.com/q/25021863
tags question: http://stackoverflow.com/q/24969955
tags question: http://stackoverflow.com/q/24995595
type: Tag
tags question: http://stackoverflow.com/q/25014993
tags question: http://stackoverflow.com/q/24929575
tags question: http://stackoverflow.com/q/24911935
tags question: http://stackoverflow.com/q/24917849
tags question: http://stackoverflow.com/q/25031383
tags question: http://stackoverflow.com/q/24929806
tags question: http://stackoverflow.com/q/25049742
tags question: http://stackoverflow.com/q/24918802
tags question: http://stackoverflow.com/q/24976859
tags question: http://stackoverflow.com/q/24980934
tags question: http://stackoverflow.com/q/24939901

http://stackoverflow.com/comment/38825587
comment on: http://stackoverflow.com/q/24976250
has text: Read all of the file, add your new entry, sort the entries, discard least, write out new file.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24983232
has comment: http://stackoverflow.com/comment/38839120
type: Answer
has body: Here is a fully functional example: import java.util.Scanner; public class Temp { public static void main(String[] args) { Scanner inp = new Scanner(System.in); int num = 0; String input = ""; String exit = "exit"; boolean isStringNumber = true;//If the String is not Number System.out.println("NOTE: To exit, type the word exit and press enter key"); while(true){ System.out.println("\nPlease enter a number only..."); input = inp.nextLine(); if(input.equalsIgnoreCase(exit)){break;} isStringNumber = input.matches("[0-9]+");//Check if no digits in string if(isStringNumber == false){ System.out.println("\nYou entered a non number " + input); System.out.println("Remove all non numbers from your input and try again !"); continue; }else{ num = Integer.parseInt(input); System.out.println("You entered " + num); } } System.out.println("Exiting program..."); } }
upvote count: 1
has comment: http://stackoverflow.com/comment/38840310
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/24982642

http://stackoverflow.com/a/25049046
type: Answer
has comment: http://stackoverflow.com/comment/38963108
has comment: http://stackoverflow.com/comment/38963076
has comment: http://stackoverflow.com/comment/38963134
answers question: http://stackoverflow.com/q/25048674
upvote count: 7
accepted answer of: http://stackoverflow.com/q/25048674
has body: There are two, immediate, issues at hand First, the need to read a file in such away that it can progressively update the UI without causing unacceptable delays Second, the ability for the JTextArea to actually deal with this amount of data... The first issues is, relatively, simple to fix. What you need to make sure of is that you are not blocking the Event Dispatching Thread while you read the file and that you are only updating the JTextArea from within the context of the Event Dispatching Thread. To this end a SwingWorker is an excellent choice, for example... public class FileReaderWorker extends SwingWorker&lt;List&lt;String&gt;, String&gt; { private File file; private JTextArea ta; public FileReaderWorker(File file, JTextArea ta) { this.file = file; this.ta = ta; } public File getFile() { return file; } public JTextArea getTextArea() { return ta; } @Override protected List&lt;String&gt; doInBackground() throws Exception { List&lt;String&gt; contents = new ArrayList&lt;&gt;(256); try (BufferedReader br = new BufferedReader(new FileReader(getFile()))) { String text = null; while ((text = br.readLine()) != null) { // You will want to deal with adding back in the new line characters // here if that is important to you... contents.add(text); publish(text); } } return contents; } @Override protected void done() { try { get(); } catch (InterruptedException | ExecutionException ex) { ex.printStackTrace(); // Handle exception here... } } @Override protected void process(List&lt;String&gt; chunks) { JTextArea ta = getTextArea(); for (String text : chunks) { ta.append(text); } } } Take a look at Concurrency in Swing and Worker Threads and SwingWorker for more details ps- You don't need to use the List to store the contents, I just did it as an example... The second problem is far more complicated and would need some additional testing to ensure that it is actually a problem, but generally speaking, contents of over about 1mb tends to lead to issues... To this end, you w…
score: 7
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/38963057

android-gridview
type: Tag
tag name: android-gridview
tags question: http://stackoverflow.com/q/25001379

http://stackoverflow.com/a/25050839
downvote count: 0
type: Answer
score: 1
has body: Probably the problem in this code: for (ProgressListener listener: listeners) listener.onProgress(n); When one thread, which holds a lock, calls an external method like this one (onProgress) then you cannot guarantee that implementation of this method won't try to obtain other lock, which could be held by different thread. This may cause a deadlock.
answers question: http://stackoverflow.com/q/25050574
upvote count: 1

http://stackoverflow.com/a/24941794
type: AcceptedAnswer
type: Answer
downvote count: 0
score: 1
has body: I think you can use any extension file based on your preference. Based on your configuration when it reach 100KB the file will rotate to application.txt.1. log extension is preferable since the purpose of the file is for logging
accepted answer of: http://stackoverflow.com/q/24941667
upvote count: 1
answers question: http://stackoverflow.com/q/24941667

http://stackoverflow.com/q/24922793
type: Question
tagged with: android
upvote count: 1
tagged with: java
tagged with: locationmanager
tagged with: location
tagged with: google-geocoder
answer count: 0
has comment: http://stackoverflow.com/comment/40492902
type: UnansweredQuestion
has title: Geocoder is returning address nowhere near me
downvote count: 0
score: 1
has body: I am using LocationManager, Location, along with Geocoder to attempt to find the address of a business using the getFromLocationName() method. The problem is when I print the returned address, it is nowhere near my location. I have tried turning GPS on and wifi off to get different results, but everything remains the same. It is important to note that I am using the LocationManager to return the best provider. Also it is important to note that I do get my exact location when I use getFromLocation(). The problem here is that I can not specify a business name to get its address. package restaurantcheckin.pkg; import java.util.List; import java.util.Locale; import java.util.List; import java.util.ArrayList; import android.app.Activity; import android.content.Context; import android.location.Address; import android.location.Criteria; import android.location.Geocoder; import android.location.Location; import android.location.LocationManager; import android.os.Bundle; import android.util.Log; import android.view.Menu; import android.widget.TextView; import android.widget.Toast; import restaurantcheckin.pkg.RowItem0; public class MainActivity extends Activity { Geocoder ugeo; List&lt;Address&gt; adr; LocationManager lm; Location ulo; final double range = 1.00; String lName; String stre; String city; String state; String zip; String adrOut; String lat; String lon; String bp; Criteria cri; Context context; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); TextView tView0 = (TextView) findViewById(R.id.tView); this.context = this; cri = new Criteria(); lName = "Pizza Hut"; lm = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE); bp = lm.getBestProvider(cri,false); Log.d("Debug",bp); ulo = lm.getLastKnownLocation(bp); if(ulo == null) { Toast.makeText(this, "Location not found...", Toast.LENGTH_LONG).show(); } else { try { ugeo = new Geocoder(context); adr = ugeo.getFromLo…
favorite count: 0

http://stackoverflow.com/a/24937500
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/24937437
upvote count: 1
has body: Because the Java syntax does not allow this. In Java || is an operator which you apply to two boolean operands. Your operands are String objects. To achieve what you want, you can use an if statement, or the so-called conditional ternary operator ?:. More details here: if statement conditional ternary operator ?: The second links also contains a description of the || operator.

http://stackoverflow.com/a/25003668
has comment: http://stackoverflow.com/comment/38879004
has comment: http://stackoverflow.com/comment/38878112
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38877871
upvote count: 3
has body: I used the MousePressed event to open the JDialog Don't use a MouseListener~ You need to use an ActionListener. Read the section from the Swing tutorial on How to Use Buttons for more information and working examples.
type: Answer
answers question: http://stackoverflow.com/q/25002954
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25002954
has comment: http://stackoverflow.com/comment/38878161
score: 3
has comment: http://stackoverflow.com/comment/38880037

http://stackoverflow.com/comment/38938435
type: Comment
comment on: http://stackoverflow.com/a/25036336
has text: In addition to that, I should no longer be allowed to input commands once I switch to turn 2. However, when I switch to turn two, I can still input commands. Why is that?
type: AnswerComment
score: 0

http://stackoverflow.com/a/25044103
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25043935
type: AcceptedAnswer
score: 4
has body: If I understand you, you want something like File folder = new File(dbBackupLocation + "/" + dbHost); File[] listOfFiles = folder.listFiles(); if (listOfFiles != null &amp;&amp; listOfFiles.length &gt; 0) { // The array isn't empty. Arrays.sort(listOfFiles, new Comparator&lt;File&gt;() { @Override public int compare(File f1, File f2) { return Long.valueOf(f1.lastModified()) .compareTo(f2.lastModified()); } }); }
type: Answer
upvote count: 4
answers question: http://stackoverflow.com/q/25043935

http://stackoverflow.com/a/28230092
score: 1
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/24973616
upvote count: 1
has body: javax.xml.stream package is not a part of Android. You cannot use it or any other library requiring it in your Android app. That's why you're getting error. According to OData4j description, it can work with StAX parser too, which is present in Android. You should have a look into their official Android example to find out how this library should be used with StAX parser in Android. Hope this helps.

http://stackoverflow.com/a/25027507
has comment: http://stackoverflow.com/comment/38922612
score: 0
has body: You can't do this.mDb = new DataBaseHelper(this).getReadableDatabase(); in the constructor because the Activity Context doesn't exist. That Line has to be in the onCreate() or onResume() or onStart() Method. @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.tabhost); this.mDb = new DataBaseHelper(this).getReadableDatabase(); ///This Line table_layout = (TableLayout) findViewById(R.id.TableLayout); BuildTable(); }
type: Answer
answers question: http://stackoverflow.com/q/25027303
has comment: http://stackoverflow.com/comment/38922830
has comment: http://stackoverflow.com/comment/38922884

http://stackoverflow.com/comment/38718894
has text: If your code works and you want to have *different* code that has the same result, please post *that*. SO is not a site for questions like "I want this result, please write code for me." Show us what you have tried to reach your goal.
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/24919027

http://stackoverflow.com/a/24941884
score: 2
downvote count: 0
has body: Good answers. I've tried it (just for fun) and got similar times. ""+i is interpreted as StringBuilder("").append(i).toString() where as ""+1 is inlined. I suspect some of the benchmarks presented here were inlined. Based on my tests I found these times: Option 1 (K) ""+8 : 655 milliseconds Option 1 (var) ""+i: 83462 milliseconds Option 2 String.valueOf(i): 90685 milliseconds Option 3 Integer.toString(i): 88764 milliseconds Option 1 (K) is what I suspect some tests here were using. Option 2 is slightly better than option 4. Maybe due to some optimization in the JVM? I am using a MacBook Pro, the JVM is 1.7.0_21 This is the source code I used: public class Main{ public static void main(String[] args) throws InterruptedException { // warm up the JVM for (int i = 0; i &lt; 1000; i++) { String aString = ""+i; } long now = System.currentTimeMillis(); for (int i = 0; i &lt; Integer.MAX_VALUE; i++) { String aString = ""+8; } System.out.println("Option 1 (K) \"\"+8 "+(System.currentTimeMillis()-now)); now = System.currentTimeMillis(); for (int i = 0; i &lt; Integer.MAX_VALUE; i++) { String aString = ""+i; } System.out.println("Option 1 (var) \"\"+i "+(System.currentTimeMillis()-now)); Thread.sleep(1000); now = System.currentTimeMillis(); for (int i = 0; i &lt; Integer.MAX_VALUE; i++) { String aString = String.valueOf(i); } System.out.println("Option 2 String.valueOf(i) "+(System.currentTimeMillis()-now)); Thread.sleep(1000); now = System.currentTimeMillis(); for (int i = 0; i &lt; Integer.MAX_VALUE; i++) { String aString = Integer.toString(i); } System.out.println("Option 3 Integer.toString(i) "+(System.currentTimeMillis()-now)); } }
upvote count: 2
has comment: http://stackoverflow.com/comment/38762013
has comment: http://stackoverflow.com/comment/38761443
has comment: http://stackoverflow.com/comment/38761598
has comment: http://stackoverflow.com/comment/38761809
type: Answer
answers question: http://stackoverflow.com/q/24940454

http://stackoverflow.com/q/25041814
answer count: 2
tagged with: collections
has title: How to preserve order of hashmap in JavaScript?
tagged with: java
has comment: http://stackoverflow.com/comment/38948894
upvote count: 4
has comment: http://stackoverflow.com/comment/38948972
type: AnsweredQuestion
downvote count: 0
tagged with: javascript
favorite count: 0
possible better answer: http://stackoverflow.com/a/25041958
type: Question
has answer: http://stackoverflow.com/a/25041958
score: 4
has answer: http://stackoverflow.com/a/51497754
accepted answer: http://stackoverflow.com/a/51497754
has body: Java has LinkedHashMap but there doesn't seem to be a similar solution in JavaScript. Basically, I want to be able to say var map = {}; map['a'] = 1; map['b'] = 2; Then when I iterate over the map, they are always in [{a:1}, {b:2}...] order.

http://stackoverflow.com/a/24989341
answers question: http://stackoverflow.com/q/24988491
has body: As everybody has mentioned above -- To my understanding, getMessage() returns the name of the exception. getLocalizedMessage() returns the name of the exception in the local language of the user (Chinese, Japanese etc.). In order to make this work, the class you are calling getLocalizedMessage() on must have overridden the getLocalizedMessage() method. If it hasn't, the method of one of it's super classes is called which by default just returns the result of getMessage. In addition to that, I would like to put some code segment explaining how to use it. How to use it Java does nothing magical, but it does provide a way to make our life easier. To use getLocalizedMessage() effectively, we have to override the default behavior. import java.util.ResourceBundle; public class MyLocalizedThrowable extends Throwable { ResourceBundle labels = ResourceBundle.getBundle("loc.exc.test.message"); private static final long serialVersionUID = 1L; public MyLocalizedThrowable(String messageKey) { super(messageKey); } public String getLocalizedMessage() { return labels.getString(getMessage()); } } java.util.ResourceBundle is used to do localization. In this example, you have to place language-specific property files in the loc/exc/test path. For example: message_fr.properties (containing some key and value): key1=this is key one in France message.properties (containing some key and value): key1=this is key one in English Now, let us assume that our exception generator class is something like public class ExceptionGenerator { public void generateException() throws MyLocalizedThrowable { throw new MyLocalizedThrowable("key1"); } } and the main class is: public static void main(String[] args) { //Locale.setDefault(Locale.FRANCE); ExceptionGenerator eg = new ExceptionGenerator(); try { eg.generateException(); } catch (MyLocalizedThrowable e) { System.out.println(e.getLocalizedMessage()); } } By default, it will return the "English" key value if you are executing in the "English" environm…
downvote count: 2
has comment: http://stackoverflow.com/comment/89453900
has comment: http://stackoverflow.com/comment/117907740
accepted answer of: http://stackoverflow.com/q/24988491
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/135440612
has comment: http://stackoverflow.com/comment/71244471
score: 94
upvote count: 96
has comment: http://stackoverflow.com/comment/138752692
type: Answer

windows
tags question: http://stackoverflow.com/q/25001453
tags question: http://stackoverflow.com/q/24914067
tags question: http://stackoverflow.com/q/24964272
tags question: http://stackoverflow.com/q/24987649
tags question: http://stackoverflow.com/q/24952049
tags question: http://stackoverflow.com/q/24972947
tags question: http://stackoverflow.com/q/25035543
tags question: http://stackoverflow.com/q/24980390
tags question: http://stackoverflow.com/q/24939418
tags question: http://stackoverflow.com/q/25060045
tags question: http://stackoverflow.com/q/24973276
tags question: http://stackoverflow.com/q/24979623
tags question: http://stackoverflow.com/q/24948004
type: Tag
tags question: http://stackoverflow.com/q/24994516
tags question: http://stackoverflow.com/q/25065336
tags question: http://stackoverflow.com/q/25054903
tag name: windows
tags question: http://stackoverflow.com/q/25010812
tags question: http://stackoverflow.com/q/24920325
tags question: http://stackoverflow.com/q/25013581
tags question: http://stackoverflow.com/q/24924165

http://stackoverflow.com/comment/38721370
type: QuestionComment
score: 1
has text: BTW, You will want to use a HashMap instead of a Hashtable, unless you really have to.
comment on: http://stackoverflow.com/q/24920497
type: Comment

http://stackoverflow.com/comment/38939011
comment on: http://stackoverflow.com/a/25034157
score: 1
type: AnswerComment
has text: Thanks, this is the trick i use to do. Note that you have to import `java.util.Arrays` again at the end.
type: Comment

http://stackoverflow.com/a/27506239
downvote count: 0
type: Answer
upvote count: 1
has body: Please try this code. I am using below code and its working fine. Properties props = System.getProperties(); props.put("mail.smtps.host","smtp.mailgun.org"); props.put("mail.smtps.auth","true"); Session session = Session.getInstance(props, null); Message msg = new MimeMessage(session); msg.setFrom(new InternetAddress("abc@gmail.com")); msg.setRecipients(Message.RecipientType.TO, InternetAddress.parse("xyz@gmail.com", false)); msg.setSubject(subject); msg.setText(body); msg.setRecipients(Message.RecipientType.CC,InternetAddress.parse("abc@gmail.com")); msg.setContent(body, "text/html"); SMTPTransport t = (SMTPTransport)session.getTransport("smtps"); t.connect("smtp.mailgun.com", "postmaster@sandbox***********.mailgun.org", "0ae971*********"); t.sendMessage(msg, msg.getAllRecipients()); System.out.println("Response: " + t.getLastServerResponse()); t.close();
answers question: http://stackoverflow.com/q/25000351
has comment: http://stackoverflow.com/comment/56585121
score: 1

http://stackoverflow.com/comment/38888911
comment on: http://stackoverflow.com/q/25007997
type: Comment
type: QuestionComment
has text: It seems to be the network path issue. Try running the common.xml directly. If not works, then create a sample build file place it in your mapped drive and try to access that.
score: 1

http://stackoverflow.com/comment/38762814
type: AnswerComment
has text: But that's exactly the other way round, isn't it? The question was about handling mouse events, not about faking/producing them.
type: Comment
comment on: http://stackoverflow.com/a/24940518
score: 0

http://stackoverflow.com/comment/38973463
has text: Looks like the classes are on differend class loader. make sure that the jar containing `org.bson.types.ObjectId` is only available once in the classloader hierarchy.
comment on: http://stackoverflow.com/q/25054717
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24947570
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38784511
score: 0
accepted answer of: http://stackoverflow.com/q/24947467
has comment: http://stackoverflow.com/comment/38785459
has comment: http://stackoverflow.com/comment/38773867
has comment: http://stackoverflow.com/comment/38784938
type: Answer
has comment: http://stackoverflow.com/comment/38775488
has comment: http://stackoverflow.com/comment/38781560
answers question: http://stackoverflow.com/q/24947467
has body: You can use: TreeMap, it is sorted red-black tree,

http://stackoverflow.com/comment/38845072
comment on: http://stackoverflow.com/a/24986441
score: 0
type: AnswerComment
type: Comment
has text: Oh thank you Boris, I was not aware that my method of casting was not valid, sorry I'll fix it now

http://stackoverflow.com/comment/38920761
score: 0
type: Comment
has text: Believe me, I would have never find it, tnx
type: AnswerComment
comment on: http://stackoverflow.com/a/25026598

http://stackoverflow.com/comment/38941056
has text: @Darwind: in spring you have the possibility use Interfaces that extends JPA repository. This gives you the advantage to use the method declaration as Query. [link](http://docs.spring.io/spring-data/jpa/docs/1.6.2.RELEASE/reference/html/repositories.html#repositories.query-methods)
comment on: http://stackoverflow.com/q/25029906
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/39177380
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25120431
has text: You need to specify full pathname like /META-INF/SqlMapConfig.xml without classpath or * prefix
score: 0

http://stackoverflow.com/comment/39014043
score: 0
type: Comment
has text: I don't think it is possible to use modifier key (like "CTRL", "ALT", "SHIFT") as an accelerator and it makes sense because those keys are not meant to be used alone but with another key in order to make a combination. For that case, you'll have to go with a keyPressed Listener.
comment on: http://stackoverflow.com/a/25060698
type: AnswerComment

http://stackoverflow.com/comment/38769530
type: QuestionComment
score: 1
has text: Whyis a prepared statement unacceptable to you?
comment on: http://stackoverflow.com/q/24943648
type: Comment

date
tags question: http://stackoverflow.com/q/24952055
tag name: date
tags question: http://stackoverflow.com/q/25010728
tags question: http://stackoverflow.com/q/25038205
tags question: http://stackoverflow.com/q/24930232
type: Tag
tags question: http://stackoverflow.com/q/24998257
tags question: http://stackoverflow.com/q/25018294
tags question: http://stackoverflow.com/q/25051327
tags question: http://stackoverflow.com/q/25029506
tags question: http://stackoverflow.com/q/25049935
tags question: http://stackoverflow.com/q/25064930
tags question: http://stackoverflow.com/q/24928447
tags question: http://stackoverflow.com/q/24912908
tags question: http://stackoverflow.com/q/25052529

http://stackoverflow.com/comment/38892646
has text: You can read your `pom.xml` from your `Java` code to get the version.
comment on: http://stackoverflow.com/q/25011804
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24975196
upvote count: 1
answers question: http://stackoverflow.com/q/24975079
type: Answer
has comment: http://stackoverflow.com/comment/38824749
downvote count: 0
score: 1
has body: Your program runs and ends. It is over, finished and is done. So it "stops". Starting a (new) thread would be the right way. But do not use a thread to "keep the program alive", use it for something useful. In your case, a thread could open a socket and listen on that socket for incoming messages (you are writing a chat client, right?). If a message comes in, the thread will handle it and response. Or make a new thread out of your listener - instead of a method startListener, you could create a method called startListenerThread. Your progamm flow would be: start main method (the main thread) the main thread starts the socket thread the main thread starts the .... (what ever) the main thread waits until all other threads have finished (it blocks)
has comment: http://stackoverflow.com/comment/38823604

http://stackoverflow.com/comment/39178194
type: AnswerComment
comment on: http://stackoverflow.com/a/24944414
score: 0
has text: Thanks @tomrozb, I finally got around to trying it. I got it working also in an alternate way (using a PublishSubject), but your solution for this particular case is definitely much more elegant.
type: Comment

http://stackoverflow.com/a/26496189
upvote count: 4
has body: You are calling InputStreamReader (or some such function) with a null parameter. is = new InputStreamReader(null); // bang
score: 4
answers question: http://stackoverflow.com/q/24974586
type: Answer
downvote count: 0

http://stackoverflow.com/comment/38890037
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25010460
has text: Please paste the relevant parts of the code and error message into your question itself, rather than using an external resource.
type: Comment

http://stackoverflow.com/comment/38929944
type: QuestionComment
comment on: http://stackoverflow.com/q/25030412
score: 0
has text: Prateek, I know what annotation does, but I don't see it in *this* case. Can you create another class and show me how you can use this annotation to reference it?
type: Comment

http://stackoverflow.com/q/25006932
tagged with: java
tagged with: hibernate
tagged with: mysql
has title: Hibernate left join does not return null rows when filtered using where condition
type: Question
has comment: http://stackoverflow.com/comment/38920600
tagged with: jpa
score: 0
has body: I have the below query in MySQL SELECT Max(b.updated_at) as latest_date, r.resource, COUNT(bill) as bills FROM Resource r left join BillComp ba on (r.resource=ba.resource and comp=6) This returns null values if t could not map a resource with the given company which is the requirement. I need to convert to HQL and I am having issues in returning null raws as expected. I have tried below two methods but none works SELECT COUNT(bill), r.resource, MAX(b.updatedAt) FROM Resource r left join r.billComp ba left join ba.bills b where ba.comp.comp = ?1 SELECT COUNT(bill), r.resource, MAX(b.updatedAt) FROM Resource r left join r.billComp with ba.comp.comp = ?1 ba left join ba.bills b Can someone show me how to get null values I am using JPA Annotations
has comment: http://stackoverflow.com/comment/38886982
answer count: 0
type: UnansweredQuestion
tagged with: annotations

http://stackoverflow.com/q/25055756
has answer: http://stackoverflow.com/a/63944730
has comment: http://stackoverflow.com/comment/38976161
has comment: http://stackoverflow.com/comment/38975780
tagged with: java
tagged with: hibernate
tagged with: mysql
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/38976286
linked to: http://stackoverflow.com/q/23630123
has comment: http://stackoverflow.com/comment/38975564
linked to: http://stackoverflow.com/q/23172643
has comment: http://stackoverflow.com/comment/38978820
has body: I tried suggested thing in other question of Stackoverflow and made changes in connection like below &lt;bean id="DataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close"&gt; &lt;property name="driverClass" value="com.mysql.jdbc.Driver" /&gt; &lt;property name="jdbcUrl" value="jdbc:mysql://ipaddress:3306/ccc?useUnicode=true&amp;amp;characterEncoding=utf-8" /&gt; &lt;property name="user" value="userName" /&gt; &lt;property name="password" value="password" /&gt; &lt;property name="maxPoolSize" value="20" /&gt; &lt;property name="maxStatements" value="30" /&gt; &lt;property name="testConnectionOnCheckin" value="true" /&gt; &lt;property name="idleConnectionTestPeriod" value="300" /&gt; &lt;property name="maxIdleTimeExcessConnections" value="240" /&gt; &lt;property name="preferredTestQuery" value="SELECT 1" /&gt; &lt;/bean&gt; But still my project throwing SEVERE: Exception performing authentication com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure The last packet successfully received from the server was 852,106 milliseconds ago. The last packet sent successfully to the server was 31,248 milliseconds ago. 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:525) at com.mysql.jdbc.Util.handleNewInstance(Util.java:409) at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1127) at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:3715) at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:3604) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4155) at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2615) at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2776) at com.mysql.jdbc.ConnectionImpl.execS…
has comment: http://stackoverflow.com/comment/38975333
has comment: http://stackoverflow.com/comment/38976062
has comment: http://stackoverflow.com/comment/38976259
has answer: http://stackoverflow.com/a/25066886
has comment: http://stackoverflow.com/comment/38975735
has comment: http://stackoverflow.com/comment/38975408
has title: Communications link failure :Hibernate & Spring application
type: UnansweredQuestion
score: 0
has comment: http://stackoverflow.com/comment/38976474
tagged with: spring

http://stackoverflow.com/a/24943802
answers question: http://stackoverflow.com/q/24943648
upvote count: 3
has comment: http://stackoverflow.com/comment/38815549
score: 3
downvote count: 0
has body: If you don't want to write a loader that uses prepared statements (via the CQL driver...which is a good idea), I can think of one other way. To import without using single quotes, you should be able to accomplish this with the COPY FROM CQL3 command (setting the QUOTE parameter to an empty string). If you can dump your RDBMS data to a csv file, you should be able to insert those values into Cassandra like this: COPY myColumnFamily (colname1,colname2,colname3) FROM '/home/myUser/rdbmsdata.csv' WITH QUOTE=''; Check out the documentation on the COPY command for more information. Examples can be found here. EDIT: I also read the above question and assumed that you did not want a prepared statement-based answer. Since that's obviously not the case, I thought I'd also provide one here (using DataStax's Java CQL driver). Note that this answer is based on my column family and column names from my example above, and assumes that col1 is the (only) primary key. PreparedStatement statement = session.prepare( "UPDATE myKeyspace.myColumnFamily " + "SET col2=?, col3=? " + "WHERE col1=?"); BoundStatement boundStatement = statement.bind( strCol2, strCol3, strCol1); session.execute(boundStatement); This solution does not require you to encapsulate your string data in single quotes, and has a few added benefits over your String.ReplaceAll: Allows you to insert values containing single quotes. Escapes your values, protecting you from CQL-Injection (the lesser-known relative of SQL-Injection). In CQL, both UPDATE and INSERT add a record if it does not exist and update it if it does (effectively known as an "UPSERT"). Using an UPDATE over an INSERT supports counter columns (if your schema ends up using them). Prepared statements are faster, because they allow Cassandra to only have to parse the query once, and then re-run that same query with different values. For more information, check out DataStax's documentation on using prepared statements with the Java Driver.
has comment: http://stackoverflow.com/comment/38775774
type: Answer

get
tags question: http://stackoverflow.com/q/25058130
tags question: http://stackoverflow.com/q/24962150
type: Tag
tag name: get
tags question: http://stackoverflow.com/q/24992412

http://stackoverflow.com/a/25018590
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/38907502
answers question: http://stackoverflow.com/q/25018308
has body: No. But you can do this: verifyTrue(selenium.getText(id="something").matches("someregex")); NB: The regex you pass to matches() must match the whole string to return true.

http://stackoverflow.com/a/24921093
downvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/38722504
has body: Instead of using println, consider using format. This will allow you to keep the value but display it in any manner that you're able to format it. For instance: System.out.format("The number as Base 16 is %x", x); I hope this answers your question. Comment below if not!
answers question: http://stackoverflow.com/q/24920916
score: 1
has comment: http://stackoverflow.com/comment/38723381
upvote count: 2

http://stackoverflow.com/a/24980653
score: 1
upvote count: 1
has body: You are getting that exception because you need to acquire lock on obj before calling wait(), notify() or notifyAll() methods. These methods are designed to provide a mechanism to allow a thread to block until a specific condition is met. The wait() method releases lock on the object, that mean you need to have acquired a lock before releasing it. Whereas notify() and notifyAll() are to notify other threads which are waiting to acquire lock on the same object. It's like one thread is telling other threads : "Dudes, I don't need the object for now, you can go ahead and use it. Make sure you notify me once you are done.". There are no real scenario where you would want to acquired lock on thread it self. Here's a code block where you wait for thread to complete before executing a code block. Thread t = new Thread() { public void run() { synchronized (Thread.currentThread()) { System.out.println("Thread"); try { Thread.sleep(5000); } catch (InterruptedException e) { } } } }; t.start(); Thread.sleep(10);//sleep main thread synchronized (t) { System.out.println("Main Thread"); } } I have to sleep main thread becaue, Most of the time synchronized block acquires lock before the thread it self. You can do the same with join()
answers question: http://stackoverflow.com/q/24980333
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24980333
type: Answer

http://stackoverflow.com/comment/38983646
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/25058112
has text: It's not a good idea provide information in this case to the client, they can not solve it, and in some cases can be dangerous.
type: Comment

http://stackoverflow.com/a/25031554
score: 1
answers question: http://stackoverflow.com/q/25031410
type: Answer
has comment: http://stackoverflow.com/comment/38932226
upvote count: 1
has body: The java.util.Logger system just like many other logging systems is hierarchical. You can define rules to nodes in the hierarchy which by default are inherited to child nodes. The hierarchy is often follows the java package hierarchy. You should apply your format to the root or set it as the default. You should post your logging.properties file if you seek a more specific answer. Read more about it in the javadoc of java.util.Logger.
downvote count: 0

http://stackoverflow.com/comment/38926857
comment on: http://stackoverflow.com/q/24957513
has text: I am using Advance Rest Client to sent the POST request . catalina.out is not showing any error log.
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/a/24969874
downvote count: 0
has comment: http://stackoverflow.com/comment/38991306
type: Answer
answers question: http://stackoverflow.com/q/24966334
upvote count: 1
score: 1
has body: You can configure INPUT result to your action of type json and use includeProperties parameter to specify generated JSON. false ^actionErrors\[\d+\],^fieldErrors\['\w+'\]\[\d+\] The action class should extend ActionSupport, so these properties will be available.

http://stackoverflow.com/a/24914259
type: Answer
has comment: http://stackoverflow.com/comment/38709554
has comment: http://stackoverflow.com/comment/38710309
has body: A common (and not very secure unless you're on HTTPS) strategy is to put them in the HTTP Request Header if you just want plain authentication. On the server side you can use those values and do whatever you want with them, including evaluating access to the requested service. If you use JAX-RS is relatively simple to create a utility method that does that. If you also want to ensure integrity you may want to include an hash obtained hashing the concatenation of all param string representation with a simmetric key (known both by client and server). On the server side you recompute the hash to check if the request has been tampered or not. In this way even if an eavesdropper get your credentials sniffing the netwkork traffic he would have difficult times in sending fake requests or tampering a correct one.
answers question: http://stackoverflow.com/q/24913510
score: 0

http://stackoverflow.com/a/24928415
type: Answer
answers question: http://stackoverflow.com/q/24927310
has body: Please unzip your pptx, and have a look at the content of the slide. It should contain something like: &lt;a:t&gt;£&lt;/a:t&gt; You can create a p containing that with: // Create object for p CTTextParagraph textparagraph = dmlObjectFactory.createCTTextParagraph(); textbody.getP().add( textparagraph); // Create object for r CTRegularTextRun regulartextrun = dmlObjectFactory.createCTRegularTextRun(); textparagraph.getEGTextRun().add( regulartextrun); regulartextrun.setT( "£"); or by unmarshalling a string. In either case, you can just provide the £ char directly. You can generate suitable code using the docx4j webapp at http://webapp.docx4java.org/
score: 0

http://stackoverflow.com/q/25044076
favorite count: 0
type: UnansweredQuestion
tagged with: http://stackoverflow.com/tag/html
has comment: http://stackoverflow.com/comment/38966704
has title: GWT How to only refresh page frame without refreshing the whole page
has body: I need to refresh GWT page all content inside parent panel called dockPanel in my class to clean cache after user click Submit button. What I am doing now is refresh the whole page using Window.Location.reload(); It may give user bad experience, because the whole page will be refreshed. Is there any way only to refresh all things in parent panel to give user better experience? Thanks!
answer count: 0
score: 1
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/38957536
type: Question
has comment: http://stackoverflow.com/comment/38958078
tagged with: gwt
has comment: http://stackoverflow.com/comment/38983531
downvote count: 0
has comment: http://stackoverflow.com/comment/38956441

http://stackoverflow.com/a/24913297
has comment: http://stackoverflow.com/comment/38711486
has comment: http://stackoverflow.com/comment/38712457
has comment: http://stackoverflow.com/comment/38711590
has comment: http://stackoverflow.com/comment/38707260
score: 0
answers question: http://stackoverflow.com/q/24913072
has comment: http://stackoverflow.com/comment/38707325
has comment: http://stackoverflow.com/comment/38711074
has body: You are expecting * to mean .* and .*? at the same time (and more). You should reconsider what you really need. Let's extend your example: abbccabbccbbbcabb Do you really want all possibilities? To achieve what you want you'll have to iterate p1 over all occurrences of "ab" from p1+2 on iterate p2 over all occurrences of "b" output substring between p1 and p2+1 This is the corresponding Java code: public static void main( String[] args ){ String s = "abbccabbccbbb"; int f1 = 0; int p1; while( (p1 = s.indexOf( "ab", f1 )) &gt;= 0 ){ int f2 = p1 + 2; int p2; while( (p2 = s.indexOf( "b", f2 )) &gt;= 0 ){ System.out.println( s.substring( p1, p2 + 1 ) ); f2 = p2 + 1; } f1 = p1 + 2; } } Below is the output. You may be surprised - maybe that's more than you expect, but then you'll need to refine your specification. abb 0:3 abbccab 0:7 abbccabb 0:8 abbccabbccb 0:11 abbccabbccbb 0:12 abbccabbccbbb 0:13 abb 5:8 abbccb 5:11 abbccbb 5:12 abbccbbb 5:13 Later Why is a single regular expression not capable of doing it? The basic mechanism of pattern matching is to try and match the regex against a string, starting at some position, initially 0. If a match is found, this position is advanced according to the matched string. The pattern matcher never looks back. A pattern ab.*?b will try and find the next 'b' after an "ab". This means that *no match is possible beginning with the same "ab" and ending at some 'b' following that previously found "next 'b'". In other words: one regex cannot find overlapping substrings.
type: Answer
has comment: http://stackoverflow.com/comment/38711716

http://stackoverflow.com/comment/71073175
has text: @joseph true. You can do the same for HashMap.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25002229

http://stackoverflow.com/comment/38967196
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25051291
has text: Yes i already mention main featured of AndroidQuery in ans please read carefully then still you have any problem just ask me.
score: 0

http://stackoverflow.com/a/25066747
type: Answer
upvote count: 4
accepted answer of: http://stackoverflow.com/q/25066732
downvote count: 0
answers question: http://stackoverflow.com/q/25066732
score: 4
type: AcceptedAnswer
has body: You need to escape the backslashes: String trimmed = files[i].toString().replace("C:\\FREQ\\", ""); Backslashes within Java text literals (String or char) are used for escape sequences such as \t (tab), \n (line feed) etc. To get an actual backslash, you need to just use \\. See the Java language specification section 3.10.6 for more details.

http://stackoverflow.com/q/24991671
type: AnsweredQuestion
downvote count: 0
score: 1
favorite count: 0
tagged with: bouncycastle
type: Question
possible better answer: http://stackoverflow.com/a/24991905
tagged with: encryption
has answer: http://stackoverflow.com/a/24991905
accepted answer: http://stackoverflow.com/a/24992315
has title: Bouncy castle GNUPG decryption
tagged with: java
answer count: 2
upvote count: 1
tagged with: gnupg
has body: I have some misunderstanding when trying to decrypt file encrypted using GNUPG. Trying to work with sample code which is available here: https://github.com/chids/bouncy-castle-pgp Made some additional tests and everything works fine. But when trying to decrypt sample file which, I get: Caused by: java.security.InvalidKeyException: Illegal key size at javax.crypto.Cipher.checkCryptoPerm(Cipher.java:1024) at javax.crypto.Cipher.init(Cipher.java:1345) at javax.crypto.Cipher.init(Cipher.java:1282) ... 4 more As I understood that I need to replace two jar files, which are located in jdk security folder, I did that but still this exception is present. When checking Cipher.getMaxAllowedKeyLength() for all algorithms I get that mainly there are 128bit lengths. I assume that it is not correct, is that right? Maybe jar files need to be added somehow seperately on my IDE? I see thta public key which is provided is RSA 2048 bits, so maybe all this implementation needs to be done in some another way? Edit: Just noticed that key used in unit tests is also RSA 2048 bits, so it should not be the case.
has answer: http://stackoverflow.com/a/24992315

http://stackoverflow.com/comment/57677601
type: QuestionComment
has text: Have you tried debugging or logging to see if the file was imported successfully by `Jsoup.parse`?
score: 0
type: Comment
comment on: http://stackoverflow.com/q/24934465

http://stackoverflow.com/comment/129652052
score: 0
type: AnswerComment
has text: @Tran What's the package signature of the `Session.class`? Please always indicate these because in my imports, I have a list of Session classes.
type: Comment
comment on: http://stackoverflow.com/a/53397754

http://stackoverflow.com/comment/38927513
comment on: http://stackoverflow.com/q/25030278
has text: You could use Java Reflection to traverse through the deserialized object tree and validate all non primitive fields for beeing not null.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25060890
has body: I have an interface, IfcBase which is implemented by another class Base. This class is further extended by a second class SubBase. Further SubBase class implements another interface IfcNew. Both these interfaces have a method declared that has the same signature. Now SubBase does not define the method from IfcNew. I now create an instance of SubBase and assign it to the reference type IfcNew. I then invoke the lone method and get an output. The method from IfcBase was executed in this case. I believe this should not be allowed at some stage, either during compilation or execution. I fail to understand the behavior and solicit help. The source is below. Thanks a lot! public interface IfcBase { public void printString(); } public class Base implements IfcBase { public void printString() { System.out.println("Base Class"); } } public interface IfcNew { public void printString(); } public class SubBase extends Base implements IfcNew { // } public class Test { public static void main(String[] args) { IfcNew i = new SubBase(); i.printString(); //Output:Base Class } }
accepted answer: http://stackoverflow.com/a/25060942
tagged with: inheritance
answer count: 3
has answer: http://stackoverflow.com/a/25061147
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/25060973
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/25060973
score: 3
has comment: http://stackoverflow.com/comment/38985067
upvote count: 3
tagged with: java
has answer: http://stackoverflow.com/a/25060942
type: Question
has comment: http://stackoverflow.com/comment/38985056
has title: Strange behavior observed in inheritence

http://stackoverflow.com/comment/38986130
type: QuestionComment
comment on: http://stackoverflow.com/q/25047290
score: 0
has text: I'm going to try and re-implement this change in more gradual steps in hopes of determining exactly what changes may have caused this.
type: Comment

http://stackoverflow.com/comment/38723957
has text: What is `model.listOfListProducts`?
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24921913
score: 0

http://stackoverflow.com/comment/38746463
comment on: http://stackoverflow.com/q/24933917
type: Comment
type: QuestionComment
score: 2
has text: @Takendarkk Furthermore, it is probably simpler to just do if (!submit) ;)

http://stackoverflow.com/q/24971120
has comment: http://stackoverflow.com/comment/38815903
has comment: http://stackoverflow.com/comment/38817802
type: Question
has comment: http://stackoverflow.com/comment/38815872
has comment: http://stackoverflow.com/comment/38815959
score: 0
has answer: http://stackoverflow.com/a/24971248
answer count: 2
has body: I attended interview and i was asked this question. String s=new String("Rohit"); Does this statement creates an object in heap only or it makes an entry in string pool as well? I answered it does not make entry in pool. I think with .intern() it would make entry in string pool. Interviewer's thought was opposite. Could you please guide me if i was wrong or interviewer? Thanks in Advance. EDIT: String s1=new String("Rohit"); String s2="Rohit"; String s3=new String("Rohit").intern(); System.out.println(" "+(s2==s3)+" "+(s1==s2)+" "+(s1==s3)+" "+(s2==s3)); results as :true false false true This makes me to think that without using intern() with new, there is no entry in pool for this object
has comment: http://stackoverflow.com/comment/38817443
has comment: http://stackoverflow.com/comment/38817597
tagged with: string
has title: String s=new String("Rohit"); Does this statement creates an object in heap only or it makes an entry in string pool as well?
linked to: http://stackoverflow.com/q/3297867
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/23544752
has comment: http://stackoverflow.com/comment/38815919
duplicate of: http://stackoverflow.com/q/3052442
duplicate of: http://stackoverflow.com/q/3297867
has answer: http://stackoverflow.com/a/24972058
has comment: http://stackoverflow.com/comment/38815970
has comment: http://stackoverflow.com/comment/38815884
tagged with: java

http://stackoverflow.com/comment/38848949
comment on: http://stackoverflow.com/a/24984849
type: AnswerComment
type: Comment
has text: Do you know which version I should use? Tried removing each of the versions I have and still getting an error (either the one I mentioned above or this one: java.lang.NoClassDefFoundError: com/google/common/base/Function).
score: 0

http://stackoverflow.com/comment/38740664
type: Comment
has text: @stack_ved: The attribute android:textAlignment="viewStart" didn't worked for me.
comment on: http://stackoverflow.com/q/24930816
score: 0
type: QuestionComment

http://stackoverflow.com/comment/38732574
comment on: http://stackoverflow.com/q/24926526
type: QuestionComment
has text: Are there spaces around the "Raise Query"? You can format as code in your question and show _exactly_ what is inside the tag. Which version of Selenium are you using and which language are you writing your tests in?
score: 0
type: Comment

http://stackoverflow.com/q/24942172
tagged with: java
has title: understand Hash map keys- java
has answer: http://stackoverflow.com/a/24942310
accepted answer: http://stackoverflow.com/a/24942310
type: Question
linked to: http://stackoverflow.com/q/1669885
has comment: http://stackoverflow.com/comment/38762083
upvote count: 1
answer count: 1
favorite count: 0
tagged with: hash
has comment: http://stackoverflow.com/comment/38762060
tagged with: dictionary
has body: I know that HashMap doesn’t allow duplicate keys (It does allow duplicate values). However in this example that works perfectly,all the values have the same key(that means the key is not unique)Maybe I misunderstood the code.Could someone help me understand it right. this is the code public class PlayListManager { //**********************************hashmap keys************************ public static final String ALL_VIDEOS = "AllVideos"; public static final String ALL_Songs = "AllSongs"; //*************************************************************************** .. ... .... while (cursor.moveToNext()) { Songs song = new Songs(); song.songId = cursor.getString(cursor .getColumnIndexOrThrow(MediaStore.Audio.Media._ID)); song.artist = cursor.getString(cursor .getColumnIndexOrThrow(MediaStore.Audio.Media.ARTIST)); song.title = cursor.getString(cursor .getColumnIndexOrThrow(MediaStore.Audio.Media.TITLE)); song.songName = cursor .getString(cursor .getColumnIndexOrThrow(MediaStore.Audio.Media.DISPLAY_NAME)); song.duration = Integer.parseInt(cursor.getString(cursor .getColumnIndexOrThrow(MediaStore.Audio.Media.DURATION))); song.albumId = Integer.parseInt(cursor.getString(cursor .getColumnIndexOrThrow(MediaStore.Audio.Media.ALBUM_ID))); song.songData = cursor.getString(cursor .getColumnIndexOrThrow(MediaStore.Audio.Media.DATA)); //*******here it uses the same ky for all the videos?!!************* HashMap&lt;String, Object&gt; songMap = new HashMap&lt;String, Object&gt;(); songMap.put(ALL_Songs, song); songsList.add(songMap); } }
type: AnsweredQuestion
downvote count: 0
score: 1

http://stackoverflow.com/q/24927384
has comment: http://stackoverflow.com/comment/38734236
has title: how thread share variable in ints own instance class
has comment: http://stackoverflow.com/comment/38734045
type: Question
has body: i am not sure what title should i give to this question. basically my question is how thread share variable in ints own instance class: for e.g please check below code : public class MainJava { public static void main(String[] args) throws InterruptedException { MyThread obje1=new MyThread(25); MyThread obje2=new MyThread(50); Thread t1=new Thread(obje1); t1.setName("Thread"+25); t1.start(); Thread.sleep(2000); Thread t2=new Thread(obje2); t2.setName("Thread"+50); t2.start(); } } class MyThread implements Runnable { int i; String threadName; public MyThread(int i) { this.i = i; } @Override public void run() { if (Thread.currentThread().getName().equals("Thread25")) { try { Thread.sleep(50000); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } System.out.println(i +" FOR THREAD : "+Thread.currentThread().getName()); } } in this thread , my assumption was Thread50 will overwrite value of i to 50 and subsequently Thread25 will be read value of i as 50. As i is instance variable and it will be shared between two threads. but output was 50 FOR THREAD : Thread50 25 FOR THREAD : Thread25 so i am confused about this outout. Can someone help me understand this. Thanks in advance
has answer: http://stackoverflow.com/a/24927526
has comment: http://stackoverflow.com/comment/38733856
score: 0
answer count: 2
linked to: http://stackoverflow.com/q/3493752
has comment: http://stackoverflow.com/comment/38733990
has comment: http://stackoverflow.com/comment/38733936
has answer: http://stackoverflow.com/a/24935873
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/38733817
tagged with: multithreading

http://stackoverflow.com/comment/133602029
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/61535146
type: Comment
has text: After looking out for solutions for hours, you saved my day. Stay blessed a good soul..!

http://stackoverflow.com/comment/38718649
score: 1
has text: You will need to disable the network adapter at the OS level.
comment on: http://stackoverflow.com/q/24917902
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25069564
has title: Mocking Objects Created Inside method Under test
has comment: http://stackoverflow.com/comment/39020833
tagged with: mocking
has answer: http://stackoverflow.com/a/25071975
tagged with: mockito
answer count: 1
tagged with: junit
downvote count: 0
favorite count: 0
upvote count: 7
has body: I have a class which I would like to test.Whenever possible I would do dependency injections for that class which depends on object of other classes.But,I ran into a case where I would like to mock the object without restructuring the code and not appling DI. Here is the class under test: public class Dealer { public int show(CarListClass car){ Print print=new Print(); List&lt;String&gt; list=new LinkedList&lt;String&gt;(); list=car.getList(); System.out.println("Size of car list :"+list.size()); int printedLines=car.printDelegate(print); System.out.println("Num of lines printed"+printedLines); return num; } } and my test class for this is: public class Tester { Dealer dealer; CarListClass car=mock(CarListClass.class); List&lt;String&gt; carTest; Print print=mock(Print.class); @Before public void setUp() throws Exception { dealer=new Dealer(); carTest=new LinkedList&lt;String&gt;(); carTest.add("FORD-Mustang"); when(car.getList()).thenReturn(carTest); when(car.printDelegate(print)).thenReturn(9); } @Test public void test() { int no=dealer.show(car); assertEquals(2,number);//not worried about assert as of now } } I couldn't figure out a solution to mock the print object inside the Dealer class.Since,I mock it in the Test class,but it gets created in the method under test.I did my research,but couldn't find any good resource. I know taking Print object creation out of this method and Injection the object is the better way,but I would like to test the code as it is ,with the print object being created inside the method.Is there any way to do this
has comment: http://stackoverflow.com/comment/39004302
type: AnsweredQuestion
tagged with: junit4
accepted answer: http://stackoverflow.com/a/25071975
score: 7
tagged with: java
has comment: http://stackoverflow.com/comment/39001823
type: Question

http://stackoverflow.com/q/25024519
has comment: http://stackoverflow.com/comment/38917456
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/25035781
tagged with: background
has comment: http://stackoverflow.com/comment/38921640
has body: I need to create an android service that: Starts whenever the screen is on (whether it is at boot time or not) sends a notification every 20 minutes (if the screen is on) stops whenever the screen is off Every tutorial I've read uses an activity, but I need this to be a service because the app is not supossed to be running other than when the user wants to change a setting. The documentation says I need an IntentService, but I cannot stop that manually and I cannot use a Service because it is a long running operation. I tried with an alarm manager but it didn't worked, I don't even bother to show you the code because I really don't understand it. I do not know how to make the service check if the screen is on or not, if I use a BroadcastReceiver it won't be inmediately processed so I am just stuck
type: Question
score: 0
has title: service to check device state
tagged with: android
answer count: 1
accepted answer: http://stackoverflow.com/a/25035781

http://stackoverflow.com/q/24920536
has answer: http://stackoverflow.com/a/24920962
has title: Run integration tests with Maven Failsafe with fresh program state
answer count: 1
has body: I am finding that my tests are failing on my Jenkins server due to the program state being reused (as opposed to running each entry point in its own state). So in other words, one test has a side effect that causes another to fail. Two of my tests modify some static variable. One depends on it being the default. The fact that the other test changes the variable causes the test to fail. The manner of the tests are never meant to be run in the same program state (these test the program from entry point to exit). How can I make Maven run each test standalone? Possibly relevant information: Maven version 3.2.2 Failsafe version 2.6 Failsafe has execution goals are integration-test and verify Tests are just JUnit 4.11 tests Behavior confirmed on both Linux and OS X Using Java 1.8.0_05 Modules aren't being used. We're running the integration tests with clean integration-test (I realize now that it should have been clean verify, but that doesn't matter for this issue) I guess they're really more like system tests
tagged with: maven
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24920962
tagged with: java
tagged with: integration-testing
type: Question
score: 0

http://stackoverflow.com/q/24913027
has comment: http://stackoverflow.com/comment/38706790
has answer: http://stackoverflow.com/a/24913514
score: 1
answer count: 4
has comment: http://stackoverflow.com/comment/38706718
favorite count: 0
possible better answer: http://stackoverflow.com/a/24913261
has comment: http://stackoverflow.com/comment/38707146
has body: Basically this code has two threads created in two classes, and they are called from the third class. Each thread has a loop, and it sleeps after each iteration. (code is in the end) The output is: CHECK 0 CHECK CHECK 1 CHECK run one in thread1 CHECK 2 CHECK run two in thread2 1) I am not getting any idea why it works this way. I mean it is okay that CHECK 0 CHECK should be printed first. But why does CHECK 1 CHECK get printed before Thread1 (whereas it comes after Thread1 is called in the code) and same for CHECK 2 CHECK and Thread2? 2) If i replace CHECK 2 CHECK with System.exit(0), as in the case above, where printing CHECK 2 CHECK, which is next to Thread2, takes place before running Thread2, Why is System.exit(0) happening after running Thread2 in this case? Output for second case: CHECK 0 CHECK CHECK 1 CHECK run one in thread1 run two in thread2 Please tell why this is happening? Why are the threads and code in method, getting mixed up this way? I think i don't have any idea about how threads are managed by java. I tried searching a lot, but could not find anything that i could understand. Code: public class Thread1 implements Runnable { public Thread1() { new Thread(this).start(); } public void run() { // TODO Auto-generated method stub System.out.println("run one"); try { for(int i = 0; i &lt; 5;i++) { System.out.println("in thread1 "); Thread.sleep(1000); } } catch(Exception e) { //e.printStackTrace(); } } } public class Thread2 implements Runnable { public Thread2() { new Thread(this).start(); } public void run() { // TODO Auto-generated method stub System.out.println("run two"); try { for(int i=0;i&lt;5;i++) { System.out.println("in thread2 "); Thread.sleep(1000); } } catch(Exception e) { //e.printStackTrace(); } } } public class Threadjava { public static void main(String[] str) { System.out.println("CHECK 0 CHECK"); new Thread1(); System.out.println("CHECK 1 CHECK"); new Thread2(); System.out.println("CHECK 2 CHECK"); //The above is deleted in the secon…
accepted answer: http://stackoverflow.com/a/24913418
upvote count: 2
has answer: http://stackoverflow.com/a/24913261
tagged with: multithreading
has comment: http://stackoverflow.com/comment/38707055
downvote count: 1
type: AnsweredQuestion
tagged with: java
has title: How threads work in Java and how their working is different from basic code inside a method?
has comment: http://stackoverflow.com/comment/38707214
type: Question
has answer: http://stackoverflow.com/a/24913633
has answer: http://stackoverflow.com/a/24913418

http://stackoverflow.com/comment/38956999
comment on: http://stackoverflow.com/a/25045824
type: AnswerComment
has text: I want to create the xml request manually. I don't want to add class files to access the remote methods.
score: 0
type: Comment

http://stackoverflow.com/comment/38963076
type: AnswerComment
has text: @trashgod For viewing, absolutely, if the OP is expecting the ability to edit the values, it becomes a little more complicated, not impossible though....
type: Comment
comment on: http://stackoverflow.com/a/25049046
score: 1

http://stackoverflow.com/comment/38715412
type: Comment
type: QuestionComment
score: 0
has text: I may was a bit unclear. I'm trying to register everyone in a MySQL database, with the value Name(player name) and the value amount(the amount of money)
comment on: http://stackoverflow.com/q/24917112

http://stackoverflow.com/q/24923757
has title: Java: cannot find symbol()
possible better answer: http://stackoverflow.com/a/24923774
answer count: 3
has comment: http://stackoverflow.com/comment/38727148
has body: Ok, I'm pretty new to using Java. So. I have been reading a few books and following some online tutorials so far. I have done mostly php and javascript for about 10 years. PHP doesn't seem to be a heavy OOP language and JS with it's whole prototyping was always weird to me. I thought learning Java would be a good healty way to wrap my head around a solid OOP language. Anyhow - Question is accessing and printing my variable p. If I have it as a String as below, it works great. When I change it everywhere to be and Int. It breaks. Why? class Player { private int level; public Player(int level) { this.level = level; } public void toString(int value) { this.level = value; } } public class RPG { public static void main(String[] args) { // Set up Keyboard input Scanner keyboard = new Scanner(System.in); System.out.println("What is your current level?"); int l = keyboard.nextInt(); Player p = new Player(l); System.out.println("Your level is: " + p.toString); } } New Error: RPG.java:40: cannot find symbol symbol : variable toString location: class Player System.out.println("You level is: " + p.toString); ^ 1 error If I change p to be an int everywhere. I receive the errors below: (this has been answered) RPG.java:18: cannot find symbol symbol : class Int location: class Player private Int level; ^ RPG.java:20: cannot find symbol symbol : class Int location: class Player public Player(Int level) { ^ RPG.java:28: cannot find symbol symbol : class Int location: class Player public Int GetLevel() { ^ 3 errors It is common to just pass Strings through an Object and that's it? If that's the correct wording, please correct me if I'm wrong. I want fully understand the terminology too. Also another question. Say I wanted to take a user input and plug that into their Player level. (say I could then do the math to alter their player stats). Would I then need to make use of a getter and setter even needing in this case?
has comment: http://stackoverflow.com/comment/38727513
has answer: http://stackoverflow.com/a/24923841
has answer: http://stackoverflow.com/a/24923776
has comment: http://stackoverflow.com/comment/38727382
has comment: http://stackoverflow.com/comment/38727466
favorite count: 0
has comment: http://stackoverflow.com/comment/38727448
downvote count: 3
score: -3
has comment: http://stackoverflow.com/comment/38727225
has answer: http://stackoverflow.com/a/24923774
has comment: http://stackoverflow.com/comment/38727504
upvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/38727469
type: Question
has comment: http://stackoverflow.com/comment/38727634
has comment: http://stackoverflow.com/comment/38727206
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38727708
accepted answer: http://stackoverflow.com/a/24923776

http://stackoverflow.com/a/24990309
has body: To get the behavior you want you can just replace "," by " ,": String test = ",,"; test = test.replace(",", " ,"); System.out.println((test.split(",").length));
has comment: http://stackoverflow.com/comment/38852113
has comment: http://stackoverflow.com/comment/38852234
has comment: http://stackoverflow.com/comment/38852415
has comment: http://stackoverflow.com/comment/38852335
downvote count: 0
has comment: http://stackoverflow.com/comment/38852090
has comment: http://stackoverflow.com/comment/38852318
type: Answer
score: 2
answers question: http://stackoverflow.com/q/24990270
upvote count: 2
has comment: http://stackoverflow.com/comment/38852191
has comment: http://stackoverflow.com/comment/38852264

http://stackoverflow.com/a/48700678
answers question: http://stackoverflow.com/q/24973572
type: Answer
upvote count: 0
downvote count: 1
score: -1
has body: Here you are doing pass by reference only(both in the case of array and ArrayList). You are passing the reference of array from the main method which in turn is passed to every recursive call. So if you change anything in the array in each recursive call,then that change in the array will be reflected to called function. So you are correct about what you have learnt for pass by reference and pass by value. But your print method is confusing you and making things complicated for you. In your print method that takes ArrayList as an argument, you are printing the complete arraylist each after each recursive call. But for you array you are only printing it till particular index. You need to print complete array as you did with arrayList. Therefore, you can change the function signature of print method as following private static void print(String msg, int[] list ) { System.out.println(msg); for(int i = 0 ; i &lt;5; ++i) System.out.printf("%d ", list[i]); System.out.println(); }

http://stackoverflow.com/q/24973278
type: Question
score: 0
has comment: http://stackoverflow.com/comment/38820139
has body: How many object will be created for this syntax String a="b" +"c" +"d"; I tried asking with different people some say it will create 4 object some say 1 object.
answer count: 6
tagged with: string
has comment: http://stackoverflow.com/comment/38820122
has title: Object for the String
has answer: http://stackoverflow.com/a/24973328
has answer: http://stackoverflow.com/a/24973437
linked to: http://stackoverflow.com/q/6578133
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/18878496
has answer: http://stackoverflow.com/a/24973286
tagged with: object
duplicate of: http://stackoverflow.com/q/18878496
has answer: http://stackoverflow.com/a/24974121
has comment: http://stackoverflow.com/comment/38820144
has answer: http://stackoverflow.com/a/24973367
tagged with: java
has answer: http://stackoverflow.com/a/24973441

http://stackoverflow.com/comment/38735979
comment on: http://stackoverflow.com/q/24922294
has text: The only reason I can think that your log statements have not executed is if an Exception has been thrown. Are you sure you don't have an exception handler somewhere that's "eating" the Exception?
score: 0
type: Comment
type: QuestionComment

ibm-mq
tags question: http://stackoverflow.com/q/24914423
type: Tag
tags question: http://stackoverflow.com/q/24989777
tag name: ibm-mq
tags question: http://stackoverflow.com/q/25023982

http://stackoverflow.com/a/24949707
accepted answer of: http://stackoverflow.com/q/24910066
has comment: http://stackoverflow.com/comment/38777228
answers question: http://stackoverflow.com/q/24910066
has comment: http://stackoverflow.com/comment/38777309
score: 0
has comment: http://stackoverflow.com/comment/38776770
has body: Google App Engine uses the DataNucleus Access Platform as a JPA 1.0 implementation. By default DataNucleus JPA provider expects every class annotated as @Entity to have a jdoDetachedState property, mapped to an appropriate column in the database table. You have the following options: Add a property called jdoDetachedState to the entities and add appropriate columns to the tables as well. Switch off detached mode with DataNucleus by following the steps described in this Google Forums post. Add a transient property called jdoDetachedState to each entity as described in this DataNucleus JIRA.
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38777783
has comment: http://stackoverflow.com/comment/38777099
type: Answer

http://stackoverflow.com/q/24963696
answer count: 1
tagged with: python
has title: control java instance by (java script) interfaces from shell script?
type: UnansweredQuestion
tagged with: java
has body: I am absolutely new to java and am referring to a program energy2d. Its source code is here. It is run as an embeded applet(see at the website link in github, as I am not allowed to post more then one url) (functions with default locale for the browser) or on the command line: java -jar /home/ntu/Downloads/energy2d.jar And there are some commands for it, -I call them control interfaces further on, I guess they are some public methods but do not know the exact term for them - that control the program at runtime. see website manual scripts.html One can use them from inside the program in a embedded shell or you can see how they are called in the source of the website from java script at the embedded applet. I do not understand that well, it should just demonstrate that for example the string "reload" as a occurrence of the control interfaces is used in the page*s source. To my current knowledge I can not make out where they are defined; it is at github Scripter2D.java#L55 where I loose track within the java-code. (do not know if this helps) Now, what I want is to call these control interfaces from within an outside script. Let's say a bash script; well in the end I want it run python. something like command line pseudo code: snippet start java -jar /home/ntu/Downloads/energy2d.jar #to start the application java -do_to_running_program energy2d.jar -public_control_function load path/new_config.xml#to load another configuration file java -_do_to_running_program -public_control_function run #to restart snippet end Questions: -how is that achievable? -If it is not possible: what would be a good practice to change the java code in order to have this working? Any hints will be thanked.
tagged with: javascript
type: Question
score: 0
tagged with: bash
has answer: http://stackoverflow.com/a/24964284

http://stackoverflow.com/comment/38803429
score: 0
type: Comment
type: QuestionComment
has text: Yes, I do. Double most recent update, and double checked it.
comment on: http://stackoverflow.com/q/24964242

http://stackoverflow.com/q/25022326
has title: Map multiple JPA2.0 entity classes to the same table without inheritance
has answer: http://stackoverflow.com/a/25037561
tagged with: java
type: Question
tagged with: jakarta-ee
tagged with: ejb
tagged with: jpa
has body: I have several entity classes which have more or less the same attributes but unfortunately I have no option to apply some kind of proper inheritance among each other. Nevertheless my goal is to map all of these entities to the same table in the database. Is there a way to achieve this goal by any conventional JPA2.0 means? I like the idea of using some kind of discriminator, but as far as i know this approach is only available in the context of entity inheritance.
score: 0
answer count: 1
type: UnansweredQuestion
tagged with: openjpa

http://stackoverflow.com/comment/38804695
has text: Curiosity: Why aren't you using Activities?
type: QuestionComment
comment on: http://stackoverflow.com/q/24964694
type: Comment
score: 0

http://stackoverflow.com/q/24961973
has answer: http://stackoverflow.com/a/24962094
favorite count: 0
has answer: http://stackoverflow.com/a/24962136
has comment: http://stackoverflow.com/comment/38798902
has answer: http://stackoverflow.com/a/24962207
has answer: http://stackoverflow.com/a/24962028
has answer: http://stackoverflow.com/a/24962247
possible better answer: http://stackoverflow.com/a/24962094
has comment: http://stackoverflow.com/comment/38798855
has answer: http://stackoverflow.com/a/24962043
has body: Sorry if everyone sees me post a lot of silly questions today (just a preface). However this is the final for a summer class and my teacher stopped caring/explaining how to do things for my first coding class. For this project I have to print a list of integers from a .dat file into a program in reverse order with a max of 40 possible values in the array (Did all that) The problem I am encountering is that he said the program should also be flexible enough to deal with less than 40 values. However given my current code I always encounter an error saying "nosuchelementexception". Any help would be greatly appreciate. Below is a copy of what I have: import java.io.*; //Imports any file operation (ie Reading or Writing) import java.util.Scanner; //Imports scanner class public class program3 { public static void main(String [] ars) throws IOException { double [] Values; // creating array called value Values = new double [40]; // establishing array with 40 cells int k; // creating counter integer Scanner InputFile = new Scanner( new FileReader("temp.dat")); // input file you wish to open. for (k = 0 ; k &lt; Values.length ; k++) Values[k] = InputFile.nextDouble(); for (k = Values.length - 1 ; k &gt;= 0 ; k--) System.out.println("Cell " + k + " contains the value " + Values[k]); InputFile.close(); } }
type: AnsweredQuestion
score: 3
upvote count: 3
tagged with: java
has title: How to use portion of an array
has answer: http://stackoverflow.com/a/24962097
has comment: http://stackoverflow.com/comment/38798864
type: Question
answer count: 8
tagged with: arrays
has answer: http://stackoverflow.com/a/24962079
downvote count: 0
accepted answer: http://stackoverflow.com/a/24962097

http://stackoverflow.com/q/24954862
linked to: http://stackoverflow.com/q/3375121
answer count: 0
type: UnansweredQuestion
tagged with: canvas-lms
tagged with: java
has comment: http://stackoverflow.com/comment/38787066
type: Question
score: 0
has comment: http://stackoverflow.com/comment/39630059
tagged with: httpclient
has body: I want to Create a USER in Canvas LMS using their REST API. The certificate / ssl config / cacerts are all at right locations. I am able to POST a http post request to the url using CURL it works fine. I created a simple java class using httpclient and when i am trying to post the value it is not working...The response code is sometimes 400, 403. I am sending the Headers Authorization: Bearer AccessToken Still no luck..... can anyone help me on how to post a https post request through httpclient. regards
has title: httpclient https post method

http://stackoverflow.com/q/24920665
favorite count: 0
linked to: http://stackoverflow.com/q/9969024
linked to: http://stackoverflow.com/q/15265142
type: AnsweredQuestion
score: 1
tagged with: java
linked to: http://stackoverflow.com/q/18011949
upvote count: 1
type: Question
has body: I read through this Struts2 Validation for an array and it makes sense, but wished person (Quaternion) would explain how to "rewrite the above to specifically name fields (with indexes) in which case you can use , and you'll use the addFieldError method. For details on these tags see http://struts.apache.org/2.3.1.2/docs/tag-reference.html" This is what I have: <s:form action="saveOrUpdateAction" method="get"> <s:token/> Fund Award Code <s:iterator value="gfeListWithEmptyCode"> <s:property value="sfafund "/> <s:property value="awardcode"/> </s:iterator> <s:token /> <s:submit key="Submit2"/> </s:form> Part of my Action: public void validate() { if (fund == null || fund.trim().length() != 5 ) { System.out.println("testing+++++++++++++++++++1"); addFieldError("fund","Fund requires 5 characters."); } if (code == null || code.trim().length() != 3 ) { System.out.println("testing+++++++++++++++++++2"); addFieldError("code","Fund requires 3 characters."); } if (gfeListWithEmptyCode !=null) { int index = 0; for (GiftFundEntity giftFundEntity : gfeListWithEmptyCode) { if ( codeArray[index]!=null && codeArray[index].length() < 3 ) { System.out.println("testing+++++++++++++++++++3"); // technically, this is not possible to do because it requires codeArray[index] and not a string. addFieldError("codeArray","Code requires 3 characters."); index++; } } } try { this.execute(); } catch (Exception e) { e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. } } During validation, the red error message does not show up on the jsp page for obvious reasons because codeArray isn't listed by the indexes. How do I get this to work? * Please note* the array is dynamic. I looked through the struts documentation and searched through stackoverflow, but I don't see how it can be done. Thanks for your time.
has title: How to: Struts 2 validating dynamic forms array
accepted answer: http://stackoverflow.com/a/25068663
tagged with: struts2
tagged with: validation
has answer: http://stackoverflow.com/a/25068663
tagged with: arrays
answer count: 1
downvote count: 0
tagged with: jsp

http://stackoverflow.com/q/24983097
has comment: http://stackoverflow.com/comment/38838740
has comment: http://stackoverflow.com/comment/38855205
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38838967
has comment: http://stackoverflow.com/comment/38838904
has title: SpriteBatch drawing not working
answer count: 0
tagged with: java
has body: I am trying to make an inventory system for my game, but it isn't working. I have 3 classes that are needed for this to work. I have a Slot class: package com.mateo226.game; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.graphics.Texture; public class Slots { Texture Slot1, Slot2, Slot3, Slot4, Slot5; public Slots(){ Slot1 = new Texture(Gdx.files.internal("Inventory/slots/InventorySlot.png")); Slot2 = new Texture(Gdx.files.internal("Inventory/slots/InventorySlot.png")); Slot3 = new Texture(Gdx.files.internal("Inventory/slots/InventorySlot.png")); Slot4 = new Texture(Gdx.files.internal("Inventory/slots/InventorySlot.png")); Slot5 = new Texture(Gdx.files.internal("Inventory/slots/InventorySlot.png")); } public Texture getSlot1() { return Slot1; } public void setSlot1(Texture slot1) { Slot1 = slot1; this.Slot1 = slot1; } public Texture getSlot2() { return Slot2; } public void setSlot2(Texture slot2) { Slot2 = slot2; } public Texture getSlot3() { return Slot3; } public void setSlot3(Texture slot3) { Slot3 = slot3; } public Texture getSlot4() { return Slot4; } public void setSlot4(Texture slot4) { Slot4 = slot4; } public Texture getSlot5() { return Slot5; } public void setSlot5(Texture slot5) { Slot5 = slot5; } } I also have the Inventory class: package com.mateo226.game; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.Input.Keys; import com.badlogic.gdx.graphics.Texture; public class Inventory { String Slot1Item, Slot2Item, Slot3Item, Slot4Item, Slot5Item; String curItem; Slots slots = new Slots(); Texture slotChosen = new Texture(Gdx.files.internal("Inventory/slots/InventorySlotChosen.png")); public void update(){ if(Gdx.input.isKeyPressed(Keys.SPACE)){ slots.setSlot1(slotChosen); curItem = Slot1Item; slots.setSlot2(new Texture(Gdx.files.internal("Inventory/slots/InventorySlot.png"))); slots.setSlot3(new Texture(Gdx.files.internal("Inventory/slots/InventorySlot.png"))); slots.setSlot4(new Texture(Gdx.files.internal("Inventory/slots/InventorySlot.png"))); slo…
type: Question
has comment: http://stackoverflow.com/comment/38838764
tagged with: libgdx
tagged with: inventory
score: 0
has comment: http://stackoverflow.com/comment/38838840

http://stackoverflow.com/a/24933143
upvote count: 1
downvote count: 0
has body: I'm not surpised you get garbage: raf.writeBytes(buffer.toString()) The documentation for RandomAccessFile.writeBytes(String) says (emphasis added): Writes the string to the file as a sequence of bytes. Each character in the string is written out, in sequence, by discarding its high eight bits. In a few circumstances, that operation will result in a correctly encoded file. But in most it won't. That writeBytes() method is a foolish design by the Java developers. You need to correctly encode your text as bytes in UTF-8, and then write those bytes. Do you really need to operate on the file as a random access file. If not, just manipulate it with a Writer wrapping an OutputStream. You could use Charset.encode(CharBuffer) to produce a ByteBuffer holding the encoded bytes, then write those bytes to the file: raf.write(StandardCharsets.UTF_8.encode(buffer).array());
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38744864
accepted answer of: http://stackoverflow.com/q/24932750
type: Answer
answers question: http://stackoverflow.com/q/24932750
score: 1
has comment: http://stackoverflow.com/comment/133479054

http://stackoverflow.com/comment/38896342
type: QuestionComment
type: Comment
has text: I'm sure it's not just *your* local machine, but HTTPS from 127.0.0.1 will only ever secure the connection from the local machine where it's running to the local machine where it's running, for each desktop app user. It hardly makes sense to use HTTPS there at all.
score: 0
comment on: http://stackoverflow.com/q/24971552

http://stackoverflow.com/a/25001048
answers question: http://stackoverflow.com/q/25001011
has body: You created a raw ArrayList, then assigned it to an ArrayList&lt;Byte&gt;. You should have received a warning when you compiled this code about an unchecked assignment, and a warning about calling a raw ArrayList constructor given the typed return from Arrays.asList. Because of this, you wind up creating a List&lt;byte[]&gt;, creating a raw ArrayList with it, and assigning it to an ArrayList&lt;Byte&gt;. This only fails to create a ClassCastException because you assigned the return of get(0) to an Object. The reason it's a List&lt;byte[]&gt; is that a List&lt;byte&gt; isn't possible, because primitive types aren't allowed as generic type parameters, and Arrays.asList(T... a) is a generic method. The only inference is List&lt;byte[]&gt;.
downvote count: 0
type: Answer
score: 2
upvote count: 2

http://stackoverflow.com/comment/38745659
type: QuestionComment
type: Comment
score: 0
has text: @DtrollMC Which is line 50 in `QuizFragment`?
comment on: http://stackoverflow.com/q/24922803

http://stackoverflow.com/q/25014572
has title: Advantage of using JPAMetaModelEntityProcessor?
type: Question
has body: I just went through below link. http://hop2croft.wordpress.com/2011/07/07/criteria-jpa-2-0-and-database-metamodel-auto-generation-with-maven/ what is the advantage of using JPAMetaModelEntityProcessor? Thanks!
has answer: http://stackoverflow.com/a/25464530
score: 3
answer count: 1
tagged with: jpa
downvote count: 0
favorite count: 0
tagged with: jpa-2.0
type: UnansweredQuestion
upvote count: 3
tagged with: java
tagged with: hibernate

http://stackoverflow.com/comment/38761846
score: 0
has text: Given that you are assigning an instance of `List` in the constructor of `List` how do you think that would not result in an infinite loop?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24931677

http://stackoverflow.com/comment/38919038
has text: @ajb : Right... But I wrote note just to inform OP as he is looking for 5 digit only... If OP want to increase for more width, OP will add additional 0's in the code itself...
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25025546
type: Comment

http://stackoverflow.com/comment/38996573
has text: @VD': I don't want to use any plugins like m2e.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25066290

http://stackoverflow.com/a/24933454
upvote count: 0
answers question: http://stackoverflow.com/q/24926106
has comment: http://stackoverflow.com/comment/39583181
has body: You can use custom Stage window as a dialog and call Stage.initModality(Modality.APPLICATION_MODAL); method for it. Window will be blocked for its Application parent.
type: Answer
score: -1
downvote count: 1

http://stackoverflow.com/comment/38727644
type: Comment
has text: Thank you for this. I have added some additional code above - I am not sure if this is correct?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24920713

http://stackoverflow.com/a/24962576
upvote count: 2
has body: To remove characters at an index from a String you have to use a StringBuilder which is a mutable version of a String (you can change StringBuilders) String s = "Hello World"; StringBuilder sb = new StringBuilder(s); sb.removeCharAt(sb.indexOf('e')); s = sb.toString(); System.out.println(s); // Prints Hllo World
type: Answer
has comment: http://stackoverflow.com/comment/38800845
has comment: http://stackoverflow.com/comment/38800092
answers question: http://stackoverflow.com/q/24962540
score: 2
has comment: http://stackoverflow.com/comment/38800063
downvote count: 0

http://stackoverflow.com/comment/38773494
comment on: http://stackoverflow.com/a/24948262
score: 0
type: AnswerComment
type: Comment
has text: you can pass your parameter as url path not as query String

http://stackoverflow.com/comment/38712505
comment on: http://stackoverflow.com/a/24915819
type: Comment
score: 1
has text: @kerafill you don't need to worry about "&" because that is already decoded. for more info follow the link.
type: AnswerComment

http://stackoverflow.com/q/25004449
score: 0
tagged with: android
has body: i would like to create a social app. Not being a web or mobile developer, I am conflicted as to how developers manage / talk to databases. I guess my question really is, in a mobile social application, does the developer leave an open session at all times or do you login to the database only when needed. For example a user is using an app to search for friends or message people. At what time does the developer connect to the database to perform such actions? As soon as the application is opened or when the user performs the tasks? Any code snippets or youtube videos that illustrate this would be greatly appreciated.
possible better answer: http://stackoverflow.com/a/25004531
has answer: http://stackoverflow.com/a/25004511
has comment: http://stackoverflow.com/comment/38878815
has answer: http://stackoverflow.com/a/25004531
type: AnsweredQuestion
tagged with: java
tagged with: database
type: Question
accepted answer: http://stackoverflow.com/a/25004511
answer count: 2
has title: ANDROID - Session / database connection management (social app)
tagged with: ios

http://stackoverflow.com/comment/38878366
type: QuestionComment
has text: For my purpose, no they won't overlap.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25003953

http://stackoverflow.com/comment/38876977
type: AnswerComment
comment on: http://stackoverflow.com/a/25003519
type: Comment
score: 0
has text: Yes, depending on the particulars of the code it may be very inconvenient to copy-paste. Sometimes it goes well, sometimes it doesn't.

http://stackoverflow.com/q/25015887
has answer: http://stackoverflow.com/a/25015971
has body: I'm writing a program using JGrasp, where tile is a class. The Following code compiles: tile ext = new tile(); ext.assignValues(0); g.setColor(ext.color); g.fillRect(10+20, 35+20, 20, 20); But the following does not: tile[][] ext = new tile[1][1]; ext[0][0].assignValues(0); g.setColor(ext[0][0].color); g.fillRect(10+20, 35+20, 20, 20); Am I initializing the 2D array wrong, or am I misunderstanding how arrays work.
tagged with: object
type: AnsweredQuestion
tagged with: java
has title: Java: arrays of objects not working like non-arrayed objects
downvote count: 1
type: Question
tagged with: arrays
accepted answer: http://stackoverflow.com/a/25015930
score: 0
answer count: 2
upvote count: 1
possible better answer: http://stackoverflow.com/a/25015971
favorite count: 0
has answer: http://stackoverflow.com/a/25015930
tagged with: jframe

http://stackoverflow.com/comment/38802347
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24963450
score: 0
has text: Please describe the structure of your ear.

http://stackoverflow.com/a/24938116
downvote count: 0
has body: I think there might be some additional information that is missing. Aslong libgdx is using Bitmap-fonts for displaying all kind of text. (TextField is a part of scene2dui I think) The default Bitmap-Generation / Default-libgdx-font might only contain ASCII-code characters and some additional, but no cyrillic. That's why you would have to provide cyrillic chars manually in your BitmapFont aswell to be able to display them. The relatively new libgdx-extension for generating BitmapFonts out of an .ttf-Asset can also generate the cyrillic characters if you define them: TrueType Fonts in libGDX Then you'll be also able to use them in your game/app aslong you also define the newly generated font for your TextField / scene2dui style: Libgdx Scene2d - Set actor ( TextField ) padding? Here are also some tests in the libgdx-repo. Have a look there if there's a matter of missunderstanding: https://github.com/libgdx/libgdx/blob/master/tests/gdx-tests/src/com/badlogic/gdx/tests/extensions/InternationalFontsTest.java I hope this helps! cheers
upvote count: 6
has comment: http://stackoverflow.com/comment/38810895
accepted answer of: http://stackoverflow.com/q/24933903
has comment: http://stackoverflow.com/comment/38810936
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24933903
type: Answer
score: 6

http://stackoverflow.com/comment/38931664
comment on: http://stackoverflow.com/a/25022952
has text: I just want to understand how does it work. all information which I read isn't clear for me.
type: AnswerComment
type: Comment
score: 0

http://stackoverflow.com/comment/38818538
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24972326
has text: @laune I edited the post to add it.
score: 0

http://stackoverflow.com/a/25055244
accepted answer of: http://stackoverflow.com/q/25052628
has body: both of these methods solve my problem: Example Data: &lt;detail type="07" time="100611" no="07040365089" detail"&gt; with the idea that I want to replace 07040365089 with something else. no="\d" occurs multiple times in the actual data. There are other replacements that are required for different patterns. private String replaceStringFromPatternSearch2(String stringToSearch, String patternString, String replacementString) { String replacedString = ""; Pattern stringPattern = Pattern.compile(patternString); int startSearch = 0; Matcher stringMatcher = stringPattern.matcher(stringToSearch); while (stringMatcher.find(startSearch)) { int start = stringMatcher.start(1); int end = stringMatcher.end(1); replacedString += stringToSearch.substring(startSearch, start) + replacementString + stringToSearch.substring(end); startSearch = end + 1; } if (!replacedString.isEmpty()) { return replacedString; } else { return stringToSearch; } } private String replaceStringFromPatternSearch(String stringToSearch, String patternString, String replacementString) { String replacedString = ""; Pattern stringPattern = Pattern.compile(patternString); int startSearch = 0; Matcher stringMatcher = stringPattern.matcher(stringToSearch); StringBuffer sb = new StringBuffer(); while (stringMatcher.find()) { String wholeGroup = stringMatcher.group(0); replacedString = wholeGroup.replace(stringMatcher.group(1), replacementString); stringMatcher.appendReplacement(sb, replacedString); } stringMatcher.appendTail(sb); if (sb.length() &gt; 0) { return sb.toString(); } else { return stringToSearch; } }
type: Answer
score: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25052628

http://stackoverflow.com/comment/38834632
score: 0
type: QuestionComment
type: Comment
has text: http://en.m.wikipedia.org/wiki/Java_Naming_and_Directory_Interface Wikipedia can help you
comment on: http://stackoverflow.com/q/24981139

http://stackoverflow.com/comment/38841674
has text: i did what you said but }catch(java.awt.print.PrinterException e) give me an error
type: Comment
comment on: http://stackoverflow.com/a/24982387
type: AnswerComment
score: 0

http://stackoverflow.com/comment/38767477
has text: `Select memento from person` would work, right @Aeon? Every object table would have a single column for the Memento.
comment on: http://stackoverflow.com/a/24924566
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/38714899
has text: And by the way, afaik, the dot (".") is not an operator in Java and it is not called an "association".
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24916639
score: 0

http://stackoverflow.com/comment/38781327
type: QuestionComment
has text: It may have been loaded by a parent. Try climbing up the ClassLoader tree by calling `ClassLoader.getParent()` until you get `null`.
comment on: http://stackoverflow.com/q/24952386
score: 0
type: Comment

http://stackoverflow.com/q/25052414
tagged with: android-layout
answer count: 2
has answer: http://stackoverflow.com/a/25052807
accepted answer: http://stackoverflow.com/a/25052807
possible better answer: http://stackoverflow.com/a/25052515
tagged with: listview
score: 0
has comment: http://stackoverflow.com/comment/38969333
tagged with: android
has title: How do I use my new custom view in my ListView?
tagged with: http://stackoverflow.com/tag/xml
has answer: http://stackoverflow.com/a/25052515
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38969450
tagged with: java
has body: I'm new to Android so please forgive my ignorance~ I have a few questions that I haven't been able to find the answers to. I've created a new view called ImageTapView. The idea is that when you tap the view, an info overlay would appear. Here's the class (just barebones right now): package com.mysite; public class ImageTapView extends View { public ImageTapView(Context context, AttributeSet attrs){ super(context, attrs); init(context); } private void init(Context context){ } public void onClick(){ } } So far I've: Created the custom class file Create a layout xml file called image_tap_view.xml (I think I might be wrong here) Added declare-stylable to my res/values/attrs.xml And I'm pretty confused. Right now in my ListAdapter I'm returning an ImageView in getView(). So now I'd like to return an ImageTapView instead but pass the ImageView into my ImageTapView. So my question is: How do I pass this ImageView to the ImageTapView? Secondly, I'm pretty confused about the layout files. Right now in my image_tap_view.xml I have this: &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:custom="http://schemas.android.com/apk/res-auto" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent"&gt; &lt;com.mysite.ImageTapView android:layout_width="match_parent" android:layout_height="wrap_content" android:background="#333333" custom:labelPosition="left" custom:showText="true" /&gt; &lt;RelativeLayout android:layout_width="fill_parent" android:layout_height="fill_parent"&gt; &lt;TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Custom view Test" /&gt; &lt;/RelativeLayout&gt; &lt;/LinearLayout&gt; But it seems wrong to have my own custom view inside of my custom view layout xml. Wouldn't that cause an infinite loop? So my question is: Where and how do I specify the layout for my new ImageTapView? Thanks in advance!
type: Question

http://stackoverflow.com/q/25025927
tagged with: java
type: Question
has title: Rectangular section on ImageJ image does not do FFT
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/25026125
tagged with: fft
type: UnansweredQuestion
has body: So I built my own FFT algorithm apart from the ImageJ one and it does the FFT on the image but when I select a certain region of the image (using the rectangle selection tool) it doesn't do the FFT. If the selection size is a power of 2 (like selection height and width are suppose 128) it does the FFT on it. I want the FFT to be done regardless of the selection size. So I want to increase the array size to be a power of two and populate it but I don't know what size to increase it to and what to populate it with. Any help would be appreciated. This is my code (it checks the size of image width, height and then gets the pixels). This function resides in the FHT class: public void fftTransform(int w){ maxN = w; //check if the matrix is of size of power of 2. If not then display an error. this.widthSize = w; largeNum = (int)(Math.log(widthSize) / Math.log(2)); //if width=256, then temp =8 if(widthSize != (1&lt;&lt;largeNum)){ // "&lt;&lt;" signed left shift operator so it creates the number 256, and checks if the width is 256 or not (because it is a power of 2). String message = "The image size is not a power of 2. Please change image size in Image -&gt; resize"; JOptionPane.showMessageDialog(new JFrame(), message, "Error in overlapping images",JOptionPane.ERROR_MESSAGE); throw new IllegalArgumentException("Image is not a power of 2, fix width and height size of matrix"); } //get the data of the original image (pixel data). float[] fht = (float[])getPixels(); //fht is variable that maybe inherited and the name cannot change or the program will not work Transform3D transform = new Transform3D(fht); ComputeClassicalFFT myFFT = new ComputeClassicalFFT(); finalArray = myFFT.fft(fht, false); isFrequencyDomain = !false; }
tagged with: imagej

http://stackoverflow.com/q/25011968
has answer: http://stackoverflow.com/a/25012036
has comment: http://stackoverflow.com/comment/38893557
tagged with: mysql
has comment: http://stackoverflow.com/comment/38893008
has comment: http://stackoverflow.com/comment/38893187
has comment: http://stackoverflow.com/comment/38893040
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/25012042
upvote count: 0
score: -1
has comment: http://stackoverflow.com/comment/38893028
has comment: http://stackoverflow.com/comment/38893085
has answer: http://stackoverflow.com/a/25012053
answer count: 3
tagged with: connectivity
has body: I'm relatively new to java and have just started learning chow to connect mysql to java. This is my code to add details entered in java to a table in mysql: private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { String Name = t1.getText(); String Mobile = t2.getText(); String Email = t3.getText(); try { Class.forName("java.sql.DriverManager"); Connection con; con = (Connection) DriverManager.getConnection("jdbc:mysql://localhost:3306/cbse", "Mahima" , "mahima"); Statement stmt = (Statement) con.createStatement(); String query = "INSERT INTO contact VALUES ('"+Name+"','"+Mobile+"', '"+Email+"');"; stmt.executeUpdate(query); } catch(Exception e) { JOptionPane.showMessageDialog(this, e.getMessage()); } } How to fix the error??
tagged with: jdbc
has comment: http://stackoverflow.com/comment/38893143
has title: No suitable Driver found for jdbc:mysql://localhost:3306/dname
favorite count: 0
linked to: http://stackoverflow.com/q/8146793
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38893048
linked to: http://stackoverflow.com/q/2839321
has comment: http://stackoverflow.com/comment/38893495
has comment: http://stackoverflow.com/comment/38893302
tagged with: java

http://stackoverflow.com/a/24940300
has body: Simply read the whole file at once in char [] and then convert it into string. Aftert that split the string at "\n" get a line and then again split the line ", ".I think this will do the charm. import java.io.File; import java.io.FileReader; import java.io.IOException; public class Fileto2darray { /** * @param args * @throws IOException */ public static void main(String[] args) throws IOException { // TODO Auto-generated method stub File file = new File("yourfilename.txt"); FileReader fr = new FileReader(file); char temparr[] = new char[(int) file.length()]; fr.read(temparr,0,(int) file.length()); String [] tempstring = (new String(temparr)).split("\n"); String array2d[][] = new String [tempstring.length][]; for(int i=0 ; i&lt;tempstring.length; i++) { array2d[i]=tempstring[i].split(", "); } } }
downvote count: 0
answers question: http://stackoverflow.com/q/24924937
type: Answer
upvote count: 1
score: 1

http://stackoverflow.com/comment/38825808
comment on: http://stackoverflow.com/q/24976350
type: Comment
score: 0
has text: What about changing that into: `String result = in.replaceAll(removable, "");`, assuming `removable` is a String?
type: QuestionComment

http://stackoverflow.com/q/24992863
favorite count: 0
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24992890
tagged with: java
downvote count: 1
has title: Java - Assiging content of 3d array to a new 2d array
type: Question
tagged with: arrays
score: -1
has body: I have one array where information is stored: public static boolean[][][] position = new boolean[][][] { ... }; And one Array private boolean[][] myPosition; In the Constructor i wrote myPosition = position[pos]; Whenever I change something in myPosition it changes it also in the position array, which is not OK. Should i write a new method and use it in the Constructor like setPosition(position[pos]); which copys the array or what should I do?
tagged with: copy
accepted answer: http://stackoverflow.com/a/24992890
upvote count: 0
answer count: 1

http://stackoverflow.com/q/25025998
has comment: http://stackoverflow.com/comment/38919667
has title: Syntax for Structure and Pointers in C++ equivalent for Java
answer count: 3
tagged with: porting
has answer: http://stackoverflow.com/a/25026155
has body: Here I have a part of my code. There are 2 simple structures which are later used in the .cpp Send() method. //In the header file I have #define P32 (unsigned int) #define P16 (unsigned short) #define P8 (unsigned char) struct nd { P8 p; P8 c; P16 l; }; struct HELLO { P32 a1; P32 a2; P8 a3; }; //In the .cpp I have void Send() { DWORD dw = nd_s + sizeof( HELLO); BYTE *HelloPac=new BYTE[dw]; nd *HelloHr=(nd*)HelloPac; HELLO* _Hello=(HELLO*)(HelloPac+nd_s); HelloHr-&gt;c=0x10; HelloHr-&gt;p=0x09; Hellohr-&gt;l=36; _HELLO-&gt;a1=6001; _HELLO-&gt;a2=0 _HELLO-&gt;a3=120; //my own read write function streamReadWrite-&gt;Write(HelloPac, dw); } I am writing the same code in Java (porting the code). I am confused since I haven't done much coding in Java and since Java has no pointers no structures no unsigned integers, I am not getting how the syntax will be for the above code. Here's what I have got, but t throws syntax errors: public class abc { private static final int nd_s = 4; //hard-coded public class nd { public byte p; public byte c; public short l; } public class HELLO { public int a1; public int a2; public byte a3; } private void Send() { int dw = nd_s + 30; byte[] HelloPac = new byte[dw]; nd HelloHr = (nd)HelloPac; HELLO _Hello = (HELLO)(HelloPac + nd_s); } } Where am I going wrong in typecasting?
tagged with: c++
score: 0
linked to: http://stackoverflow.com/q/736815
possible better answer: http://stackoverflow.com/a/25026025
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/10803557
has answer: http://stackoverflow.com/a/25026025
tagged with: java
tagged with: typecasting-operator
has answer: http://stackoverflow.com/a/25026489
type: Question
linked to: http://stackoverflow.com/q/228783
accepted answer: http://stackoverflow.com/a/25026489

google-oauth
type: Tag
tags question: http://stackoverflow.com/q/25015263
tags question: http://stackoverflow.com/q/24971598
tag name: google-oauth

http://stackoverflow.com/q/24954281
has title: Is there a way to create Bookmarks for pdf documents in PDFBOX?
linked to: http://stackoverflow.com/q/8929954
has comment: http://stackoverflow.com/comment/38785519
tagged with: java
tagged with: pdfbox
type: Question
has comment: http://stackoverflow.com/comment/44825490
has comment: http://stackoverflow.com/comment/38823214
score: 0
has body: I am currently generating a large document from a database scheme and especially in bigger databases the amount of pages quickly exceeds 1000 pages... I use PDFBox to create the document and I am wondering whether PDFBox supports any way of creating Bookmarks that are displayed in the left side of Acrobat when viewing the document. On the website (and the related documentation) I haven't found anything helpful so far... Thanks in advance!
tagged with: pdf-generation
answer count: 0
type: UnansweredQuestion

webdriver
tags question: http://stackoverflow.com/q/24915842
tags question: http://stackoverflow.com/q/25013043
tags question: http://stackoverflow.com/q/24932763
tags question: http://stackoverflow.com/q/25034899
type: Tag
tags question: http://stackoverflow.com/q/24933786
tags question: http://stackoverflow.com/q/24969514
tag name: webdriver

http://stackoverflow.com/a/24996203
downvote count: 0
has body: EnumSet A = EnumSet.of(A1, A2, A3); EnumSet B = EnumSet.of(A3, A4, A5, A6); EnumSet intersection = EnumSet.copyOf(A); intersection.retainAll(B); retainAll modifies the underlying set so create a copy.
answers question: http://stackoverflow.com/q/24996093
score: 9
upvote count: 9
type: Answer

http://stackoverflow.com/comment/39000625
comment on: http://stackoverflow.com/q/25068792
type: QuestionComment
type: Comment
has text: @Eran I recommend you post your comment as an answer, as it solves this issue.
score: 1

http://stackoverflow.com/a/24972387
answers question: http://stackoverflow.com/q/24972100
has body: You can provide indexed property names for the lists you want to get in Java &lt;s:iterator value="questionsList" status="status"&gt; &lt;tr&gt; &lt;td&gt;&lt;s:property value="title"/&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt; &lt;s:radio list="{'A','B','C','D'}" name="questionsList[%{#status.index}].answer" theme="simple"/&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/s:iterator&gt; Voila! Your question list will be populated with indexes provided by status.index variable.
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/38833281
type: Answer
score: 3
accepted answer of: http://stackoverflow.com/q/24972100
upvote count: 3

http://stackoverflow.com/comment/38946131
comment on: http://stackoverflow.com/q/25040076
type: Comment
has text: @user3767879 Why do you need **two** values in your for-loop (i and j) if they both are always the same? And you do know that this: `for(i=0,j=0; i<=len,j<=len; i++,j++)` is no valid syntax?
score: 0
type: QuestionComment

http://stackoverflow.com/comment/38837571
type: QuestionComment
type: Comment
has text: you should use ExecutorService / Executors..
score: 0
comment on: http://stackoverflow.com/q/24982697

http://stackoverflow.com/comment/38924347
score: 0
has text: Create a custom class which extends from `JPanel`, which encapsulates the responsibilities of your current `order` pane. Then it becomes much simpler to manage and maintain
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25028396

http://stackoverflow.com/comment/38978963
type: AnswerComment
comment on: http://stackoverflow.com/a/25057343
type: Comment
has text: @Jongware: True. But I don't see a *real* application for this behaviour. If there was one, I would love to read about it in an answer. The problem with this semantics is you no longer have `a>>1==a/2`, so you cannot use shifting as a real substitute for the division operator anymore. And I do think that 99% of all programmers are not aware of that fact. Usually, rounding towards zero is what you want (and expect!) when performing an integer division.
score: 0

http://stackoverflow.com/a/68144996
type: Answer
has body: For users of the popular annotations library lombok, this can be easily configured by setting the below property in the lombok.config file that is usually placed under src/main/java. It makes sure accessor methods are not prefixed with get, set or is. lombok.accessors.fluent = true The given class compiles into this. Note the return type of the setters that allow function chaining. @Getter @Setter public class Person { private String name; private int birthYear; public String name() { return name; } public int birthYear() { return birthYear; } public Person name(String name) { this.name = name; return this; } public Person birthYear(int birthYear) { this.birthYear = birthYear; return this; } }
score: 0
answers question: http://stackoverflow.com/q/24975882

http://stackoverflow.com/comment/38729260
comment on: http://stackoverflow.com/a/24923935
type: Comment
score: 0
has text: Actually, I got what you meant here, but there is an issue i m facing now. I am calling this all in a constructor of a different class. If I use Rectangle of Shape API. How will I add it to my panel? Any idea?
type: AnswerComment

http://stackoverflow.com/comment/39279326
type: Comment
comment on: http://stackoverflow.com/a/24935739
has text: Using picasso now, best library for imageviews in my opinion.
score: 0
type: AnswerComment

http://stackoverflow.com/a/25000591
has comment: http://stackoverflow.com/comment/38874043
has comment: http://stackoverflow.com/comment/38873853
type: Answer
has comment: http://stackoverflow.com/comment/38873908
has comment: http://stackoverflow.com/comment/38873441
has comment: http://stackoverflow.com/comment/38873768
downvote count: 0
has comment: http://stackoverflow.com/comment/38872959
score: 1
has comment: http://stackoverflow.com/comment/38871657
has body: A basic example of using a SimpleCursorAdapter ... public void initAdapter(Context ctx, ListView myListView) { String strquery = "SELECT unique_column_name AS _id,column1,column2,column3,column4 FROM MY_TABLE"; cur = db.rawQuery(strquery,null); if (cur != null &amp;&amp; cur.getCount() &gt; 0) { String[] fromColumns = { "column1", "column2", "column3", "column4" }; int[] toViews = { R.id.textView1, R.id.textView2, R.id.textView3, R.id.textView4 }; SimpleCursorAdapter adapter = new SimpleCursorAdapter(ctx, R.layout.query_cell, cur, fromColumns, toViews, 0); myListView.setAdapter(adapter); } } When calling the method from an Activity use... initAdapter(this, listView1); From a Fragment use... initAdapter(getActivity(), listView1); In the above, the fromColumns array is the names of the database columns you want to map to the TextViews and the toViews array are the resource identifiers of each TextView in your list item layout (your query_cell,xml layout file). In the SimpleCursorAdapter constructor you then just pass in the list item layout resource id (R.layout.query_cell) and the columns and views arrays and SimpleCursorAdapter will do all of the rest of the work for you.
has comment: http://stackoverflow.com/comment/38895896
has comment: http://stackoverflow.com/comment/38874277
accepted answer of: http://stackoverflow.com/q/25000029
answers question: http://stackoverflow.com/q/25000029
has comment: http://stackoverflow.com/comment/38874133
upvote count: 1
has comment: http://stackoverflow.com/comment/38884784
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38922898
has comment: http://stackoverflow.com/comment/38871741

http://stackoverflow.com/comment/38703333
comment on: http://stackoverflow.com/q/24910131
has text: Gridbaglayout is what you need : http://blue-walrus.com/2011/12/gridbaglayout-tutorial/
score: 2
type: QuestionComment
type: Comment

http://stackoverflow.com/q/24935038
has answer: http://stackoverflow.com/a/25605866
has comment: http://stackoverflow.com/comment/38752205
has comment: http://stackoverflow.com/comment/38751947
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/38753111
type: Question
has comment: http://stackoverflow.com/comment/38752507
has comment: http://stackoverflow.com/comment/38752127
tagged with: network-programming
has comment: http://stackoverflow.com/comment/38752982
has comment: http://stackoverflow.com/comment/38752801
score: 0
tagged with: udp
has title: Java why isn't the socket listening on the local port I specified in the constructor / bound to?
answer count: 1
accepted answer: http://stackoverflow.com/a/25605866
has comment: http://stackoverflow.com/comment/38752257
has comment: http://stackoverflow.com/comment/38752942
has comment: http://stackoverflow.com/comment/38752357
has body: I'm having a weird problem, let's consider the following code : import java.net.*; import java.util.Enumeration; public class Main{ public static void main(String args[]) throws Exception { Inet4Address myIp = (Inet4Address)Inet4Address.getByName(Main.getLanIp()); InetSocketAddress myAddr = new InetSocketAddress(myIp, LocalportNumber); if(myIp == null){ throw new Exception(); } DatagramSocket socket = new DatagramSocket(myAddr); socket.setReuseAddress(true); InetAddress IPAddress = InetAddress.getByName("239.xxx.xxx.xxx"); byte[] sendData = new byte[1024]; byte[] receiveData = new byte[1024]; String sentence = "PAYLOAD"; sendData = sentence.getBytes(); DatagramPacket sendPacket = new DatagramPacket(sendData, sendData.length, IPAddress, distantPortNumber); DatagramPacket receivePacket = new DatagramPacket(receiveData, 1024); socket.send(sendPacket); System.out.println("Packet sent"); socket.receive(receivePacket); String modifiedSentence = new String(receivePacket.getData()); System.out.println("FROM SERVER:" + modifiedSentence); socket.close(); } static public String getLanIp() throws SocketException{ InetAddress inet_addr = null; NetworkInterface cur = null; for (Enumeration&lt;NetworkInterface&gt; interfaces = NetworkInterface.getNetworkInterfaces(); interfaces.hasMoreElements();){ cur = interfaces.nextElement(); try { if (cur.isLoopback()) { continue; } } catch (SocketException e) { // TODO Auto-generated catch block e.printStackTrace(); } System.out.println("interface " + cur.getName()); for (InterfaceAddress addr : cur.getInterfaceAddresses()){ inet_addr = addr.getAddress(); if ( !( inet_addr instanceof Inet4Address)){ continue; } System.out.println(" address: " + inet_addr.getHostAddress() + "/" + addr.getNetworkPrefixLength()); System.out.println(" broadcast address: " + addr.getBroadcast().getHostAddress()); } } return inet_addr.getHostAddress(); } } Execution trace : """ interface eth0 address: 192.168.0.20/24 broadcast address: 192.168.0.255 Packet sent ""…
has comment: http://stackoverflow.com/comment/38748784
tagged with: sockets

http://stackoverflow.com/a/25055404
type: Answer
accepted answer of: http://stackoverflow.com/q/25055280
score: 2
answers question: http://stackoverflow.com/q/25055280
upvote count: 2
has comment: http://stackoverflow.com/comment/49048096
has comment: http://stackoverflow.com/comment/38974820
has comment: http://stackoverflow.com/comment/38975220
has comment: http://stackoverflow.com/comment/39139009
type: AcceptedAnswer
downvote count: 0
has body: To resove this problem I have to add "Customer" in classpath for node manager. This means node manager has to be aware of all the objects that can be added in map(s) at build phase.

http://stackoverflow.com/a/25057601
has body: Try this: public static void main(String[] args){ System.out.println("Write some text here"); Scanner scanner = new Scanner(System.in).useDelimiter("\\n"); // Scans whole text String myChars = scanner.next(); char[] charArray = myChars.toCharArray(); for (char character : charArray) { System.out.println((int)character); } scanner.close(); } This converts the string to a char array and then prints out the string representation of each character.
score: 0
has comment: http://stackoverflow.com/comment/38979132
type: Answer
answers question: http://stackoverflow.com/q/25057365

http://stackoverflow.com/a/24950671
has body: I got it now. Jython can't execute 'native' libraries, such as cairo (I'm, sure it's native, because _cairo is a .so file, which means it's a C lib)
answers question: http://stackoverflow.com/q/24936229
type: Answer
accepted answer of: http://stackoverflow.com/q/24936229
score: 0
type: AcceptedAnswer

struts2
tags question: http://stackoverflow.com/q/24968820
tags question: http://stackoverflow.com/q/24934268
tags question: http://stackoverflow.com/q/24947534
tags question: http://stackoverflow.com/q/25027081
tags question: http://stackoverflow.com/q/25014625
tags question: http://stackoverflow.com/q/24966334
tags question: http://stackoverflow.com/q/25028145
tags question: http://stackoverflow.com/q/24991577
tags question: http://stackoverflow.com/q/24948972
tags question: http://stackoverflow.com/q/24995208
tags question: http://stackoverflow.com/q/24972559
tags question: http://stackoverflow.com/q/24950384
tags question: http://stackoverflow.com/q/24999656
tags question: http://stackoverflow.com/q/24975346
tags question: http://stackoverflow.com/q/24949018
tags question: http://stackoverflow.com/q/24990853
tags question: http://stackoverflow.com/q/25019265
tags question: http://stackoverflow.com/q/24970060
tags question: http://stackoverflow.com/q/24914646
tags question: http://stackoverflow.com/q/24952211
tag name: struts2
tags question: http://stackoverflow.com/q/24979244
tags question: http://stackoverflow.com/q/24979824
tags question: http://stackoverflow.com/q/24990948
tags question: http://stackoverflow.com/q/24939241
tags question: http://stackoverflow.com/q/25050799
tags question: http://stackoverflow.com/q/24955808
tags question: http://stackoverflow.com/q/25058745
type: Tag
tags question: http://stackoverflow.com/q/24920665
tags question: http://stackoverflow.com/q/24934351
tags question: http://stackoverflow.com/q/24972100
tags question: http://stackoverflow.com/q/24949557

http://stackoverflow.com/comment/40861374
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26061414
has text: Yes if you only enable that one it should always work. Note that the ones you select in the bottom table do not trigger the bug so you can keep access to them through cycling with ctrl+space.
type: AnswerComment

http://stackoverflow.com/q/25006856
has comment: http://stackoverflow.com/comment/38883222
has answer: http://stackoverflow.com/a/36472183
favorite count: 0
has answer: http://stackoverflow.com/a/25007064
accepted answer: http://stackoverflow.com/a/25007064
possible better answer: http://stackoverflow.com/a/36472183
upvote count: 5
has comment: http://stackoverflow.com/comment/38883196
tagged with: minimum
type: AnsweredQuestion
tagged with: 2-3-4-tree
downvote count: 0
tagged with: algorithm
has title: Finding the minimum value of a 2-3-4 tree
tagged with: java
has comment: http://stackoverflow.com/comment/38883359
has comment: http://stackoverflow.com/comment/38883449
type: Question
answer count: 2
has body: First off, this question isn't homework. I'm currently reading the book "Data Structures and Algorithms 2nd Edition" by Robert Lafore. In chapter 10, we learned about 2-3-4 trees and are then asked to write a method to find the minimum value in said tree. From a concept standpoint, I understand where the minimum value is. It is just the left most data item in a leaf. From a programming standpoint, I'm a little confused on how to implement a method to find this data item. I have a boolean that can tell if the node is a leaf. So what I originally did was this: public long minValue() { Node curNode = root; // current node = root long min = curNode.getMin(); while(!curNode.isLeaf()) { // while current node is NOT a leaf curNode = getNextChild(curNode, min); } // end while return min; } // end minValue() What this does (at least what I think it should do, is create a curNode that starts at the root node. Then create a min value that stores curNode.getMin. getMin() just gets the value at the array at index 0 (where the lowest value should be held). Then, while the current node is not a leaf, we should traverse to the next child from the minimum point. Once the current node is a leaf, it should return the minimum value. This doesn't work though. Does anyone have an idea on how to implement this? Hints or suggestions or anything else? Edit: To see each of the classes and how they interact, here are links to each separate class. I put the minimum value method in my Tree234 class DataItem, Node, Tree234, and where the program is run, Tree234App
score: 5
has comment: http://stackoverflow.com/comment/38883482

ondraw
type: Tag
tags question: http://stackoverflow.com/q/24996085
tag name: ondraw

http://stackoverflow.com/q/24941704
upvote count: 2
answer count: 3
has title: Do not understand why the following error shows in my code: non-static variable cannot be referenced from a static context
has answer: http://stackoverflow.com/a/24941766
has comment: http://stackoverflow.com/comment/38761169
downvote count: 1
has answer: http://stackoverflow.com/a/24941774
has answer: http://stackoverflow.com/a/24941761
favorite count: 0
tagged with: static
duplicate of: http://stackoverflow.com/q/926822
type: AnsweredQuestion
score: 1
tagged with: java
possible better answer: http://stackoverflow.com/a/24941766
tagged with: swing
type: Question
linked to: http://stackoverflow.com/q/926822
has body: I have looked at several posts regarding the above error. However I don't understand which part of my code is incorrect. The error applies to the following line: tempPic.setLocation(0, slotIDArray[0]); slotIDArray is ofcourse a non-static variable. newBloodhound, tempPic are also non-static variables. I am confused as to why there is an error related to this matter. Context: My code produces a GUI in which on the left side there is a panel divided into 42 "cells", each of which supports a DTPicture type (all these DTPicture cells are initialized to null. I use slotIDArray to keep an integral reference of the position i.e., pos 1 corresponds to Y= 38, etc. Just for testing purposes for later development, I assigned a random DTPicture to the Bloodhound component. Since DTPicture is a Component, I can set its location on the frame/panel. Therefore I call testPic.setLocation(0, slotIDArray[0]); to see if this picture will be transferred into the DTPicture "cell" located at that particular Y position. Thanks for the help. Below is the relevant segment of my code: public class RackBuilderTool extends JPanel{ public int[] slotIDArray = new int[42]; public RackBuilderTool() { super(new GridLayout(42, 1)); //DTPicture[] rackSlotArray = new DTPicture[42]; for (int i = 0; i &lt; 42; i++) { //add(new ComponentLabel()); DTPicture temp = new DTPicture(null); //address of DTPicture Component slotIDArray[i] = add(temp).getY(); /* add(new ComponentLabel("Bloodhound", "alexi.jpg", "Bloodhound label */ } } private static void createAndShowGUI() { JFrame frame = new JFrame("Rack Builder Tool"); frame.setPreferredSize(new Dimension(400, 600)); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); final RackBuilderTool rackBuilder = new RackBuilderTool(); rackBuilder.setOpaque(true); frame.add(rackBuilder); frame.pack(); JButton bloodhoundButton = new JButton("Bloodhound"); JButton computeButton = new JButton("Compute"); JButton powershelfButton = new JButton("Powershelf"); JButton serve…
accepted answer: http://stackoverflow.com/a/24941761

http://stackoverflow.com/comment/38923159
type: AnswerComment
score: 0
type: Comment
has text: marking this as answer because I don't have enough reputation to answer my own question :(
comment on: http://stackoverflow.com/a/25027753

http://stackoverflow.com/q/25031879
score: 1
favorite count: 0
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/37852311
tagged with: java
has answer: http://stackoverflow.com/a/28763698
upvote count: 1
tagged with: bing-api
linked to: http://stackoverflow.com/q/12648847
tagged with: odata4j
type: UnansweredQuestion
has body: I am trying to run Bing search API. I used odata4j and tried the code provided here: How to use Bing search api in Java ODataConsumer c = ODataConsumers .newBuilder("https://api.datamarket.azure.com/Bing/Search") .setClientBehaviors(OClientBehaviors.basicAuth("accountKey", "{your account key here}")) .build(); OQueryRequest&lt;OEntity&gt; oRequest = c.getEntities("Web") .custom("Query", "stackoverflow bing api"); Enumerable&lt;OEntity&gt; entities = oRequest.execute(); After I registered in the bing service, I obtained the key and placed it inside the double quotation in the above code. I got the following error: Exception in thread "main" java.lang.RuntimeException: Expected status OK, found Bad Request. Server response: Parameter: Query is not of type String at org.odata4j.jersey.consumer.ODataJerseyClient.doRequest(ODataJerseyClient.java:165) at org.odata4j.consumer.AbstractODataClient.getEntities(AbstractODataClient.java:69) at org.odata4j.consumer.ConsumerQueryEntitiesRequest.doRequest(ConsumerQueryEntitiesRequest.java:59) at org.odata4j.consumer.ConsumerQueryEntitiesRequest.getEntries(ConsumerQueryEntitiesRequest.java:50) at org.odata4j.consumer.ConsumerQueryEntitiesRequest.execute(ConsumerQueryEntitiesRequest.java:40) at BingAPI.main(BingAPI.java:20) Caused by: org.odata4j.exceptions.UnsupportedMediaTypeException: Unknown content type text/plain;charset=utf-8 at org.odata4j.format.FormatParserFactory.getParser(FormatParserFactory.java:78) at org.odata4j.jersey.consumer.ODataJerseyClient.doRequest(ODataJerseyClient.java:161) ... 5 more I could not figure out the problem.
has title: Bing Search API error using odata4j
tagged with: azure
downvote count: 0

relative-path
type: Tag
tag name: relative-path
tags question: http://stackoverflow.com/q/25002366
tags question: http://stackoverflow.com/q/24992412

http://stackoverflow.com/comment/38996312
type: Comment
type: QuestionComment
has text: What is your question?
comment on: http://stackoverflow.com/q/25066709
score: 3

http://stackoverflow.com/a/25032750
has comment: http://stackoverflow.com/comment/38932359
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38932812
answers question: http://stackoverflow.com/q/25032659
accepted answer of: http://stackoverflow.com/q/25032659
has comment: http://stackoverflow.com/comment/38932239
type: Answer
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/38932742
upvote count: 2
has body: A a2=new C(); That means you can access only the members of Class A and implementations of Class C, if any overridden. Now m3 is not a member of A. Clear ?

http://stackoverflow.com/comment/38816485
has text: Ok, I think now I understand. I'm going to test it. Thank you very much! :)
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24970928
score: 0

http://stackoverflow.com/comment/38933372
type: Comment
has text: Resolved it, my final solution would be to create a String array instead of one String. It was in PeterMmm's suggestion and works very nice.
comment on: http://stackoverflow.com/a/25030319
type: AnswerComment
score: 0

http://stackoverflow.com/a/24941596
has body: Based on your input file provided in the comments: "Bob Jones" 10.25 40.00 "Sam Smith" 15.00 45.50 "Jodi White" 20.50 32.25 Your program doesn't work as you expect it to because no employee in that list works more than 40 hours. 10.25, 15.00, and 20.50 are all less than 40.
upvote count: 8
answers question: http://stackoverflow.com/q/24941479
has comment: http://stackoverflow.com/comment/38760831
downvote count: 0
has comment: http://stackoverflow.com/comment/38772017
type: Answer
score: 8
has comment: http://stackoverflow.com/comment/38760800
has comment: http://stackoverflow.com/comment/38760985

http://stackoverflow.com/comment/38953231
type: AnswerComment
has text: Use a data type with larger capacity like `long'. If even that does not suffice, then you can think about using `BigInt`.
comment on: http://stackoverflow.com/a/25043395
type: Comment
score: 0

http://stackoverflow.com/a/25021399
score: 0
answers question: http://stackoverflow.com/q/25021329
type: Answer
has body: Oracle is considering CHEM a column name since it isn't quoted. To get Oracle to treat it as a string, use single quotes. String sql = "SELECT * " + "FROM AVAILABLE_TESTS " + "WHERE TST_CATAGORY='"+catg+"'";

http://stackoverflow.com/q/25021879
tagged with: refactoring
has comment: http://stackoverflow.com/comment/38912673
type: Question
has comment: http://stackoverflow.com/comment/38912945
has comment: http://stackoverflow.com/comment/38912762
has comment: http://stackoverflow.com/comment/38913733
tagged with: java
tagged with: database
has comment: http://stackoverflow.com/comment/44186593
has comment: http://stackoverflow.com/comment/38913076
score: 0
has comment: http://stackoverflow.com/comment/38912241
has title: Using reflection for reduce database queries
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38911954
has comment: http://stackoverflow.com/comment/38912303
has comment: http://stackoverflow.com/comment/38913192
answer count: 0
tagged with: reflection
has body: Background: I am currently working on a java project with two other people, and each of us are reading from an Oracle database and wrapping the returned rows in our own unique object. What stinks is that it requires 3 separate-but-nearly-identical methods: open the connection, create/execute the prepared statement, iterate over the results, return a list of the results. What we'd like to do is have just one method which would encapsulate that functionality, but we have the issue of specifying the unique data object. So, my question is would reflection be reasonable in this situation? My understanding is that it should be avoided because it tends to be a red flag for poor design, but using it would greatly reduce the number of methods that would be created initially as well as further down the line. I am aware that there could be an if/else chain to determine which object it is, i.e. if(objectTypeStr.equals("Foo")){ //insert into list of type Foo }else if(objectTypeStr.equals("Bar")){ //insert into list of type Bar (etc.)... However I feel that this would become a gross method to deal with, making reflection a clean way of dealing with this. I am open to any other ideas to solve this, thank you for reading through my question

http://stackoverflow.com/a/24912364
answers question: http://stackoverflow.com/q/24911633
has body: I answered a similar question to this not too long ago. Here's the code to get all methods from a given class, I think it's fairly self-explanatory: void foo(Object o) { Class&lt;?&gt; c = o.getClass(); for (Method m : c.getDeclaredMethods()) { //do whatever } } This takes advantage of the Java's Reflection API. You can read more about it here.
type: Answer
score: 0

http://stackoverflow.com/comment/38870898
type: Comment
comment on: http://stackoverflow.com/q/24999791
score: 0
type: QuestionComment
has text: What I mean by 'none of them seem to work', I mean when I try to enter the URL of the project (that has the build.xml in it), Eclipse won't let me import it. I'll give your suggestion a try.

http://stackoverflow.com/a/25047933
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/38960972
score: 2
accepted answer of: http://stackoverflow.com/q/25047821
has comment: http://stackoverflow.com/comment/38960973
has body: If you know the array size at compile time, using a bare int[] array is faster. Of course, the performance difference is probably negligible -- but the idea is that ArrayList is internally implemented as an Object[] array, so you're saving yourself that overhead, plus the overhead of dealing with Integer vs int.
answers question: http://stackoverflow.com/q/25047821
has comment: http://stackoverflow.com/comment/38961203
has comment: http://stackoverflow.com/comment/38961091
has comment: http://stackoverflow.com/comment/38960929
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/38961363
has comment: http://stackoverflow.com/comment/38961296

http://stackoverflow.com/comment/38880193
type: Comment
has text: Not sure if this is supported. We haven't tested this. Do you have an example of where you have tried this?
type: QuestionComment
comment on: http://stackoverflow.com/q/25003557
score: 0

http://stackoverflow.com/comment/38878517
has text: What you posted looks like an array of string. Is that supposed to be your output?
type: QuestionComment
comment on: http://stackoverflow.com/q/25004320
score: 0
type: Comment

http://stackoverflow.com/q/25012408
has comment: http://stackoverflow.com/comment/38893898
upvote count: 4
has answer: http://stackoverflow.com/a/25012492
type: AnsweredQuestion
downvote count: 0
linked to: http://stackoverflow.com/q/5399723
favorite count: 0
type: Question
tagged with: interface
has comment: http://stackoverflow.com/comment/38893847
accepted answer: http://stackoverflow.com/a/25012761
score: 4
tagged with: listener
has title: How to reimplement Java listeners with anonymous classes in C#
has body: I am trying to replicate my Java code in C# and I wish to know how can I replicate this Java functionality in C#. Util.java public class Util { public void function(String s, final SetAvailabilityStatusListener setStatusListener) { // .... } public static interface SetAvailabilityStatusListener { public void setAvailabilityStatus(Status status); } } Activity.java public class Activity { public void anotherFunction() { util.function("name", new SetAvailabilityStatus() { @Override public void setAvailabilityStatus(Status status) { loginSetAvailabilityStatus(status); } } } }
answer count: 2
tagged with: c#
tagged with: java
possible better answer: http://stackoverflow.com/a/25012492
has answer: http://stackoverflow.com/a/25012761
linked to: http://stackoverflow.com/q/8240490

http://stackoverflow.com/q/24922458
has comment: http://stackoverflow.com/comment/38725007
downvote count: 0
favorite count: 0
possible better answer: http://stackoverflow.com/a/24926568
has answer: http://stackoverflow.com/a/24926568
tagged with: collision
has answer: http://stackoverflow.com/a/24923217
has title: Collision detection method
upvote count: 1
has body: I'm making my first free-movement (not tiles restricted) 2d game and was wondering how to work with the collision detection. I have 3 possible methods on my mind but not sure what would be the most efficient one: Each object on map has a texture smaller then the image itself (for example, a tree would have a smaller texture representing the base of it only) that can't collide. For this i would use a 2nd invisible texture to mark the area. Each object has a rectangle or circular area for the collision. Possible each texture would need a aux file with how big the collision should be (tree example again). I create a tiled map where the tiles are small enough as to let the player almost touch the object. I would really appreciate if someone could help me decide what method I should be using x.x. thanks in advance. (If you play old games, I'm trying to follow the Secret of Mana game movement style, if that helps)
type: AnsweredQuestion
tagged with: libgdx
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/24923217
type: Question
answer count: 2

http://stackoverflow.com/comment/64103751
comment on: http://stackoverflow.com/a/25238064
type: AnswerComment
type: Comment
score: 1
has text: Just FYI you can perform automated builds with Eclipse PDE using a 'headless' eclipse. It is not exclusively user interface driven, the same process is available from the command line driven by a properties file. Search eclipse PDE Build help 'Customising a Headless Build' if interested.

http://stackoverflow.com/comment/44182697
type: QuestionComment
type: Comment
score: 0
has text: You should use "ps -ef", also try "jps -vlm", and finally change the suspend arg to "suspend=y", and the glassfish must wait until debugger is attached, if it doesn't then the jvm args are really ignored for some reason. Btw if you just want to run glassfish in debug mode, you don't have to pass agentlib args yourself, you can run it in debug mode directly from Eclipse.
comment on: http://stackoverflow.com/q/25056809

http://stackoverflow.com/comment/39010979
type: Comment
comment on: http://stackoverflow.com/a/25052196
score: 0
type: AnswerComment
has text: If you are using synthetic auto-incremented identifiers (IDENTITY, SEQUENCE, TABLE sequence) then you need to switch to using a business key instead. The hashCode/equals will not be consistent before and after inserting an entity.

http://stackoverflow.com/comment/38868169
comment on: http://stackoverflow.com/a/24998836
score: 0
type: AnswerComment
type: Comment
has text: FYI, added solution for use of a temporary `Set`.

http://stackoverflow.com/comment/38789869
has text: @SotiriosDelimanolis No, it always has the same key. So in this example it would always be named "usefulJsonObject"
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24947159
score: 0

http://stackoverflow.com/comment/38969638
has text: If both users use the same credentials, they are the same user. So what you mean is: prevent multiple login for a user.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25052679
score: 1

http://stackoverflow.com/a/26278925
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/41258198
upvote count: 2
answers question: http://stackoverflow.com/q/24969501
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24969501
downvote count: 0
has body: In my case cxf generates objects like public static class MyObject { @XmlMixed @XmlAnyElement(lax = true) protected List&lt;Object&gt; content; public List&lt;Object&gt; getContent() { if (content == null) { content = new ArrayList&lt;Object&gt;(); } return this.content; } } Then I use this function to get an xml string private static String elementToString(final ElementNSImpl doc) { try { StringWriter sw = new StringWriter(); TransformerFactory tf = TransformerFactory.newInstance(); Transformer transformer = tf.newTransformer(); transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "no"); transformer.setOutputProperty(OutputKeys.METHOD, "xml"); transformer.setOutputProperty(OutputKeys.INDENT, "yes"); transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8"); transformer.transform(new DOMSource(doc.getOwnerDocument()), new StreamResult(sw)); return sw.toString(); } catch (Exception ex) { throw new RuntimeException("Error converting to String", ex); } } You call it like elementToString((ElementNSImpl) myObject.getContent().get(0));

http://stackoverflow.com/a/27512427
score: 1
has body: If you want full portability and a "native terminal emulator", you will have to code something that picks the "right" terminal emulator yourself. There are two commands that do a bit of choosing themselves: On Debian based Distro's you can use x-terminal-emulator -e &lt;cmd&gt;, however this does not work on e.g. Centos. FreeDesktop has xdg-terminal (code) as part of the xdg-utils package, however the script seems not to be distributed at all. Since neither of these is guaranteed to be present, you will still have to test for availability and use xterm etc. as fall-back.
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/25005122
upvote count: 1

http://stackoverflow.com/comment/38721379
type: Comment
comment on: http://stackoverflow.com/a/24920576
has text: I admit, I'm confused about the downvotes on this one. It was the first idea that popped in my head too. Can anyone elaborate?
score: 2
type: AnswerComment

http://stackoverflow.com/q/25049427
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/25049458
possible better answer: http://stackoverflow.com/a/25049446
type: Question
has answer: http://stackoverflow.com/a/25049446
has answer: http://stackoverflow.com/a/25049450
has comment: http://stackoverflow.com/comment/38963776
score: 0
has title: Getting a java;23 error; saying '{' is expected but brackets look fine to me
has answer: http://stackoverflow.com/a/25049454
accepted answer: http://stackoverflow.com/a/25049450
answer count: 4
has body: please help getting "java:23 error: '{' expected" to me the brackets look right, appreciate the help! is there something else that I am missing? I've only just started getting into writing code and so far have loved it. I've done c# and visual basics as well as now taking Java. //Pizza applet to assist customers when ordering pizza //I had to make a pizza during this assignment :) //Import packages import java.awt.*; import java.awt.event.*; import javax.swing.*; public class PizzaShop extends JApplet { //Declare variables private int intBold; private JCheckbox tomatoCB, grennPepperCB, blackOliveCB; private JCheckBox MushroomCB, extraCheeseCB, pepperoniCB, sausageCB; private JRadioButton smallRB, mediumRB, largeRB; private JRadioButton thinRB, halfRB, panPizzaRB; private ButtonGroup sizeBG, typeBG; private JTextArea textArea; private Jbutton processB; private JLabel orderL; private EventHandler eHandler; } public class PizzaShop() { public void init() { //Set up layout Container c = getContentPane(); c.setLayout(null); eHandler = new EventHandler(); //Establish checkboxes tomatoCB = new JCheckBox("Tomato"); greenPepperCB = new JCheckBox("Green Pepper"); blackOliveCB = new JCheckBox("Black Olive"); mushroomCB = new JCheckBox("Mushroom"); extraCheeseCB = new JCheckBox("Extra Cheese"); pepperoniCB = new JCheckBox("Pepperoni"); sausageCB = new JCheckBox("Sausage"); //Set size and location tomatoCB.setSize(100, 25); greenPepperCB.setSize(100, 25); blackOliveCB.setSize(100, 25); mushroomCB.setSize(100, 25); extraCheeseCB.setSize(100, 25); pepperoniCB.setSize(100, 25); sausageCB.setSize(100, 25); tomatoCB.setLocation(50, 85); greenPepperCB.setLocation(50, 110); blackOliveCB.setLocation(50, 135); mushroomCB.setLocation(50, 160); extraCheeseCB.setLocation(50, 185); pepperoniCB.setLocation(50, 210); sausageCB.setLocation(50, 235); //Add CheckBox to layout c.add(tomatoCB); c.add(greenPepperCB); c.add(blackOliveCB); c.add(mushroomCB); c.add(extraCheeseCB); c.add(pepperoniCB); c…

http://stackoverflow.com/q/25025285
score: 0
tagged with: yaml
answer count: 1
has answer: http://stackoverflow.com/a/25025362
has body: I want to grab a Yaml file I stored on a web server (http://vastrealms.netne.net/Hub/punish.yml) and turn it in to a File object. I would then like to use a method such as FileConfiguration config = YamlConfiguration.loadConfiguration(thatFile) &lt;&lt; (That is from an API I am using, just converts File to another object) so that I can edit it as a Yaml file. After I have completed some of my methods that edit the file, I would like to upload it back to the web server. How could I download and upload it back to that host?
has title: Java how to load a Yaml file from web server, edit it, and save it to the web server?
type: UnansweredQuestion
tagged with: http
tagged with: java
type: Question

http://stackoverflow.com/q/25058636
has answer: http://stackoverflow.com/a/25064663
tagged with: testng
type: AnsweredQuestion
has title: Null Pointer Exception in mocking Interface method
tagged with: java
tagged with: unit-testing
type: Question
accepted answer: http://stackoverflow.com/a/25064663
tagged with: jmockit
score: 0
has body: I'm using TestNG for testing and JMockit for mocking mockMethod(). Here's the test case: @Test public void testClass1() { new MockUp&lt;MyInterface&gt;() { @Mock public int myMethod(final MyObject someObject ){ return 0; } }; MyObject obj = new MyObject(); Assert.assertEquals(obj.mockMethod(someObject),0); } } The mockMethod() I'm calling for assertEquals() looks like this: public class Class1 { MyInterface my; public int mockMethod(final MyObject someObject ){ ...... //processing steps return my.myMethod(someObject); } } Test case throws a Null pointer exception. What am I doing wrong? Do I mock the implementation of mockMethod()? I tried that too, but it hasn't worked.
answer count: 1

http://stackoverflow.com/a/24917771
downvote count: 0
answers question: http://stackoverflow.com/q/24917656
has body: this Keyword refers to the current instance of the class, and since calling wait() from the object itself already refers to the current instance's function, there is no difference between wait() and this.wait() in your case.
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/a/25043017
answers question: http://stackoverflow.com/q/25042912
type: Answer
has comment: http://stackoverflow.com/comment/81889268
has body: You are right about instantiating a graph of specific vertex type by : SparseGraph&lt;Integer&gt; g = new SparseGraph&lt;Integer&gt;(); Your Edge class should also contain the generic type parameter V, since it refers to it. public class Edge&lt;V&gt; ... Finally, the graph should hold a list of all the Edges. It could be stored in a list : public List&lt;Edge&lt;V&gt;&gt; neighbors = new ArrayList&lt;Edge&lt;V&gt;&gt;(); You might want, though, to maintain additional data structures to enable you to implement the neighbors and hasEdge methods efficiently. You can, for example, have a Map whose key in a Vertex (V) and whose value is a Set of all the Edges that begin or end in this vertex.
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25042912
score: 0

http://stackoverflow.com/comment/38928414
type: QuestionComment
has text: As suggested by Kayaman, impelemt Runnable should solve!
comment on: http://stackoverflow.com/q/25024776
score: 0
type: Comment

http://stackoverflow.com/q/24949529
answer count: 1
linked to: http://stackoverflow.com/q/18125294
has title: hibernate exception while running simple program
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24949574
tagged with: java
tagged with: hibernate
type: Question
has comment: http://stackoverflow.com/comment/38775903
score: 0
duplicate of: http://stackoverflow.com/q/18125294
has body: I am trying to execute simple hibernate java program - files used : hibernate.cfg.xml, Employees.cfg.xml Java classes : HibernateUtil.java,Employees.java,Gender.java(Enum),InsertIntoEmployee.java Code for InsertIntoEmployee.java package com.action.utilities.businessutilities; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; import org.hibernate.HibernateException; import org.hibernate.Session; import org.hibernate.Transaction; import com.action.utilities.hibernateutilities.HibernateUtil; import com.hibernate.models.Employees; import com.hibernate.models.Gender; public class InsertIntoEmployee { public InsertIntoEmployee() { // TODO Auto-generated constructor stub } /** * @param args * @throws ClassNotFoundException * @throws ParseException */ public static void main(String[] args) throws ClassNotFoundException { // TODO Auto-generated method stub SimpleDateFormat sdf=new SimpleDateFormat("MM/dd/yyyy"); Class.forName("com.action.utilities.hibernateutilities.HibernateUtil"); Session session=HibernateUtil.getSessionFactory().openSession(); try { Transaction tx=session.beginTransaction(); Employees emp=new Employees(); emp.setFirstName("Gaurav"); emp.setLastName("Palkar"); emp.setBirthDate(sdf.parse("01/17/1983")); emp.setGender(Gender.MALE); session.save(emp); session.getTransaction().commit(); } catch (HibernateException e) { // TODO Auto-generated catch block e.printStackTrace(); }catch(ParseException pe){ pe.printStackTrace(); }catch(Exception ee){ ee.printStackTrace(); }finally{ session.close(); } } } Getting the following error : java.lang.NoClassDefFoundError: javax/transaction/SystemException at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:270) at org.jboss.logging.Logger.getMessageLogger(Logger.java:2248) at org.jboss.logging.Logger.getMessageLogger(Logger.java:2214) at org.hibernate.cfg.Configuration.&lt;clinit&gt;(Configuration.java:176) at com.action.utilities.hibernateutilities.Hiber…

http://stackoverflow.com/q/24955446
has body: I am new to this android. Whenever I click the login button, it says "unfortunately, your app has stopped". There is no compile time error.. I am uploading my MainActivity.java, LoginActivity.java and manifest.xml files.. Please tell me whats the problem or am i doing something wrong? //MainActivity.java package com.satty002.swag; import java.util.Locale; import android.app.ActionBar; import android.app.Activity; import android.app.Fragment; import android.app.FragmentManager; import android.app.FragmentTransaction; import android.content.Intent; import android.os.Bundle; import android.support.v13.app.FragmentPagerAdapter; import android.support.v4.view.ViewPager; import android.util.Log; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import com.parse.ParseAnalytics; import com.parse.ParseUser; public class MainActivity extends Activity implements ActionBar.TabListener { public static final String TAG = MainActivity.class.getSimpleName(); /** * The {@link android.support.v4.view.PagerAdapter} that will provide * fragments for each of the sections. We use a * {@link FragmentPagerAdapter} derivative, which will keep every * loaded fragment in memory. If this becomes too memory intensive, it * may be best to switch to a * {@link android.support.v13.app.FragmentStatePagerAdapter}. */ SectionsPagerAdapter mSectionsPagerAdapter; /** * The {@link ViewPager} that will host the section contents. */ ViewPager mViewPager; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); ParseAnalytics.trackAppOpened(getIntent()); ParseUser currentUser = ParseUser.getCurrentUser(); if (currentUser == null) { navigateToLogin(); } else { Log.i(TAG, currentUser.getUsername()); } // Set up the action bar. final ActionBar actionBar = getActionBar(); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); …
has comment: http://stackoverflow.com/comment/38787052
has title: "unfortunately, app has stopped" on clicking login button
favorite count: 0
upvote count: 0
has answer: http://stackoverflow.com/a/24955601
accepted answer: http://stackoverflow.com/a/24955601
duplicate of: http://stackoverflow.com/q/23353173
tagged with: buttonclick
tagged with: android
score: -3
has answer: http://stackoverflow.com/a/24955912
has comment: http://stackoverflow.com/comment/38786272
type: AnsweredQuestion
tagged with: onclicklistener
tagged with: java
downvote count: 3
has comment: http://stackoverflow.com/comment/38786239
tagged with: eclipse
type: Question
has comment: http://stackoverflow.com/comment/38786141
has comment: http://stackoverflow.com/comment/38786538
possible better answer: http://stackoverflow.com/a/24955912
answer count: 2

http://stackoverflow.com/a/24986797
has comment: http://stackoverflow.com/comment/38918777
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/24985005
has body: Sure just put the python script in your assets, make it available and execute it with a java system call! Here is a link that shows how to run a python script on Android: https://code.google.com/p/python-for-android/wiki/RunPythonFromShell
upvote count: 1

http://stackoverflow.com/q/24988885
tagged with: java
tagged with: overriding
type: Question
has comment: http://stackoverflow.com/comment/38849669
tagged with: inheritance
has answer: http://stackoverflow.com/a/24988909
has comment: http://stackoverflow.com/comment/38849661
answer count: 3
has comment: http://stackoverflow.com/comment/38849668
has comment: http://stackoverflow.com/comment/38850288
has answer: http://stackoverflow.com/a/25004620
has answer: http://stackoverflow.com/a/24988895
has title: Output not Displaying as Expected
score: 0
accepted answer: http://stackoverflow.com/a/24988909
possible better answer: http://stackoverflow.com/a/24988895
linked to: http://stackoverflow.com/q/24987061
tagged with: tostring
has body: After struggling for a while but finally overcoming some compiler errors, I was finally able to get my program to compile and run. However, I did not get anywhere near the output I was supposed to get. The program is supposed to use an Account class and 2 subclasses (SavingsAccount and CheckingAccount) along with several methods to display a type of account history. Here is the code I have written so far: import java.util.Date; public class Account { private int id = 0; private double balance = 0; private double annualInterestRate = 0; private Date dateCreated = new Date(); public Account() { id = 0; balance = 0.0; annualInterestRate = 0.0; } public Account(int id, double balance) { this.id = id; this.balance = balance; } public int getId() { return id; } public double getBalance() { return balance; } public double getAnnualInterestRate() { return annualInterestRate; } public void setId(int newId) { this.id = id; } public void setBalance(double newBalance) { this.balance = balance; } public void setAnnualInterestRate(double newAnnualInterestRate) { this.annualInterestRate = annualInterestRate; this.balance = balance * annualInterestRate; } public java.util.Date getDateCreated() { return dateCreated; } public double getMonthlyInterestRate() { return annualInterestRate/12; } public double withdrawal (double withdrawalAmount) { return balance -= withdrawalAmount; } public double deposit (double depositAmount) { return balance += depositAmount; } public static void main(String[] args) { Account savingsAccount = new Account(1122, 20000); Account checkingAccount = new Account(1271, 150); System.out.println("Accounts Created!"); System.out.println(savingsAccount); System.out.println(checkingAccount); savingsAccount.setAnnualInterestRate(4.5); checkingAccount.setAnnualInterestRate(1.25); System.out.println("Updating Interest"); System.out.println(savingsAccount); System.out.println(checkingAccount); savingsAccount.withdrawal(5000); checkingAccount.withdrawal(300); System.ou…
type: AnsweredQuestion

http://stackoverflow.com/comment/38912736
type: Comment
comment on: http://stackoverflow.com/a/25001817
score: 0
type: AnswerComment
has text: That's weird to make a solution for tests(!) in Java(!) be platform dependent.

http://stackoverflow.com/a/24915861
score: 3
answers question: http://stackoverflow.com/q/24915336
downvote count: 0
has body: Rather than doing: private static SingleTonClass obj=null; You should use: (sorry for changing your weird class name at the same time). private static final Singleton INSTANCE = new Singleton(); To instantiate the only instance of your Singleton. After that, you are not going to do some mystical retrieval like: public static SingleTonClass CreateObj() { if (obj==null) { obj= new SingleTonClass(); } return obj; } Instead, you should define getInstance() method for retrieving your Singleton. public static Singleton getInstance() { return INSTANCE; } After these modiciations, your Singleton class should look like the following: public class Singleton { private static final Singleton INSTANCE = new Singleton(); private Singleton() { // This is called only once System.out.println("Private Constructor is called"); } public static Singleton getInstance() { return INSTANCE; } public static void main(String[] args) { // Even if you ask 100 times, this will only return the same INSTANCE Singleton stc = Singleton.getInstance(); Singleton stc1 = Singleton.getInstance(); Singleton stc2 = Singleton.getInstance(); } } And running it will, output: Private Constructor is called to your cmd or terminal. As a final note, as @Swapnil stated already: private Singleton() { ... } declaration is used to indicate that only the Singleton class itself is able to create the instance, which makes sense and rather than doing private static final Singleton INSTANCE = new Singleton(); you can further optimize your code by using an enum constant to store instance (noted by @JonK). For further reading I recommend: singleton pattern in java Cheers.
type: Answer
has comment: http://stackoverflow.com/comment/38712504
upvote count: 3

http://stackoverflow.com/a/24971424
type: Answer
score: 3
upvote count: 3
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24971035
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/103402973
answers question: http://stackoverflow.com/q/24971035
has body: The order of execution is right-associative with the ^= operator, so the code you have written is equivalent to: a ^= (b ^= (a ^= b)); The ^= operator is just shorthand for a = a ^ b, so if you fully expand this you get: a = a ^ (b = b ^ (a = a ^ b)); Now remember that the value of a will be taken at the start of evaluation of the expression, not at the moment of execution. Imagine a and b take the values 5 and 10. You're effectively computing: a = 5 ^ (b = 10 ^ (a = 5 ^ 10)); You actually need that first 5 to be 15 for the swap to work. So, as Alan Stokes has indicated, you need to separate out the expression into three (or just maybe two) statements in order to tell the compiler that the result of each one should be used in the next stage of calculation. a ^= b; b ^= a; a ^= b;

http://stackoverflow.com/comment/38898335
type: QuestionComment
comment on: http://stackoverflow.com/q/25014625
score: 0
type: Comment
has text: Do you think you have enough information you have posted here? And your Struts version is outdated, you should upgrade to the latest version ASAP if you want to get help.

http://stackoverflow.com/a/24922670
downvote count: 0
has body: It's implementation dependant (and heavily so, the algorithm is entirely up to the implementation, as long as it's consistent.) However, as per the answer here, you can see the native source file where the hash is generated in OpenJDK 7 (look at the get_next_hash() function), which actually specifies a number of possible algorithms in this particular release: // Possibilities: // * MD5Digest of {obj,stwRandom} // * CRC32 of {obj,stwRandom} or any linear-feedback shift register function. // * A DES- or AES-style SBox[] mechanism // * One of the Phi-based schemes, such as: // 2654435761 = 2^32 * Phi (golden ratio) // HashCodeValue = ((uintptr_t(obj) &gt;&gt; 3) * 2654435761) ^ GVars.stwRandom ; // * A variation of Marsaglia's shift-xor RNG scheme. // * (obj ^ stwRandom) is appealing, but can result // in undesirable regularity in the hashCode values of adjacent objects // (objects allocated back-to-back, in particular). This could potentially // result in hashtable collisions and reduced hashtable efficiency. // There are simple ways to "diffuse" the middle address bits over the // generated hashCode values // As already stated, the default algorithm is to simply go with a random number, however an interesting comment further down states: // Marsaglia's xor-shift scheme with thread-specific state // This is probably the best overall implementation -- we'll // likely make this the default in future releases. This is similar to the (obj ^ stwRandom) approach mentioned in the above list of possibilities, but it gets around the unwanted regularities associated with objects allocated quickly in succession by tying "thread-specific state" information into the hash also - so if two objects happened to be allocated at a very similar time due to them being allocated on two separate threads executing simultaneously, the discrete threading information fed into the hash should still ensure discrete enough hashes will be generated.
answers question: http://stackoverflow.com/q/24922452
type: Answer
score: 9
upvote count: 9
accepted answer of: http://stackoverflow.com/q/24922452
type: AcceptedAnswer

http://stackoverflow.com/q/24947876
has answer: http://stackoverflow.com/a/24959197
tagged with: java
tagged with: datetime-format
type: Question
has comment: http://stackoverflow.com/comment/38772784
has comment: http://stackoverflow.com/comment/38779108
has comment: http://stackoverflow.com/comment/38772865
tagged with: bean-validation
has title: Exception while binidng form to bean using Spring MVC, JSR 303 Annotation
answer count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/38772934
has comment: http://stackoverflow.com/comment/38772846
tagged with: spring
has body: I have a following spring form:input tag in my jsp which accepts a date. &lt;form:input type="text" id="fromDate" path="fromDate" /&gt; and I have a corresponding Java bean to bind the user entered date to fromDate property of the bean. @NotNull @Past @DateTimeFormat(pattern = "MM/dd/yyyy") private Date fromDate; When the users enters the date in "MM/dd/yyyy" format I am not getting any exception and the value is getting set to the bean variable properly. However when the user enters date in a different format ( ex : 23/12/2012) or invalid date ( ex: 060412009324092014) I am getting the following exception . Failed to convert property value of type java.lang.String to required type java.util.Date for property fromDate; nested exception is org.springframework.core.convert.ConversionFailedException: Failed to convert from type java.lang.String to type @javax.validation.constraints.NotNull @javax.validation.constraints.Past @org.springframework.format.annotation.DateTimeFormat java.util.Date for value 060412009324092014; nested exception is java.lang.IllegalArgumentException: Unable to parse 060412009324092014 Please help to display a valid message instead of the exception on the page. Thanks Mike
tagged with: spring-mvc
accepted answer: http://stackoverflow.com/a/24959197
score: 1
upvote count: 1
type: AnsweredQuestion

http://stackoverflow.com/a/24950158
has comment: http://stackoverflow.com/comment/38777839
accepted answer of: http://stackoverflow.com/q/24949964
answers question: http://stackoverflow.com/q/24949964
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/38778683
has comment: http://stackoverflow.com/comment/38777194
type: Answer
has comment: http://stackoverflow.com/comment/38847619
score: 2
has body: The attribute: mappedBy = "unitCode" is wrong: mappedBy should point to attribute of class StudentUnit, not String. So just clear mappedBy = "unitCode" or try bidirectional mapping like this: public class StudentUnit{ ... @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER, mappedBy = "studentUnit") private List&lt;Unit&gt; units; } @Entity @Table(name="UNITS") public class Unit { @Id @Column(name = "UNIT_CODE") private String unitCode; @ManyToOne @JoinColumn(name="STUDENT_NO_ID") private StudentUnit studentUnit; @Column(name = "UNIT_NM") private String unitNm; }
upvote count: 2
has comment: http://stackoverflow.com/comment/38779148

http://stackoverflow.com/q/25055892
tagged with: spring
type: AnsweredQuestion
tagged with: java
tagged with: hibernate
has body: I have following classes @Entity @Table(name="prm_user_permission") public class UserPermission { @Id @GeneratedValue(strategy=GenerationType.IDENTITY) @Column(name="prm_permission_id") private Integer permissionId; @Column(name="prm_permission_name") private String permissionName; @Column(name="prm_short_description") private String shortDescription; @Column(name="prm_description") private String description; @Column(name="prm_url") private String permissionUrl; @Column(name="prm_control") private String control; @Column(name="prm_create_user") private Integer creatUser; @Column(name="prm_parent_id") private Integer parentId; @Column(name="prm_system_id") private Integer systemId; // Getter and Setter And my code is public List&lt;UserPermission&gt; findAllBySystemId(int systemId) { List&lt;UserPermission&gt; userPermission = criteria().setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY) .add(eq("UserPermission.systemId", systemId).list(); return userPermission; } Now i want to get all data from this (UserPermission) table by "systemId".If i pass systemId=1 then it should give all data where the column is '1'. what is wrong in my code? while running it shows error like org.hibernate.QueryException: could not resolve property: UserPermission of: com.kgfsl.collections.core.security.models.UserPermission Plz anybody help
has title: How to find all data in DB using Hibernate?
has answer: http://stackoverflow.com/a/25055927
possible better answer: http://stackoverflow.com/a/25056296
type: Question
has answer: http://stackoverflow.com/a/25056296
accepted answer: http://stackoverflow.com/a/25055927
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/38975655

http://stackoverflow.com/q/24920712
has body: I'm trying to deploy an EAR file to WebLogic Server Version: 12.1.1.0 but it gives me this error: weblogic.management.DeploymentException: Error mydirectory/weblogic/LifeCycleListener : unsupported classversion 52.0 LifeCycleListener is a .java file. Here is the Java version I have installed on my machine, and with which i compiled the EAR file: C:\Users\USER&gt;java -version java version "1.8.0_11" Java(TM) SE Runtime Environment (build 1.8.0_11-b12) Java HotSpot(TM) Client VM (build 25.11-b03, mixed mode, sharing) javac 1.8.0_11 why is this happening? i have the JDK up to date and everything..is there any code I can put in the java file or any solution?
accepted answer: http://stackoverflow.com/a/24920845
upvote count: 1
type: AnsweredQuestion
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/24920845
has comment: http://stackoverflow.com/comment/38721995
type: Question
tagged with: weblogic
has comment: http://stackoverflow.com/comment/38721867
tagged with: javac
has title: Weblogic 12c deployment error : unsupported classversion 52.0
tagged with: ear
downvote count: 0
answer count: 1
favorite count: 0

http://stackoverflow.com/q/25044206
has answer: http://stackoverflow.com/a/25044544
type: Question
has comment: http://stackoverflow.com/comment/38953773
has body: I was wondering if it was possible to have a Java dictionary of objects where one of the fields of the object is defined to be the key of the dictionary. To be more specific, here's what I would like: I have defined a class with three fields. One of these fields is an Integer and is unique to each object. I would like this field to be the key of the dictionary.
has title: Dictionary of Objects where key is an instance field in Java
accepted answer: http://stackoverflow.com/a/25044393
score: 0
has answer: http://stackoverflow.com/a/25044263
answer count: 4
possible better answer: http://stackoverflow.com/a/25044263
has answer: http://stackoverflow.com/a/25044438
tagged with: dictionary
has answer: http://stackoverflow.com/a/25044393
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/a/24934324
answers question: http://stackoverflow.com/q/24933164
has body: One of the posible approach for this issue is to create simple class, lets say CustomImage with private ImageView object initialization and its setter and getter. Next, you can use this class to specify TableView&lt;T&gt; and TableColumn&lt;T&gt; generic types, set column's cell value factory, and populate table with your images. Implementation of example CustomImage class and its practical use is shown below: import javafx.scene.image.ImageView; public class CustomImage { private ImageView image; CustomImage(ImageView img) { this.image = img; } public void setImage(ImageView value) { image = value; } public ImageView getImage() { return image; } } Practical implementation: import javafx.application.Application; import javafx.collections.FXCollections; import javafx.collections.ObservableList; import javafx.scene.Parent; import javafx.scene.Scene; import javafx.scene.control.TableColumn; import javafx.scene.control.TableView; import javafx.scene.control.cell.PropertyValueFactory; import javafx.scene.image.Image; import javafx.scene.image.ImageView; import javafx.scene.layout.BorderPane; import javafx.stage.Stage; public class ImageViewInTableView extends Application { public Parent createContent() { /* layout */ BorderPane layout = new BorderPane(); /* layout -&gt; center */ TableView&lt;CustomImage&gt; tableview = new TableView&lt;CustomImage&gt;(); /* layout -&gt; center -&gt; tableview */ /* initialize two CustomImage objects and add them to the observable list */ ObservableList&lt;CustomImage&gt; imgList = FXCollections.observableArrayList(); CustomImage item_1 = new CustomImage(new ImageView(new Image("Icon_AddNewPatient.png"))); CustomImage item_2 = new CustomImage(new ImageView(new Image("Icon_EditPatient.png"))); imgList.addAll(item_1, item_2); /* initialize and specify table column */ TableColumn&lt;CustomImage, ImageView&gt; firstColumn = new TableColumn&lt;CustomImage, ImageView&gt;("Images"); firstColumn.setCellValueFactory(new PropertyValueFactory&lt;Cu…
upvote count: 16
score: 15
downvote count: 1
type: Answer

http://stackoverflow.com/a/25042062
has body: System.in is a BufferedInputStream, try this: System.err.println(System.in.getClass()); So you may get that stalled behaviour, because the buffer will wait for more data, sometimes it get flushed, sometimes not. If System.in is user input thru keyboard it will stop on Ctrl-Z (Windows) or Ctrl-D (*nix). If you want to read user input from keyboard you should use Console.
downvote count: 0
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/25040921
has comment: http://stackoverflow.com/comment/38949694

http://stackoverflow.com/comment/38719311
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24917112
has text: As I said in one of the previous comments, "It gets called in the Main class, in the onEnable()". Line 102 is marked in the code. `try (PreparedStatement pstat = conn.prepareStatement("SELECT 1 FROM tokens WHERE name=? LIMIT 1"))// Error line (Line 102)!` {
score: 0

http://stackoverflow.com/q/24922803
has comment: http://stackoverflow.com/comment/38745659
has comment: http://stackoverflow.com/comment/38758821
tagged with: android-seekbar
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/38815410
has comment: http://stackoverflow.com/comment/38726171
has comment: http://stackoverflow.com/comment/38725733
tagged with: android-fragments
score: 0
tagged with: java
type: Question
has title: Rating Bar not changing
tagged with: android-layout
answer count: 2
has body: SO the app I am writing has two(so far) seekbars that are in a Fragment. The rating bar is in the Main layout file. What I need to happen is the Rating Bar progress to change based on the values of the SeekBars. Here is the code, so you have a better idea: Fragment Java File package com.example.tipquiz; import android.app.Fragment; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.RatingBar; import android.widget.SeekBar; import android.widget.SeekBar.OnSeekBarChangeListener; import android.widget.TextView; public class QuizFragment extends Fragment implements OnSeekBarChangeListener { SeekBar fqBar, cBar; TextView fqTV, cTV; TextView fqTVP, cTVP; RatingBar rb; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment View view = inflater.inflate(R.layout.quiz_fragment_layout, container, false); //Inflate the Main layout to access the RatingBar View mainView = inflater.inflate(R.layout.activity_main, container, false); //FoodQuality Bar fqBar = (SeekBar) view.findViewById(R.id.seekBarFQ); fqBar.setOnSeekBarChangeListener(this); fqTV = (TextView) view.findViewById(R.id.textViewFQ2); fqTVP = (TextView) view.findViewById(R.id.textViewFQP); //Cleanliness Bar cBar = (SeekBar) view.findViewById(R.id.seekBarC); cBar.setOnSeekBarChangeListener(this); cTV = (TextView) view.findViewById(R.id.textViewC2); cTVP = (TextView) view.findViewById(R.id.textViewCP); rb = (RatingBar) mainView.findViewById(R.id.ratingBar1); return view; } @Override public void onProgressChanged(SeekBar arg0, int progress, boolean fromUser) { switch(arg0.getId()) { case R.id.seekBarFQ: if(progress &gt; 70 &amp;&amp; progress &lt; 90){ fqTV.setText("Above Average - "); rb.setRating(4); }else if(progress &gt; 40 &amp;&amp; progress &lt;= 70){ fqTV.setText("Average - "); }else if(progress &lt;= 40){ fqTV.setText("Awful - "); }e…
has answer: http://stackoverflow.com/a/24922844
has answer: http://stackoverflow.com/a/24924046

http://stackoverflow.com/q/24918293
downvote count: 0
tagged with: string
favorite count: 0
accepted answer: http://stackoverflow.com/a/24918466
has comment: http://stackoverflow.com/comment/38717049
tagged with: regex
tagged with: css
has title: change the String of a file'path in Java
has answer: http://stackoverflow.com/a/24918346
score: 2
upvote count: 2
possible better answer: http://stackoverflow.com/a/24918346
type: Question
type: AnsweredQuestion
has body: As it mentioned in the topic, is there a way to change the String of a file's path in java? For example: String fileName = "scripts/css/an.main.master.css"; How can I just keep the file's name “an.main.master.css” and change the folder path "scripts/css" to whatever I want? In other word, how can I detect the last backslash(the substring after that slash will be the file's name, and the substring before that slash will be the path). I am thinking to using Regular Expression, but I am not good at this. Can anyone help?
tagged with: java
has answer: http://stackoverflow.com/a/24918466
tagged with: replace
answer count: 2

http://stackoverflow.com/q/24956090
type: UnansweredQuestion
score: 0
has body: This is the piece of code that I am writing in order to read five lines from the web page. But instead of the content I end up getting the html tags . I have tried to find out online and it says proxyhost and proxyport need to be set (http://docs.oracle.com/javase/tutorial/networking/urls/_setProxy.html), But I cant figure out what should be my proxyhost and proxyport. How can I find that ? BufferedReader keyboard; String inputLine; keyboard = new BufferedReader(new InputStreamReader(System.in)); System.out.print("Please enter the name of a website "); System.out.flush(); /* Make sure the line is printed immediately. */ inputLine = keyboard.readLine(); URL webpage=new URL("http://"+inputLine+".com/"); BufferedReader br=new BufferedReader(new InputStreamReader(webpage.openStream())); String reading_five_lines; int count=0; while((reading_five_lines=br.readLine())!=null||count&lt;5) { count++; System.out.println(reading_five_lines); }
tagged with: java
has title: Accessing web page content using java networking
type: Question
has comment: http://stackoverflow.com/comment/38787759
has comment: http://stackoverflow.com/comment/38787579
tagged with: network-programming
answer count: 1
has answer: http://stackoverflow.com/a/24956234

http://stackoverflow.com/comment/38782450
type: QuestionComment
comment on: http://stackoverflow.com/q/24953328
score: 3
has text: why do you want to continue using outdated libraries?
type: Comment

http://stackoverflow.com/comment/40429899
has text: By ruling out option 1 you are looking for a `PropertyEditor` that gets an entire `HttpServletRequest` so that it can examine each and every form field. The `PropertyEditor` will then construct an object based on the information it finds in the submitted form. The trouble is that the `PropertyEditor` implementation you will provide will be a sub-class of `java.beans.PropertyEditorSupport`, which has no dependency on `HttpServletRequest`. So, there isn't an easy example of implementing option 2. You will have to go through the Spring MVC documentation to develop your own solution.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25359169

http://stackoverflow.com/a/24915600
answers question: http://stackoverflow.com/q/24915337
has comment: http://stackoverflow.com/comment/57202603
type: Answer
has body: But you see, why it's a not that obvious idea? How would it behave for methods without parameters? foo.aVeryLongMethodNameWhichCausesLineWraps( ); It doesn't look that good, does it? There are of course pros and cons for each code formatting, but if you use not that good API of some guy from your office and that guy wanted to have 10 parameters in his methods it would mean that you'd have something like this: foo.bar( nested( param1, param2, param3, param4, param5, param6, param7, param8, param9 ), param1, param2, param3, param4, param5, param6, param7, param8, param9 ); You can ease your pain of improper formatting by using Editbox plugin: http://editbox.sourceforge.net
score: 0

embeddable
type: Tag
tags question: http://stackoverflow.com/q/24958897
tag name: embeddable

http://stackoverflow.com/a/25016764
accepted answer of: http://stackoverflow.com/q/25014535
answers question: http://stackoverflow.com/q/25014535
has body: Host it using a dedicated or VPS(virtual private server) below are 2 of my personal cloud/vps providers that i use. You can look around for more but yeah shared hosting in my opinion is for entry thing or when you don't want to have to worry about the underlying platform. If you have a understanding of linux and managing your own servers then i would go for vps all the way. http://aws.amazon.com/ and https://www.digitalocean.com/ With regards to the PHP part of the question as I stated in my comment if you have ssh access you can run your PHP script php myscript.php though i am not to sure how you would wrap your java service.
upvote count: 1
has comment: http://stackoverflow.com/comment/38902616
score: 1
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/a/24928093
answers question: http://stackoverflow.com/q/24927895
upvote count: 1
has body: No, the Java Garbage collector will only remove objects for which there are no valid references. Setting all the fields of an object to null does not reduce the reference count of the object itself. It may, however, allow the GC to remove the objects that those fields once referenced, if those fields were the only (or last) reference to the objects.
type: Answer
downvote count: 0
score: 1

http://stackoverflow.com/comment/41918063
type: QuestionComment
has text: Did you ever find a nice solution for this problem? I've been looking for one myself for many hours now. More generally, it seems to be nearly impossible to set custom, per-request properties on the `Marshaller`, which seems like a lacking feature to me.
type: Comment
comment on: http://stackoverflow.com/q/24982720
score: 0

http://stackoverflow.com/a/25022633
has body: Initialize final variables in the class constructor. public class Blam { private final int qbert; public Blam(int qbertValue) { qbert = qbertValue; } }
score: 0
type: Answer
answers question: http://stackoverflow.com/q/25021744

http://stackoverflow.com/a/25065231
score: 1
type: Answer
has body: To insert text at the cursor's position use: String copiedText = ""; if ("user presses copy button") { if (textArea.getSelectedText() != null) { copiedText = textArea.getSelectedText(); } } if ("user presses paste button") { textArea.insert(copiedText, textArea.getCaretPosition()); }
upvote count: 1
accepted answer of: http://stackoverflow.com/q/25064999
answers question: http://stackoverflow.com/q/25064999
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/25059301
has title: Can't display log anywhere in railo
type: Question
tagged with: railo
tagged with: arrays
answer count: 1
tagged with: javascript
has answer: http://stackoverflow.com/a/25067923
has body: I want to display log in standard browser console in Railo. This is my code : log.info("Event Handler Called"); or WriteLog (text="Event Handler Is Called", type="error", application=true, file="", log=""); The text "Event Handler Is Called" is not logged anywhere.
score: 0
tagged with: cfml
type: UnansweredQuestion
tagged with: java

http://stackoverflow.com/comment/38758389
type: Comment
type: QuestionComment
has text: @AlexR "WOW64 is provided with the operating system and does not have to be explicitly enabled". So why am I getting this error then?
comment on: http://stackoverflow.com/q/24940043
score: 0

http://stackoverflow.com/comment/38887996
has text: thank you. 2. If max threads = 500, it means I have 500 threads for IO, which means 500 sockets +-, right? 4. AFAIK TCP packets are normally 1500 (unless fragmented), jumbo frames usually get sliced through public networks. But anyway - how does the sending end know or care about the receiving buffer size? there's a bunch of routers and switches in between
comment on: http://stackoverflow.com/a/24999398
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/a/24932478
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24929532
score: 0
has body: I think, i managed to answer all your problems, but i needed to create another class which i called 'OInternalFrame', so i will give you both code for those class. Tell me if that's what you were trying to achieve : OpenDemo : import java.awt.FileDialog; import java.awt.FontMetrics; import java.awt.Rectangle; import java.beans.PropertyVetoException; import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.util.ArrayList; import java.util.logging.Level; import java.util.logging.Logger; import javax.swing.AbstractButton; import javax.swing.JTabbedPane; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import javax.swing.event.InternalFrameAdapter; import javax.swing.event.InternalFrameEvent; import javax.swing.text.BadLocationException; import javax.swing.text.Element; import javax.swing.text.JTextComponent; 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; public OpenDemo() { initComponents(); viewLineNumbers.setSelected(false); } @SuppressWarnings("unchecked") // &lt;editor-fold defaultstate="collapsed" desc="Generated Code"&gt; private void initComponents() { tp = new javax.swing.JTabbedPane(); jMenuBar1 = new javax.swing.JMenuBar(); jMenu1 = new javax.swing.JMenu(); open = new javax.swing.JMenuItem(); cut = new javax.swing.JMenuItem(); selectAll = new javax.swing.JMenuItem(); viewLineNumbers = new javax.swing.JCheckBoxMenuItem(); 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); cut.setText("Cut"); cut.addActionListener(new java.awt.event.ActionListener() { public voi…
type: Answer
accepted answer of: http://stackoverflow.com/q/24929532

http://stackoverflow.com/a/25030013
has comment: http://stackoverflow.com/comment/38927724
has body: I believe for applications to show up in Contacts like the above example, they must also be added in the 'Accounts' section in the settings menu on Android. You can find more about how exactly to do that here: http://developer.android.com/reference/android/accounts/package-summary.html
answers question: http://stackoverflow.com/q/25029855
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25029855
type: Answer
has comment: http://stackoverflow.com/comment/38927186
has comment: http://stackoverflow.com/comment/38927025
has comment: http://stackoverflow.com/comment/96873523
score: 1
has comment: http://stackoverflow.com/comment/106208031
upvote count: 1

http://stackoverflow.com/comment/38929678
type: Comment
comment on: http://stackoverflow.com/a/24968704
has text: I have edited the codes from what I understand from your explanation. Did I use the 'try' portion correctly? The program is not able to read the "file" under the main method. I believe I am missing something but I don't know what it is. I would appreciate any explanation. Thanks!
type: AnswerComment
score: 0

http://stackoverflow.com/q/25066508
answer count: 1
has title: How do you convert a List<String> into a List<enum> in java 6?
accepted answer: http://stackoverflow.com/a/25066875
has comment: http://stackoverflow.com/comment/38996004
favorite count: 0
has comment: http://stackoverflow.com/comment/38995919
has comment: http://stackoverflow.com/comment/38997121
has comment: http://stackoverflow.com/comment/38995949
has comment: http://stackoverflow.com/comment/38995948
downvote count: 3
score: -3
has comment: http://stackoverflow.com/comment/38996639
has body: I basically need the Java version of this question. I am having a hard time figuring out how to translate that into java. Say I have an enum of numbers and each one has its own class and method public enum Numbers{ one, two, three .... } I ended up in my program have a list of strings so I need to convert them to a list of enums so I can do something like for(Number number : listOfNumbers) { switch (number) { case one: new One(); One.oneMethod(); break; ... } }
has answer: http://stackoverflow.com/a/25066875
type: AnsweredQuestion
tagged with: list
tagged with: enums
tagged with: java
has comment: http://stackoverflow.com/comment/38998013
has comment: http://stackoverflow.com/comment/38996116
type: Question
has comment: http://stackoverflow.com/comment/38996330
linked to: http://stackoverflow.com/q/4426537
upvote count: 0

heap-memory
tag name: heap-memory
tags question: http://stackoverflow.com/q/24933492
tags question: http://stackoverflow.com/q/24997934
tags question: http://stackoverflow.com/q/25057936
type: Tag
tags question: http://stackoverflow.com/q/24959128
tags question: http://stackoverflow.com/q/25015622

http://stackoverflow.com/q/24947753
has comment: http://stackoverflow.com/comment/38772627
score: 1
tagged with: workspace
has comment: http://stackoverflow.com/comment/38772588
favorite count: 0
type: Question
upvote count: 1
has answer: http://stackoverflow.com/a/24948239
tagged with: java
answer count: 3
tagged with: eclipse
has body: When I try to change the workspace I'm using on eclipse, the program automatically changes from Java to Java EE (according to the top of the panel). I do not want this; I want to have a workspace that I can use for my own projects (the one I am changing from is the workspace that contains all tutorials) that is essentially identical to the space I use for tutorials. But I am having trouble doing so. Any advice?
tagged with: jakarta-ee
downvote count: 0
type: UnansweredQuestion
has title: Changing the eclipse workspace
has answer: http://stackoverflow.com/a/24947843
has answer: http://stackoverflow.com/a/24948376

http://stackoverflow.com/comment/63731522
comment on: http://stackoverflow.com/a/24981493
score: 0
type: Comment
type: AnswerComment
has text: I think the 4th approach, using implicit class parameters, is much like saying "pass the dependencies as class arguments". The implicits only reduce code bloat a little, and opens up for flexibility about where the dependency will come from (caller's implicit, import, etc).

http://stackoverflow.com/q/25064203
type: Question
tagged with: performance
tagged with: java
score: 0
answer count: 1
tagged with: deserialization
tagged with: serialization
type: UnansweredQuestion
tagged with: android
has body: I am passing some data from an activity to other activity. I have 2 solutions as below: Use Bundle Bundle args = new Bundle(); args.put ("key1", serializable_object1); args.put ("key2", serializable_object2); args.put ("key3", serializable_object3); Intent intent = new Intent(this, MyActivity.class); intent.putExtra ( "args", args ); Use Java plain object public class FragModel implements Serializable { public Serializable key1; public Serializable key2; public Serializable key3; } Intent intent = new Intent(this, MyActivity.class); FragModel model = new FragModel(); model.key1 = serializable_object1; model.key2 = serializable_object2; model.key3 = serializable_object3; // .... intent.putExtra ( "args", model ); My question is which solution is better for performance? better for serialization/de-serialization? Anyone has any ideas? Thanks!
has title: Android Bundle vs Java plain object (POJO) - serialization/de-serialization performance
has answer: http://stackoverflow.com/a/25064275

http://stackoverflow.com/comment/38962796
type: QuestionComment
score: 0
has text: how do you like my answer?
comment on: http://stackoverflow.com/q/25048620
type: Comment

http://stackoverflow.com/q/24948817
has comment: http://stackoverflow.com/comment/38774761
answer count: 2
possible better answer: http://stackoverflow.com/a/24948901
has title: Unable to populate ListView with ArrayList
has answer: http://stackoverflow.com/a/24948901
downvote count: 0
has answer: http://stackoverflow.com/a/24948985
has comment: http://stackoverflow.com/comment/38774723
favorite count: 0
has body: I'm trying to make an audio recorder for which I want to display a list of recordings done till now. I'm able to get the list recorded files from my SD card in to an ArrayList, but my app crashes when it tries to populate the list view. ListRecordings.java is called using an Intent from MainActivity.java. Here is the for ListRecordings.java: public class ListRecordings extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { setContentView(R.layout.listrecordings); ListView lv; String path = Environment.getExternalStorageDirectory() .getAbsolutePath() + "/MyAudioRecorder"; ArrayList<String> FilesInFolder = GetFiles(path); lv = (ListView) findViewById(R.id.filelist); ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, R.layout.textlayout, FilesInFolder); lv.setAdapter(adapter); lv.setOnItemClickListener(new AdapterView.OnItemClickListener() { public void onItemClick(AdapterView<?> parent, View v, int position, long id) { // Clicking on items } }); } public ArrayList<String> GetFiles(String DirectoryPath) { ArrayList<String> MyFiles = new ArrayList<String>(); File f = new File(DirectoryPath); f.mkdirs(); File[] files = f.listFiles(); if (files.length == 0) return null; else { for (int i = 0; i < files.length; i++) MyFiles.add(files[i].getName()); } return MyFiles; } } Here's the code for listrecordings.xml <?xml version="1.0" encoding="utf-8"?> Here's the code for textlayout.xml <?xml version="1.0" encoding="utf-8"?> Any help is appreciated. I've just started with android so excuse me if i made any lame mistakes. Thanks
tagged with: arraylist
has comment: http://stackoverflow.com/comment/38774820
tagged with: android-listview
has comment: http://stackoverflow.com/comment/38774887
accepted answer: http://stackoverflow.com/a/24948985
tagged with: android
has comment: http://stackoverflow.com/comment/38774852
type: AnsweredQuestion
upvote count: 1
has comment: http://stackoverflow.com/comment/38774769
type: Question
score: 1
has comment: http://stackoverflow.com/comment/38774998
tagged with: java
has comment: http://stackoverflow.com/comment/38774801

http://stackoverflow.com/a/24998758
has comment: http://stackoverflow.com/comment/38883883
has comment: http://stackoverflow.com/comment/38884239
has comment: http://stackoverflow.com/comment/38884464
downvote count: 0
has body: I problem I see is that you are referencing the first table in the Action ClearFuncs. You could easily convert to a generic Action the will be used for all tables. Also same with the MouseAdapter. It couls easily be reconfigured to be used for all the tables, so to avoid repetition. See the example below where I do this. Leave a comment if you have any questions. import java.awt.Color; import java.awt.Dimension; import java.awt.FlowLayout; import java.awt.Point; import java.awt.event.ActionEvent; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.util.Random; import javax.swing.AbstractAction; import javax.swing.Action; import javax.swing.BorderFactory; import javax.swing.JFrame; import javax.swing.JPopupMenu; import javax.swing.JScrollPane; import javax.swing.JTable; import javax.swing.SwingUtilities; import javax.swing.table.DefaultTableModel; public class TableContextMenuDemo { @SuppressWarnings("serial") private JTable createTableWithRandomData(int tableNumber) { String[] cols = { "col 1", "col 2", "col 3" }; JTable table = new JTable(new DefaultTableModel(getRandomData(10, cols.length), cols)) { @Override public Dimension getPreferredScrollableViewportSize() { return new Dimension(200, 150); } }; ClearFuncs action1 = new ClearFuncs(tableNumber, table); SayHelloAction action2 = new SayHelloAction(); JPopupMenu popupMenu = createPopupMenu(action1, action2); PopupAdapter listener = new PopupAdapter(popupMenu); table.addMouseListener(listener); return table; } class SayHelloAction extends AbstractAction { public SayHelloAction() { putValue(NAME, "Hello"); } @Override public void actionPerformed(ActionEvent e) { System.out.println("Hello World"); } } private Integer[][] getRandomData(int rows, int cols) { Random random = new Random(); Integer[][] data = new Integer[rows][cols]; for (int i = 0; i &lt; data.length; i++) { for (int j = 0; j &lt; data[i].length; j++) { data[i][j] = random.nextInt(Integer.MAX_VALUE); } } return data; } priv…
accepted answer of: http://stackoverflow.com/q/24995971
answers question: http://stackoverflow.com/q/24995971
has comment: http://stackoverflow.com/comment/38884056
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38884100
has comment: http://stackoverflow.com/comment/38884303
type: Answer
has comment: http://stackoverflow.com/comment/38884518
score: 3
has comment: http://stackoverflow.com/comment/38883908
upvote count: 3

http://stackoverflow.com/q/24930161
has comment: http://stackoverflow.com/comment/38739488
tagged with: android
answer count: 1
has comment: http://stackoverflow.com/comment/38739059
has comment: http://stackoverflow.com/comment/38738996
has answer: http://stackoverflow.com/a/24930532
favorite count: 0
has title: nullpointerexception using setadapter with custom class
score: -4
has comment: http://stackoverflow.com/comment/38739228
has body: I'm trying to display an imageview - textview combination, but I keep getting errors when trying to actually display the data. I'm trying to get input from the user to search for something - and then run some background methods to pull data. Then I would have 2 arrays full of data, then I make the "Item" object and pass that in to my Custom Adapter class. I'm trying to utilize square picasso to load up some images from a URL. I think that could be the problem, but the error says its from setadapter. Sorry about posting so much code! This is my MainActivity.java public class MainActivity extends ActionBarActivity { String url = "https://www.google.com/search?hl=en&amp;tbm=shop&amp;q="; ProgressDialog mProgressDialog; float x1,x2; float y1, y2; ImageButton button; int buttonPressed = 0; private ListView listView1; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); button = (ImageButton) findViewById(R.id.search_button); button.setOnClickListener(new OnClickListener() { public void onClick(View arg0) { new Search().execute(); } }); } private class Search extends AsyncTask&lt;Void, Void, Void&gt; { String title = "blah"; String prices[] = new String[10]; String description[] = new String[10]; String stores[] = new String[10]; String full[] = new String[10]; // change this 40 String linksContainer[] = new String[10]; String imgContainer[] = new String[10]; @Override protected void onPreExecute() { super.onPreExecute(); mProgressDialog = new ProgressDialog(MainActivity.this); mProgressDialog.setTitle("Salert"); mProgressDialog.setMessage("Searching..."); mProgressDialog.setIndeterminate(false); mProgressDialog.show(); } @Override protected Void doInBackground(Void... params) { try { EditText edit = (EditText) findViewById(R.id.search_field); String search = edit.getText().toString().replaceAll("\\s","\\+"); // Connect to the web site Document document = Jsoup.connect(url+search).get();…
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/24930532
has comment: http://stackoverflow.com/comment/38738950
type: Question
downvote count: 4
upvote count: 0
has comment: http://stackoverflow.com/comment/38739174
has comment: http://stackoverflow.com/comment/38739728
tagged with: nullpointerexception

http://stackoverflow.com/q/24994015
tagged with: ssh
has comment: http://stackoverflow.com/comment/38859027
answer count: 0
tagged with: java
tagged with: mysql
type: Question
has title: ssh tunneling using java JSch - Kerberos username [my-station-user-name]
score: 0
has body: i have a mysql database on my server, and i want to access it from a java application on other stations, i succeed to access it through mysql workbench, but when i try to connect through java, using the following code, i dont get access to the database and the console shows: [Ljava.lang.String;@466cb33cKerberos username [my-station-user-name]: and the code (i found it online): public void connect() { // int assigned_port = 0; final int local_port=3306; // Remote host and port final int remote_port=3306; final String remote_host="server's-ip"; try { JSch jsch = new JSch(); // Create SSH session. Port 22 is your SSH port which // is open in your firewall setup. Session session = jsch.getSession("server's username", remote_host, 22); session.setPassword("server's password"); // Additional SSH options. See your ssh_config manual for // more options. Set options according to your requirements. java.util.Properties config = new java.util.Properties(); config.put("StrictHostKeyChecking", "no"); config.put("Compression", "yes"); config.put("ConnectionAttempts","2"); session.setConfig(config); // Connect session.connect(); // Create the tunnel through port forwarding. // This is basically instructing jsch session to send // data received from local_port in the local machine to // remote_port of the remote_host // assigned_port is the port assigned by jsch for use, // it may not always be the same as // local_port. assigned_port = session.setPortForwardingL(local_port, remote_host, remote_port); } catch (JSchException e) { // LOGGER.log(Level.SEVERE, e.getMessage()); return; } if (assigned_port == 0) { //.log(Level.SEVERE, "Port forwarding failed !"); return; } // Database access credintials. Make sure this user has // "connect" access to this database; // these may be initialized somewhere else in your code. final String database_user="db-user"; final String database_password="db-password"; final String database = "db-name"; // Build the database connection URL. StringBuilde…
has comment: http://stackoverflow.com/comment/38888567
type: UnansweredQuestion

http://stackoverflow.com/comment/38859594
has text: For this post, I had to anonymize it. I am certain that the full class name is correct in the persistance.xml file. My service class is in a seperate package than the entities. it is like de.hol.hct.persistable.entities.* and de.hol.hct.persistable.services.* where the services are the classes with the crud details.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24994216

http://stackoverflow.com/comment/38880886
type: Comment
comment on: http://stackoverflow.com/q/25001292
score: 0
has text: I don't, I think that converting it to a `byte[]` and then marshaling that is going to be slower than just throwing the string into a `StringWriter` and marshaling that way. What I was hoping to discover is if it is going to be significantly slower. i.e. worth the hassle of checking out a class, writing the method, and checking it back in, then reimporting the jar into my existing grails project, and fighting with that. (The last part is what really fills me with trepidation since it only goes smoothely about 1/4 of the time, and is a 2 hour ordeal every other time.)
type: QuestionComment

http://stackoverflow.com/q/24945415
accepted answer: http://stackoverflow.com/a/24947073
score: 0
tagged with: eclipselink
has answer: http://stackoverflow.com/a/24947073
has title: @OneToOne removing a child
answer count: 1
tagged with: jpa
linked to: http://stackoverflow.com/q/9944137
has comment: http://stackoverflow.com/comment/38770934
has comment: http://stackoverflow.com/comment/38771043
type: AnsweredQuestion
tagged with: java
type: Question
has body: I have a Parent class pointing to a Child class: public class Parent { @OneToOne private Child child; } public class Child { } Is there a way to delete a Child without getting a constraint Exception ? Caused by: com.mysql.jdbc.exceptions.MySQLIntegrityConstraintViolationException: Cannot delete or update a parent row: a foreign key constraint fails P.S: I'm not entirely sure I've modeled this properly. A Parent can be pointing to one Child but an instance of a Child can be pointed to by more than one Parent. What I'd like to do is to delete a Child and have it's references among all Parents removed. Hope you understand.

arrays
tags question: http://stackoverflow.com/q/24936662
tags question: http://stackoverflow.com/q/24929448
tags question: http://stackoverflow.com/q/25045561
tags question: http://stackoverflow.com/q/25062451
tags question: http://stackoverflow.com/q/25015887
type: Tag
tags question: http://stackoverflow.com/q/25047821
tags question: http://stackoverflow.com/q/24920665
tags question: http://stackoverflow.com/q/24962521
tags question: http://stackoverflow.com/q/24930168
tags question: http://stackoverflow.com/q/25040459
tags question: http://stackoverflow.com/q/24984158
tags question: http://stackoverflow.com/q/24944744
tags question: http://stackoverflow.com/q/24978230
tags question: http://stackoverflow.com/q/25028868
tags question: http://stackoverflow.com/q/25058934
tags question: http://stackoverflow.com/q/24964454
tags question: http://stackoverflow.com/q/25050786
tags question: http://stackoverflow.com/q/24971566
tags question: http://stackoverflow.com/q/24961973
tags question: http://stackoverflow.com/q/25049508
tags question: http://stackoverflow.com/q/25004320
tags question: http://stackoverflow.com/q/24988232
tags question: http://stackoverflow.com/q/24992863
tags question: http://stackoverflow.com/q/24916818
tags question: http://stackoverflow.com/q/24922856
tags question: http://stackoverflow.com/q/24995141
tags question: http://stackoverflow.com/q/24956971
tags question: http://stackoverflow.com/q/24974458
tags question: http://stackoverflow.com/q/24942503
tags question: http://stackoverflow.com/q/24960513
tags question: http://stackoverflow.com/q/25023506
tags question: http://stackoverflow.com/q/25012033
tags question: http://stackoverflow.com/q/25051585
tags question: http://stackoverflow.com/q/24924321
tags question: http://stackoverflow.com/q/24973673
tags question: http://stackoverflow.com/q/24973572
tags question: http://stackoverflow.com/q/24961814
tags question: http://stackoverflow.com/q/24959766
tags question: http://stackoverflow.com/q/25042177
tags question: http://stackoverflow.com/q/25020536
tags question: http://stackoverflow.com/q/25008119
tags question: http://stackoverflow.com/q/25005481
tags question: http://stackoverflow.com/q/25001677
tags question: http://stackoverflow.com/q/24983983
tags question: http://stackoverflow.com/q/24994974
tags question: http://stackoverflow.com/q/25067294
tags question: http://stackoverflow.com/q/25037550
tags question: http://stackoverflow.com/q/24944454
tags question: http://stackoverflow.com/q/24955314
tags question: http://stackoverflow.com/q/25009966
tags question: http://stackoverflow.com/q/24977783
tags question: http://stackoverflow.com/q/24955679
tags question: http://stackoverflow.com/q/24971498
tags question: http://stackoverflow.com/q/24913525
tags question: http://stackoverflow.com/q/24940722
tags question: http://stackoverflow.com/q/24953880
tags question: http://stackoverflow.com/q/24943302
tags question: http://stackoverflow.com/q/24933319
tags question: http://stackoverflow.com/q/25014047
tags question: http://stackoverflow.com/q/25044726
tags question: http://stackoverflow.com/q/25038143
tags question: http://stackoverflow.com/q/24936778
tags question: http://stackoverflow.com/q/25059301
tags question: http://stackoverflow.com/q/25067494
tags question: http://stackoverflow.com/q/25062898
tag name: arrays
tags question: http://stackoverflow.com/q/24966519
tags question: http://stackoverflow.com/q/25008451
tags question: http://stackoverflow.com/q/24984787
tags question: http://stackoverflow.com/q/24957391
tags question: http://stackoverflow.com/q/25028612
tags question: http://stackoverflow.com/q/25011735
tags question: http://stackoverflow.com/q/24944678
tags question: http://stackoverflow.com/q/24997882
tags question: http://stackoverflow.com/q/24913612
tags question: http://stackoverflow.com/q/25024500
tags question: http://stackoverflow.com/q/24924937
tags question: http://stackoverflow.com/q/24925370
tags question: http://stackoverflow.com/q/25066237

http://stackoverflow.com/a/24947529
downvote count: 0
has body: Have you installed Google Play Services using sdk manager?
type: Answer
has comment: http://stackoverflow.com/comment/38772248
upvote count: 1
answers question: http://stackoverflow.com/q/24947483
score: 1

http://stackoverflow.com/comment/38819156
comment on: http://stackoverflow.com/a/24972274
type: Comment
score: 0
type: AnswerComment
has text: Ohh you are using Eclipse... Eclipse creates it's tomcat config file under servers. Add if you see you build path WEB-INF/lib would not be under that. All you have to do is add your jar in the build path. Right click the project select `properties -> JAVA BUILD PATH -> Add External JAR-> select your jar -> Ok`.

http://stackoverflow.com/comment/38756229
score: 0
type: Comment
type: QuestionComment
has text: This is default behavior, so you can't change it. Serializing the specified form elements might help.
comment on: http://stackoverflow.com/q/24939241

http://stackoverflow.com/q/24985190
accepted answer: http://stackoverflow.com/a/24985460
tagged with: loops
has comment: http://stackoverflow.com/comment/38842614
type: AnsweredQuestion
tagged with: java
has title: How can I pause a loop until I get a users input?
type: Question
score: 0
answer count: 1
has body: I am a beginner at Java and I am making a fun project for myself to learn more about java, I plan on randomizing videos from a preset list and displaying it to the user. I am having trouble stopping the loop. Once you type in the kind of video you want to watch the program automatically re-loops, but i want it to ask you if you want to watch another video before relooping. Here is what I have so far: import java.util.Scanner; import java.util.Random; public class YoutubeGenerator { public static void main(String[] args) { int randomstring = 0; for ( ; ; ) { System.out.println("\n ---------Youtube Video Generator 0.001 BETA------------------ \n"); System.out.println("\n ********* DISCLAIMER: WARNING - This program may direct you to violent, disturbing content, and/or vulgar language and is intended for a MATURE person only. ********* \n \n"); Scanner scan = new Scanner (System.in); System.out.println("What kind of video from the list would you like to watch? \n"); System.out.println("Cute \n" + "Funny \n" + "WTF \n" + "Interesting \n" + "Documentary \n"); System.out.print("I want to watch: "); String userString = scan.next(); Random rand = new Random(); if(userString.equalsIgnoreCase("cute")){ String cute1 = "https://www.youtube.com/watch?v=EdCVijVT7Wk"; String cute2 = "http://youtu.be/-XCvPptsfhI?t=7s"; String cute3 = "https://www.youtube.com/watch?v=-nkEPsSsH68"; String cute4= "https://www.youtube.com/watch?v=FZ-bJFVJ2P0"; String cute5 = "https://www.youtube.com/watch?v=argCvDpk_KQ"; System.out.println("Here's a cute video you can watch: " +cute5) ; } if(userString.equalsIgnoreCase("funny")){ System.out.println("Here's a funny you can watch:"); String funny1 = "https://www.youtube.com/watch?v=I59MgGlh2Mg"; String funny2 = "http://www.youtube.com/watch?v=HKMNKS-9ugY"; String funny3 = "https://www.youtube.com/watch?v=_qKmWfED8mA"; String funny4= "https://www.youtube.com/watch?v=QDFQYKPsVOQ"; String funny5 = "https://www.youtube.com/watch?v=ebv51QNm2Bk"; } if(userStri…
has answer: http://stackoverflow.com/a/24985460
has comment: http://stackoverflow.com/comment/38842503
has comment: http://stackoverflow.com/comment/38842683

http://stackoverflow.com/q/25041625
has answer: http://stackoverflow.com/a/25042078
has title: findViewById throws null when called through an object
answer count: 1
tagged with: android
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25042078
has body: I have a function in main.java that uses some UI elements like spinner to textview. public void updateNearByPeople() { reportEventPeopleAroundSpinner = (Spinner) findViewById(R.id.peopleAround); … } When I call this function from within class, it works fine. But when I call this function from another class2.java through an object findViewById throws java.lang.NullPointerException If I make the function and all variables in it static than it also works fine while calling from class2.java but it doesn’t work with object calls. How can I solve this and made of object aware of the context? In main.java: protected void onCreate(final Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main_view); mainAppContext = this; Main mainObj=new Main(); gMapObj.initiateMap(mainAppContext,mainObj, mapFrag); } In class2.java: public boolean initiateMap(Context appContext, Main mainObj, MapFragment mapFrag) { mainAppContext = appContext; mainAppObject = mainObj; … mainAppObject.updateNearByPeople(); }
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/38949296
score: 0

http://stackoverflow.com/comment/38825765
comment on: http://stackoverflow.com/q/24976138
type: Comment
type: QuestionComment
has text: I am not selecting logcat(depreciated). When i click on LogCat, nothing happens.
score: 0

http://stackoverflow.com/comment/38844794
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24986042
has text: `toString()` should return a textual representation of the object. That is mostly a combination of the properties. You can return the returns of getHealth() etc. if you like to do.

java-6
tags question: http://stackoverflow.com/q/25057752
type: Tag
tags question: http://stackoverflow.com/q/24935480
tag name: java-6

http://stackoverflow.com/q/25055951
tagged with: scala-collections
has body: When manipulating scala objects (primarily from the the scala.collection package) the operator overloaded functions seem to be available to be used in Java. i.e. in scala var s = Set(1, 2, 3) var t = s + 4 var x = s | t so in Java, looking at scala.collection.Set in eclipse autocomplete, I can see the prototypes But I'm unable to use them correctly import scala.collection.Set; Set&lt;Integer&gt; s = new Set&lt;Integer&gt;(); Set&lt;Integer&gt; t = s.$plus(4); /* compile error with javac, or runtime error with eclipse/* How are these scala methods meant to be used from within Java?
tagged with: scala-java-interop
tagged with: java
tagged with: eclipse
answer count: 1
has comment: http://stackoverflow.com/comment/38975913
has answer: http://stackoverflow.com/a/25057410
upvote count: 5
type: AnsweredQuestion
downvote count: 0
accepted answer: http://stackoverflow.com/a/25057410
favorite count: 0
type: Question
tagged with: scala
score: 5
has title: scala operators as methods in java

http://stackoverflow.com/comment/38953712
type: Comment
score: 0
type: AnswerComment
has text: I have been using ImageJ but the volumeJ and volume viewer all require stacks. They don't compute a 3D with a single slice. Do you know of any plugin that do?
comment on: http://stackoverflow.com/a/25043782

http://stackoverflow.com/a/24979182
has comment: http://stackoverflow.com/comment/79408839
has comment: http://stackoverflow.com/comment/80013035
answers question: http://stackoverflow.com/q/24975813
type: AcceptedAnswer
downvote count: 0
has body: You cannot use the java.util.Optional as a persisted entity attribute since Optional is not Serializable. However, assuming that you are using field-based access, you can use the Optional container in your getter/setter methods. Hibernate can then take the actual type from the entity attribute, while the getter and setter can use Optional: private String name; public Optional&lt;String&gt; getName() { return Optional.ofNullable(name); }
accepted answer of: http://stackoverflow.com/q/24975813
type: Answer
score: 41
upvote count: 41

http://stackoverflow.com/q/24925915
type: AnsweredQuestion
tagged with: java
linked to: http://stackoverflow.com/q/1906445
tagged with: eclipse
type: Question
upvote count: 4
has comment: http://stackoverflow.com/comment/38731186
has comment: http://stackoverflow.com/comment/38731056
has title: Project cannot be built until build path errors are resolved eclipse
downvote count: 0
accepted answer: http://stackoverflow.com/a/24926371
score: 4
has comment: http://stackoverflow.com/comment/38731026
has body: I am trying to build a Java project. This used to be a breeze for me but ever since I changed my workspace to another location to store my new projects, I've been running into trouble. I get these two errors. Description Resource Path Location Type The project cannot be built until build path errors are resolved InterviewPractice Unknown Java Problem Unbound classpath container: 'JRE System Library [JavaSE-1.7]' in project 'InterviewPractice' InterviewPractice Build path Build Path Problem I've looked up fixes online but none of them seem to be working for me. While building the project, selecting the JRE selection. I'm also not sure what to choose. I think default it was set to OSGi/minimum 1.0 but I'm honestly not sure what that does. I simply want to build simple programs for interview practice. So JavaSE-1.7? when I click JRE system library a popup that says An error has occurred. See error log for more details. java.lang.NullPointerException
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/24926371

http://stackoverflow.com/comment/38749306
score: 0
type: AnswerComment
type: Comment
has text: In this case instead of a for loop you could use contains method of arraylist itself. `if(!contains(object)) result = super.add(object);`
comment on: http://stackoverflow.com/a/24935681

http://stackoverflow.com/q/25040445
has comment: http://stackoverflow.com/comment/38992365
score: 30
favorite count: 0
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/44667370
has answer: http://stackoverflow.com/a/44667370
tagged with: java
has answer: http://stackoverflow.com/a/25041082
tagged with: gradle
has body: I'm currently trying to include Project Lombok helper into my Gradle project, but while following their instructions for Gradle within my build.gradle, I'm getting the following error: Error:(11, 0) Build script error, unsupported Gradle DSL method found: 'provided()'! Possible causes could be: you are using Gradle version where the method is absent you didn't apply Gradle plugin which provides the method or there is a mistake in a build script My current build.gradle file: apply plugin: 'java' sourceCompatibility = 1.5 version = '1.0' repositories { mavenCentral() } dependencies { provided "org.projectlombok:lombok:1.14.4" testCompile group: 'junit', name: 'junit', version: '4.11' }
type: Question
tagged with: lombok
has title: Which is the proper Gradle plugin to support 'provided' method?
downvote count: 0
has comment: http://stackoverflow.com/comment/38949235
upvote count: 30
answer count: 2
accepted answer: http://stackoverflow.com/a/25041082
tagged with: build.gradle

http://stackoverflow.com/comment/39084298
type: QuestionComment
has text: is it possible to generate an xslt on the fly given the xmldocument as input. That's my goal.
score: 0
comment on: http://stackoverflow.com/q/25061459
type: Comment

http://stackoverflow.com/comment/38959901
has text: This is what I also believe. This is the Java I run on my PC: `chris@mint-desktop ~ $ java -version java version "1.7.0_55" OpenJDK Runtime Environment (IcedTea 2.4.7) (7u55-2.4.7-1ubuntu1~0.12.10.1)`
score: 0
comment on: http://stackoverflow.com/a/25047222
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/38748389
type: Comment
comment on: http://stackoverflow.com/a/24920279
has text: @user3804236 - The offset to write from should be in the `offset` field of the `WriteBlock`. The downloading thread should fill that in for the write thread.
score: 0
type: AnswerComment

http://stackoverflow.com/q/25029007
type: Question
has body: I am using the below code to read a data from a file: BufferedReader br=null; try { String str; //C:\Sterling1\Test\OrderStatus File ff=new File("H:/infilename.txt"); boolean b=ff.exists(); System.out.println(b); br =new BufferedReader(new FileReader (ff)); str=br.readLine(); System.out.println(str); // etc. I am getting false when I try to validate the existence of file. I have double-checked that the file is present, though. This is the output (and error) I get when I run my program: false java.io.FileNotFoundException: H:\infilename.txt (The system cannot find the file specified) at java.io.FileInputStream.open(Native Method) at java.io.FileInputStream.&lt;init&gt;(Unknown Source) at java.io.FileReader.&lt;init&gt;(Unknown Source) at yiut.impl.tgt.MyFileReader.main(MyFileReader.java:25) Please help me on this.
tagged with: java
has answer: http://stackoverflow.com/a/25029205
has comment: http://stackoverflow.com/comment/38925178
answer count: 1
has comment: http://stackoverflow.com/comment/38925472
tagged with: bufferedreader
has comment: http://stackoverflow.com/comment/38925203
score: -6
favorite count: 0
has comment: http://stackoverflow.com/comment/38925159
has title: Unable to read a file
tagged with: file-io
downvote count: 8
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38925488
has comment: http://stackoverflow.com/comment/38925229
has comment: http://stackoverflow.com/comment/38925403
upvote count: 2

http://stackoverflow.com/comment/38928988
type: AnswerComment
score: 0
type: Comment
has text: Also, thanks, that has solved all my problems, now I just got to fix up my HTML and make it stylish :P
comment on: http://stackoverflow.com/a/25031048

http://stackoverflow.com/q/25060742
answer count: 2
favorite count: 0
possible better answer: http://stackoverflow.com/a/25060964
accepted answer: http://stackoverflow.com/a/25060826
has body: where is the initial index of the pointer to the list should it not be the first item of the list. does the next method (1)returns the next element of the and points to the next element or (2) return original element and sets the pointer to the next element. but if (1) is true then the pointer is on the first element then the first element cannot be returned i.e if (1) is true the pointer should be before the first element i.e in some kind of -1 position. on the other hand if (2) is true then we can remove the first element but we cannot get the next element by usingthe next because we will reduce the index by 1; which brings me to the next question does remove() method reduce the index by one or keeps it same?? The contextual code is given below:: package iterators; import java.util.ArrayList; import java.util.Iterator; public class Array_practice { public static void main(String args[]) { ArrayList&lt;Integer&gt; list= new ArrayList&lt;Integer&gt;(); list.add(1); list.add(2); list.add(3); Iterator&lt;Integer&gt; iterator= list.iterator(); iterator.remove();//does not work why?? } }
has comment: http://stackoverflow.com/comment/38985515
upvote count: 3
has title: Confusion regarding the initial position of the pointer in a list iterated by the Iterator interface
has answer: http://stackoverflow.com/a/25060826
downvote count: 1
has answer: http://stackoverflow.com/a/25060964
score: 2
type: AnsweredQuestion
tagged with: java
type: Question

http://stackoverflow.com/a/25032967
has body: I've find the reason. TaskTrackers can't run job task (map) because jar file is not in Distributed Cash. To solve the problem it's necessary to add jar file to project classpath. Steps are: File -&gt; Project Structure -&gt; Libraries, type '+' at the bottom pane and add jar file
accepted answer of: http://stackoverflow.com/q/25018356
score: 0
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/25018356

http://stackoverflow.com/a/25050947
answers question: http://stackoverflow.com/q/25010502
type: Answer
score: 1
upvote count: 1
has body: Actually I didn't find the solution for this. As said by many it does not seem to be possible. Though I have found a work around this. I removed the class type and kept only String and Boolean type variable there, and to get the annotated classes I took the path from the user to the package containing classes with the defined annotation. And then for each class in the package I checked for the annotation. If annotation was present I did what I wanted to, else did nothing. Thanks to everyone for giving your time to this.
accepted answer of: http://stackoverflow.com/q/25010502
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/24986054
type: Answer
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/38854412
has body: The SocketChannel is closed. You closed it, in your code, and then continued to use it. Or possibly you overlooked a ConnectException.
downvote count: 0
answers question: http://stackoverflow.com/q/24984871

http://stackoverflow.com/q/25018488
has comment: http://stackoverflow.com/comment/38906498
has comment: http://stackoverflow.com/comment/38907794
has comment: http://stackoverflow.com/comment/38906960
has comment: http://stackoverflow.com/comment/38908174
has comment: http://stackoverflow.com/comment/38907111
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/38905761
tagged with: java
has comment: http://stackoverflow.com/comment/38905511
has comment: http://stackoverflow.com/comment/38920477
type: Question
has body: I am having some problem when trying to load data from SQLite into tableLayout. DataBaseAdapter.java protected static final String TAG = "DatabaseAdapter"; private final Context mContext; private SQLiteDatabase mDb; private DataBaseHelper mDbHelper; public DatabaseAdapter(Context context) { this.mContext = context; mDbHelper = new DataBaseHelper(mContext); } public DatabaseAdapter createDatabase() throws SQLException { try { mDbHelper.createDataBase(); Log.e(TAG, "Database Created"); } catch (IOException mIOException) { Log.e(TAG, mIOException.toString() + " UnableToCreateDatabase"); throw new Error("UnableToCreateDatabase"); } return this; } public SQLiteDatabase open() throws SQLException { try { mDbHelper.openDataBase(); mDbHelper.close(); mDb = mDbHelper.getReadableDatabase(); Log.e(TAG, "Database Open"); } catch (SQLException mSQLException) { Log.e(TAG, "open &gt;&gt;" + mSQLException.toString()); throw mSQLException; } return mDb; } public void close() { mDbHelper.close(); } DataBaseHelper.java private static String TAG = "DataBaseHelper"; // Tag just for the LogCat // window // destination path (location) of our database on device private static String DB_PATH = ""; private static String DB_NAME = "schoolAssignment";// Database name private SQLiteDatabase mDataBase; private final Context mContext; public DataBaseHelper(Context context) { super(context, DB_NAME, null, 1);// 1? its Database Version DB_PATH = "/data/data/" + context.getPackageName() + "/databases/"; this.mContext = context; } public void createDataBase() throws IOException { // If database not exists copy it from the assets Log.e(TAG, "CreateDataBase()"); boolean mDataBaseExist = checkDataBase(); if (!mDataBaseExist) { this.getReadableDatabase(); this.close(); try { // Copy the database from assests copyDataBase(); Log.e(TAG, "createDatabase database created"); } catch (IOException mIOException) { throw new Error("ErrorCopyingDataBase"); } } } // Check that the database exists here: /data/data/y…
has comment: http://stackoverflow.com/comment/38908319
upvote count: 1
tagged with: sqlite
answer count: 1
has comment: http://stackoverflow.com/comment/38906714
has comment: http://stackoverflow.com/comment/38907691
has title: Android RunTimeException can't instantiate class
favorite count: 0
has comment: http://stackoverflow.com/comment/38906847
has comment: http://stackoverflow.com/comment/38905404
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25020233
tagged with: android
has comment: http://stackoverflow.com/comment/38906412

http://stackoverflow.com/q/25055715
downvote count: 0
favorite count: 0
has body: I want to read xml file and I use jxl. But I get error jxl.read.biff.BiffException: Unable to recognize OLE stream. When I search the internet , Everbody say that You should save as Excel 97-2003 Workbook.But My excel file is Excel 97-2003 .How can I solve this ? import java.io.File; import java.io.IOException; import jxl.Cell; import jxl.CellType; import jxl.Sheet; import jxl.Workbook; import jxl.read.biff.BiffException; public class deneme { private String inputFile; public void setInputFile(String inputFile) { this.inputFile = inputFile; } public void read() throws IOException { File inputWorkbook = new File(inputFile); Workbook w; try { w = Workbook.getWorkbook(inputWorkbook); // Get the first sheet Sheet sheet = w.getSheet(0); // Loop over first 10 column and lines for (int j = 0; j &lt; sheet.getColumns(); j++) { for (int i = 0; i &lt; sheet.getRows(); i++) { Cell cell = sheet.getCell(j, i); CellType type = cell.getType(); if (type == CellType.LABEL) { System.out.println("I got a label " + cell.getContents()); } if (type == CellType.NUMBER) { System.out.println("I got a number " + cell.getContents()); } } } } catch (BiffException e) { e.printStackTrace(); } } public static void main(String[] args) throws IOException { deneme test = new deneme(); test.setInputFile("c:/data.xls"); test.read(); } }
has title: Unable to recognize OLE stream
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/41505582
upvote count: 3
tagged with: java
type: Question
score: 3
tagged with: jxl
has answer: http://stackoverflow.com/a/28464673
answer count: 2

http://stackoverflow.com/comment/38770096
comment on: http://stackoverflow.com/a/24946401
has text: thanks. but the thing is it need to use the existing path which already stored in the string. what should i do?
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/25067494
has comment: http://stackoverflow.com/comment/38997841
type: Question
has answer: http://stackoverflow.com/a/25067650
tagged with: arrays
score: 0
has body: I have an array of contacts like so : public class Application { private Scanner input; private Contact[] contacts; private int ArrayNum; public Application() { input = new Scanner(System.in); contacts = new Contact[5]; ArrayNum = 0; } And what I want to do is enter a name of someone on the contacts list and if they are found on their list return their index like so: System.out.println("Who do you want to remove?"); String name = input.nextLine(); for(Contact c: contacts){ if(c.getName().equals(name)){ //Get the index here } } I tried researching this but no answer or guide seems to be very clear on this so I'm hoping that someone can explain this for me. Thank you for looking
accepted answer: http://stackoverflow.com/a/25067550
has answer: http://stackoverflow.com/a/25067753
has title: Java - How to get the index of a given element in an array
answer count: 5
has answer: http://stackoverflow.com/a/25067550
has comment: http://stackoverflow.com/comment/38997944
possible better answer: http://stackoverflow.com/a/25067536
has comment: http://stackoverflow.com/comment/38997791
tagged with: indexing
has answer: http://stackoverflow.com/a/25067540
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25067536
tagged with: java

http://stackoverflow.com/comment/38915205
has text: well put the properties file in a different folder and add that in addition to your existing entries. Don't use a star in the new folder path.
comment on: http://stackoverflow.com/a/25023216
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/38726082
type: Comment
has text: Is there a .stringat function? However else I rewrite this declaration gives me the same error as before.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24922880

http://stackoverflow.com/comment/38845091
comment on: http://stackoverflow.com/q/24986396
has text: You constructor has no body. You take variables in the signature but don't use them in the body at all - those variables are just discarded. You need to add, for example, `this.level = level` for each variable.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25040801
has comment: http://stackoverflow.com/comment/38948570
type: Answer
score: 1
answers question: http://stackoverflow.com/q/25040609
upvote count: 1
has comment: http://stackoverflow.com/comment/38948422
downvote count: 0
has body: If I understand your objective, the easiest approach I can think of is using two SimpleDateFormat instances. One for your input format, one for your output format. That is, something like - String str = "8/11/1965"; DateFormat in = new SimpleDateFormat("dd/MM/yyyy"); DateFormat out = new SimpleDateFormat("EEEE, MMMM dd yyyy"); System.out.println(out.format(in.parse(str))); Output is (because November 8, 1965 is a Monday not a Wednesday) - Monday, November 08 1965 $ cal 11 1965 November 1965 Su Mo Tu We Th Fr Sa 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30

http://stackoverflow.com/q/25005882
favorite count: 0
has body: I want to show a message right after the plugin starts. If I put my code at the end of the Activator.start() method I get an error (probably because the needed resources are not loaded yet). The errors look like this: !MESSAGE While loading class "de.stefansurkamp.package.ClassIWantToLoad", thread "Thread[main,6,main]" timed out waiting (5006ms) for thread "Thread[Worker-2,5,main]" to finish starting bundle "MyPlugin_1.0.0.qualifier [302]". To avoid deadlock, thread "Thread[main,6,main]" is proceeding but "de.stefansurkamp.package.ClassIWantToLoad" may not be fully initialized. !STACK 0 org.osgi.framework.BundleException: State change in progress for bundle "reference:file:/C:/Users/Stefan/workspace/MyPlugin/" by thread "Worker-2". at org.eclipse.osgi.framework.internal.core.AbstractBundle.beginStateChange(AbstractBundle.java:1088) at org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:298) at org.eclipse.osgi.framework.util.SecureAction.start(SecureAction.java:478) at org.eclipse.osgi.internal.loader.BundleLoader.setLazyTrigger(BundleLoader.java:263) at org.eclipse.core.runtime.internal.adaptor.EclipseLazyStarter.postFindLocalClass(EclipseLazyStarter.java:109) [...] Caused by: org.eclipse.osgi.framework.internal.core.AbstractBundle$BundleStatusException ... 53 more Root exception: org.eclipse.osgi.framework.internal.core.AbstractBundle$BundleStatusException [...] If needed, I can provide a full stack trace. So is there any method that runs right after start() is finished? EDIT: Using a job and org.eclipse.ui.startup According to greg's recommendations I created a Job inside a class which is loaded by the org.eclipse.ui.startup extension point. This is how my earlyStartup() method looks like: @Override public void earlyStartup() { Job clearPrefsJob = new Job("clearPrefsJob") { @Override protected IStatus run(IProgressMonitor monitor) { try { DataStorage dataStorage = new DataStorage(); dataStorage.clearPrefs(); System.out.println("Every…
has title: Eclipse plugin: Run code right after startup
type: AnsweredQuestion
tagged with: java
tagged with: eclipse-jdt
has answer: http://stackoverflow.com/a/25010064
type: Question
tagged with: startup
score: 4
tagged with: eclipse
upvote count: 4
accepted answer: http://stackoverflow.com/a/25010064
answer count: 1
downvote count: 0
tagged with: eclipse-plugin

http://stackoverflow.com/a/24984504
answers question: http://stackoverflow.com/q/24947001
type: Answer
score: 2
downvote count: 0
has body: I would say please monitor the GC before deciding on the sizing as you never know how the application will behave under load. Have a look at this link and this it has some good references about GC and tools to calculate the same.
upvote count: 2

http://stackoverflow.com/comment/38874380
has text: share your original code that compilable.
comment on: http://stackoverflow.com/q/25002265
type: Comment
score: 1
type: QuestionComment

http://stackoverflow.com/comment/38746127
type: Comment
comment on: http://stackoverflow.com/q/24932806
has text: No I can't help. Don't use application/octet-stream, use the proper content-type so the browser can do it for you.
type: QuestionComment
score: 0

http://stackoverflow.com/comment/38984682
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25058315
type: Comment
has text: But isn't there a way, to clear the table completely and 'build' it new again with different data ?! How am I supposed to update the information in the table, if the Listener stops working when I clear the 'old' data?

http://stackoverflow.com/a/55658020
upvote count: 1
answers question: http://stackoverflow.com/q/24992105
type: Answer
has body: To achieve upper(marketingo0_.SOURCE_KEY_UID)=? OR (marketingo0_.STATUS=? and marketingo0_.STATUS=? ) I think this should work criteriaBuilder.or( criteriaBuilder.equal(criteriaBuilder.upper(root.&lt;String&gt;get("SOURCE_KEY_UID")), key), criteriaBuilder.and( criteriaBuilder.equal(root.get("STATUS"), status), criteriaBuilder.equal(root.get("STATUS"), status) // This doesnot make sense but sticking to OP ) )
downvote count: 0
score: 1

http://stackoverflow.com/q/25067059
has answer: http://stackoverflow.com/a/25068157
has answer: http://stackoverflow.com/a/44882986
has answer: http://stackoverflow.com/a/25067492
downvote count: 0
answer count: 7
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25067188
has comment: http://stackoverflow.com/comment/38998685
has body: What is "Busy Spin" in multi-threaded environment? How it is useful and how can it be implemented in java in a multi-threaded environment? In what way can it be useful in improving the performance of an application?
has title: What is busy spin in a multi-threaded environment?
tagged with: java
tagged with: multithreading
score: 24
has answer: http://stackoverflow.com/a/27407248
upvote count: 24
type: Question
has answer: http://stackoverflow.com/a/35130920
has comment: http://stackoverflow.com/comment/38998648
has answer: http://stackoverflow.com/a/25067544

http://stackoverflow.com/q/25036819
tagged with: cucumber-jvm
upvote count: 1
downvote count: 0
favorite count: 0
linked to: http://stackoverflow.com/q/2952666
has comment: http://stackoverflow.com/comment/41565398
type: UnansweredQuestion
answer count: 0
score: 1
tagged with: java
type: Question
tagged with: cucumber
has title: How to do Desktop GUI testing using Cucumber JVM (consistent behavior across devices)?
tagged with: testing
tagged with: automated-tests
has comment: http://stackoverflow.com/comment/41207052
has body: I have written a Framework on top of Cucumber-JVM which sports configurable and plug-able step implementations. It is integrated with Continuous Integration server Jenkins and runs several thousands of steps in the scenarios/ features and generates html reports &amp; emails on pre-scheduled or on-demand basis for some of the projects. I have written generic plugins which enables configurable step implementations by testers without writing implementation code. I have implemented generic plugins for Web Services (SOAP/ REST), HTTP, FTP/ SFTP, File Generators/ Processors, Database Operations, Web GUI (integrating with Selenium), OS calls, and several other proprietary protocols. I have been pretty successful in rolling out these to teams. However some of the projects require testing in Desktop GUI for which I do not have generic plugin yet. I have done some research to identify Desktop GUI automation practices and free/ open source tools - http://en.wikipedia.org/wiki/List_of_GUI_testing_tools, https://sqa.stackexchange.com/questions/5515/web-application-gui-automation-best-practices, Windows GUI Automation In general, Desktop GUI tools are based on image recognition and pointer locations which makes the automation difficult to be consistent across devices (different laptops, desktops etc). Sikuli http://www.sikuli.org/ tool is promising, but this is also not an exception for the inconsistency. Now questions are : 1. Has anyone automated Desktop GUI with cucumber which gives consistent behavior? 2. Any best practices you could share, point to, with respect to Desktop GUI automation through Cucumber? 3. Any suggestion on the tools to integrate with Cucumber for achieving this? Thanks in advance for your answers

http://stackoverflow.com/comment/38817889
has text: Why don't you want to just add methods to the class? What do you mean by "via GUI"?
comment on: http://stackoverflow.com/q/24972054
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25037806
answers question: http://stackoverflow.com/q/25037383
has comment: http://stackoverflow.com/comment/38941549
has body: use phpmyadmin oe heideiSQL to upload data from CSV file you can change the upload limit of phpmyadmin in .ini file Simple data insertion into database. Fetch data from from database as java pojo objects and process it. Saves your memory
type: Answer
downvote count: 1
score: -1
upvote count: 0

http://stackoverflow.com/q/24974368
tagged with: java
tagged with: screen
has answer: http://stackoverflow.com/a/24974489
type: Question
has body: Is there a Graphics context that Java can utilize so that the programmer can draw directly to the screen rather than a window?
score: 0
answer count: 1
type: UnansweredQuestion
has title: How can I draw directly to screen?
tagged with: rendering

http://stackoverflow.com/a/25065811
type: Answer
has body: It isn't clear how we are getting to here from the SAX representation of the RSS; Or, for that matter, what you have done to validate that you got to the URL, fetched and parsed some RSS. But this method seems to do what the Java API can do in a String constructor: http://docs.oracle.com/javase/7/docs/api/java/lang/String.html#String%28char[],%20int,%20int%29
answers question: http://stackoverflow.com/q/25065524
score: 0
has comment: http://stackoverflow.com/comment/38995541
has comment: http://stackoverflow.com/comment/38994387

http://stackoverflow.com/comment/38874411
type: Comment
comment on: http://stackoverflow.com/q/24999425
score: 0
type: QuestionComment
has text: +1 Good question. Can you show us a bit of code showing how you instantiate the JDOM objects? That will help narrow down the possible answers.

http://stackoverflow.com/comment/39086429
type: AnswerComment
has text: so day of type Day is a short way of creating a new variable in the same way x = x +1 could be said x++ ?
type: Comment
comment on: http://stackoverflow.com/a/25042999
score: 0

http://stackoverflow.com/comment/38940439
has text: Thanks for your effort. This looks useful but I changed my locale to chinese,used date format with hiphens , I was still not able to replicate the issue locally. Any other ideas??
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25034258

http://stackoverflow.com/a/25028979
has body: Try this one: String imgPath = "img/button.png"; BufferedImage buffImage = ImageIO.read(getClass().getResourceAsStream(imgPath));
score: 1
answers question: http://stackoverflow.com/q/25028913
downvote count: 0
type: Answer
upvote count: 1

http://stackoverflow.com/q/24966780
has comment: http://stackoverflow.com/comment/38807966
tagged with: java
type: Question
tagged with: java-server
has comment: http://stackoverflow.com/comment/38841889
has body: I have simple web server and i'm running it in /myHome/serverHome directory. All code(classes) running on my JVM can read files in /myHome/serverHome and its sub directories. But i want to limit file reads of myHome/serverHome/conf directory to only signed code. If i used java security manager it allows all code to read all files in sub directories. Is there any way we can block this. Any help appriciate. Thanks.
tagged with: code-access-security
tagged with: security
has title: How to limit file reads to subdirectories from java app using security manager
answer count: 0
type: UnansweredQuestion
score: 0
has comment: http://stackoverflow.com/comment/38865468

http://stackoverflow.com/a/24909752
downvote count: 0
type: Answer
has body: you will get answer in source code : public String substring(int beginIndex) { if (beginIndex &lt; 0) { throw new StringIndexOutOfBoundsException(beginIndex); } int subLen = value.length - beginIndex; if (subLen &lt; 0) { throw new StringIndexOutOfBoundsException(subLen); } return (beginIndex == 0) ? this : new String(value, beginIndex, subLen); } where value.length will get 1 in your condition so int subLen = value.length - beginIndex; which will become like : int subLen = 1 - 1; and subLen will be 0 so if (subLen &lt; 0) { will be false and it wont throw exception :)
answers question: http://stackoverflow.com/q/24909685
upvote count: 5
has comment: http://stackoverflow.com/comment/38700292
score: 5

http://stackoverflow.com/q/24911681
linked to: http://stackoverflow.com/q/19403949
tagged with: java
has body: I am running link tests on an application and one of the links brings up a login popup window. Is there a way to check for that? I tried treating it like an alert but it didn't work. try { WebDriverWait wait = new WebDriverWait(driver, 2); wait.until(ExpectedConditions.alertIsPresent()); Alert alert = driver.switchTo().alert(); alert.accept(); reportAlertPresent = true; }
type: Question
upvote count: 2
has answer: http://stackoverflow.com/a/24926176
answer count: 2
tagged with: popupwindow
favorite count: 0
has answer: http://stackoverflow.com/a/24912599
has title: How would you check if a popup window exists using selenium webdriver?
type: UnansweredQuestion
tagged with: selenium-webdriver
score: 2
downvote count: 0

http://stackoverflow.com/comment/38984688
has text: I found one thread related to same problem but I have no idea what solution they suggested. Here is the link https://groups.google.com/forum/#!topic/javacv/4Cac4LoT3-M
score: 0
comment on: http://stackoverflow.com/q/25059951
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24937437
answer count: 4
score: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24937584
downvote count: 0
tagged with: java
has body: In other languages I know I can do the following. But I am having trouble in Java understanding why I cannot do this. My error is: Exception in thread "main" java.lang.Error: Unresolved compilation problem: The operator || is undefined for the argument type(s) java.lang.String, java.lang.String My code is: public class Tester { public static void main(String[] args) { String one = null; String two = "two"; String three = one || two; System.out.println(three); } }
has answer: http://stackoverflow.com/a/24937500
type: Question
possible better answer: http://stackoverflow.com/a/24937584
upvote count: 2
has answer: http://stackoverflow.com/a/24937544
has title: How to make a variable choose if one of the two options is not null
favorite count: 0
has answer: http://stackoverflow.com/a/24937470
accepted answer: http://stackoverflow.com/a/24937470

http://stackoverflow.com/comment/38807973
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24964856
has text: A `ResultSet` is a series (or a "set") of results, you need to iterate of the `ResultSet` to get each individual row. Have a look at [Retrieving and Modifying Values from Result Sets](http://docs.oracle.com/javase/tutorial/jdbc/basics/retrieving.html) for more details
score: 0

http://stackoverflow.com/comment/38926184
comment on: http://stackoverflow.com/a/25022555
type: Comment
has text: Alright one last question.If you have an Integer in the beginning(int i = 5;) of the program but it changes later in the program(i = 0;).Afterwards it is serialized.When the program is restarted will the Integer get set back to 5 since int i = 5; is the first line of code.
score: 0
type: AnswerComment

phrase
type: Tag
tag name: phrase
tags question: http://stackoverflow.com/q/25025259

liferay-6
tags question: http://stackoverflow.com/q/25012031
tags question: http://stackoverflow.com/q/24953683
tags question: http://stackoverflow.com/q/24928804
tag name: liferay-6
type: Tag
tags question: http://stackoverflow.com/q/25056374

http://stackoverflow.com/q/24991871
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/24991979
tagged with: http://stackoverflow.com/tag/xml
favorite count: 0
tagged with: soap
upvote count: 1
type: AnsweredQuestion
has title: Replace parts of string on line using XSLT 2
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/24991979
tagged with: xslt
type: Question
has body: I have a WSDL, in which I would like to override the soap address location using XSLT 2.0. For example: &amp;lt;soap:address location="https://xyz.company.com/portal/services/Service?param1=myapp&amp;amp;webService=TestWebService"/&amp;gt; For the location attribute, I would like xyz.company.com to become abc.company.com myapp to become xyzapp. I have written the following xslt: &lt;?xml version="1.0" encoding="ISO-8859-1"?&gt; &lt;xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"&gt; &lt;xsl:output method="xml"/&gt; &lt;xsl:template match="node()|@*"&gt; &lt;xsl:copy&gt; &lt;xsl:apply-templates select="node()|@*"/&gt; &lt;/xsl:copy&gt; &lt;/xsl:template&gt; &lt;xsl:variable name="vLocation" select="wsdl:definitions/wsdl:service/wsdl:port/soap:address/@location"/&gt; &lt;xsl:template match="@location"&gt; &lt;xsl:attribute name="location"&gt; &lt;xsl:value-of select="replace($vLocation, xyz.company.com', 'abc.company.com')"/&gt; &lt;/xsl:attribute&gt; &lt;/xsl:template&gt; &lt;/xsl:stylesheet&gt; This works for replacing point 1 -> xyz.company.com to become abc.company.com. But how can I also replace point 2. ->myapp to become xyzapp Please advise. Thanks,

http://stackoverflow.com/comment/38832440
comment on: http://stackoverflow.com/a/24979793
score: 0
has text: what is name of that xml file?
type: Comment
type: AnswerComment

2d-games
tags question: http://stackoverflow.com/q/24964694
type: Tag
tags question: http://stackoverflow.com/q/25007443
tag name: 2d-games

http://stackoverflow.com/a/24995482
score: 4
accepted answer of: http://stackoverflow.com/q/24986367
upvote count: 4
has body: Im glad you got it sorted anyway. I pulled the project and ran it myself anyway just to take a look and your explanation is correct. You could add this to your log4j.xml if you wanted to get rid of that message from polluting your logs in the future :-) <level value="error" />
type: AcceptedAnswer
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/24986367

http://stackoverflow.com/comment/38769427
has text: @BradlySpicer: Well, for starters, you're not extending `SQLiteAssetHelper`. That's rather important for using `SQLiteAssetHelper`.
type: Comment
comment on: http://stackoverflow.com/a/24945890
score: 0
type: AnswerComment

http://stackoverflow.com/a/25045518
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25045438
type: Answer
score: 6
downvote count: 0
has body: The delay is OS dependent. Each OS defines its own "repeat rate" for generating events when a key is held down. The secret is to start a Swing Timer when the key is pressed and then used the Timer to generate an events to do the animation and then stop the Timer when the key is released. This way you can control the animation interval independent of the OS. Check out Motion Using the Keyboard. The KeyboardAnimation example code shows one way you could do this.
upvote count: 6
answers question: http://stackoverflow.com/q/25045438

http://stackoverflow.com/q/24984135
possible better answer: http://stackoverflow.com/a/59008700
tagged with: autocomplete
downvote count: 0
has answer: http://stackoverflow.com/a/24984169
score: 15
favorite count: 0
has title: Eclipse Auto Complete: Java 1.7 Generics Diamond
has answer: http://stackoverflow.com/a/26061414
tagged with: generics
answer count: 4
has body: I just upgraded to Luna (from Kepler) and I noticed some little (yet annoying) problem: The auto completion lacks the possibility to generate diamonds "&lt;>" for already specified generics in variable initialisation. For Example, when I type: Set&lt;String&gt; mySet = new HashSet I would expect, that it gets auto-completed to Set&lt;String&gt; mySet = new HashSet&lt;&gt;(); rather than Set&lt;String&gt; mySet = new HashSet&lt;String&gt;(); I am using JDK 1.7 and the compliance level is set to 1.7 also. Its also very strange that when I hit STRG+Space multiple times during auto-completing till it reaches java-autocompletion again and then hit Enter it delivers the expected diamonds. This looks very much like a bug to me. Is this bug "known" and is there any workaround for this issue? Could not find anything related to this topic.
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/26061414
has answer: http://stackoverflow.com/a/24984505
has answer: http://stackoverflow.com/a/59008700
tagged with: eclipse
type: Question
upvote count: 15

http://stackoverflow.com/q/24986930
favorite count: 0
has title: Blank layout - eglSurfaceAttrib not implemented
upvote count: 5
tagged with: android-xml
accepted answer: http://stackoverflow.com/a/24987084
tagged with: android
has comment: http://stackoverflow.com/comment/38846003
has comment: http://stackoverflow.com/comment/38845906
has comment: http://stackoverflow.com/comment/38846093
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38846098
downvote count: 0
has answer: http://stackoverflow.com/a/24987084
tagged with: java
has comment: http://stackoverflow.com/comment/38846394
type: Question
tagged with: android-layout
score: 5
has comment: http://stackoverflow.com/comment/38845897
has body: I am constantly recieving the following message: eglSurfaceAttrib not implemented I tried cleaning the project, played around with manifest, search others who had similar issue s but my attempt have been unsuccessful. Any help would be greatly appreciated. Below is my activity code public class ProfileCreation extends Activity { public class LoadImg extends Activity { private static final int RESULT_LOAD_IMAGE = 1; FrameLayout layout; Button save ; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_profile_creation); save=(Button) findViewById(R.id.btnConfirm); String picturePath = PreferenceManager.getDefaultSharedPreferences(this).getString("picturePath", ""); if(!picturePath.equals("")) { ImageView imageView = (ImageView) findViewById(R.id.profilePicturePreview); imageView.setImageBitmap(BitmapFactory.decodeFile(picturePath)); } Button buttonLoadImage = (Button) findViewById(R.id.btnPictureSelect); buttonLoadImage.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View arg0) { Intent i = new Intent( Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI); startActivityForResult(i, RESULT_LOAD_IMAGE); } }); save.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View arg0) { // Locate the image in res > Bitmap bitmap = BitmapFactory.decodeFile("picturePath"); // Convert it to byte ByteArrayOutputStream stream = new ByteArrayOutputStream(); // Compress image to lower quality scale 1 - 100 bitmap.compress(Bitmap.CompressFormat.PNG, 100, stream); Object image = null; try { String path = null; image = readInFile(path); } catch(Exception e) { e.printStackTrace(); } // Create the ParseFile ParseFile file = new ParseFile("picturePath", (byte[]) image); // Upload the image into Parse Cloud file.saveInBackground(); // Create a New Class called "ImageUpload" in Parse ParseObject imgupload = new ParseObject("Image"); /…
has comment: http://stackoverflow.com/comment/38845872
has comment: http://stackoverflow.com/comment/38845959
answer count: 1
has comment: http://stackoverflow.com/comment/38845895
tagged with: android-activity

http://stackoverflow.com/comment/38994350
type: Comment
type: QuestionComment
has text: dont you want `getApplicationContext()`?
comment on: http://stackoverflow.com/q/25065807
score: 0

http://stackoverflow.com/a/42767598
has body: package hsm; import java.io.BufferedInputStream; import java.io.BufferedOutputStream; import java.io.DataInputStream; import java.io.DataOutputStream; import java.net.Socket; public class TestHSMJava { public static void main(String args[]) { System.out.println("&lt;&lt;&lt; Main Method Entry &gt;&gt;&gt;"); String command = null; Socket socket = null; DataOutputStream out = null; DataInputStream in = null; byte[] b= new byte[100]; try { socket = new Socket("127.0.0.1", 9998); System.out.println("&lt;&lt;&lt; Socket &gt;&gt;&gt; :" + socket); if (socket != null) { /* System.out.println("&lt;&lt;&lt; Connected to HSM &gt;&gt;&gt;:" + socket.isConnected()); in = new DataInputStream (new BufferedInputStream(socket.getInputStream())); out = new DataOutputStream (new BufferedOutputStream(socket.getOutputStream())); command = "0006303030304e43"; out.writeUTF(command); System.out.println("Input to HSM : " +command); out.flush(); String response = in.readUTF(); System.out.println("Output from HSM : " +response); System.out.println("..");*/ System.out.println("&lt;&lt;&lt; Connected to HSM &gt;&gt;&gt;:" + socket.isConnected()); in = new DataInputStream (new BufferedInputStream(socket.getInputStream())); out = new DataOutputStream (new BufferedOutputStream(socket.getOutputStream())); command = "000A3030303041323030325500060000A2002U"; out.writeUTF(command); System.out.println("Input to HSM : " +command); out.flush(); String response = in.readUTF(); System.out.println("Output from HSM : " +response); System.out.println(""); } } catch (Exception e) { // TODO: handle exception } }}
answers question: http://stackoverflow.com/q/25035894
score: 0
has comment: http://stackoverflow.com/comment/72651070
type: Answer

http://stackoverflow.com/a/24989774
type: Answer
accepted answer of: http://stackoverflow.com/q/24989521
score: 3
downvote count: 0
answers question: http://stackoverflow.com/q/24989521
has body: This is really poorly documented in the Java Docs, because all that tells you is that the "message" parameter is an Object, which can be anything - but does not go into specifics about what happens with different types of objects that may warrant special case handling. As far as I have gathered from experimenting with it, the "message" can be a subtype of Component - then it will just place the component in the message area of the dialog box as-is, like: JOptionPane.showMessageDialog(null, new JCheckBox("I'm a checkbox!")); Otherwise, it will just call the toString method on the object, converting it into a string, which it then will just wrap in a label and place that in the dialog as the message. But you can also pass in an Array of Objects, in which case it will just place each element in a separate row in the message area: JOptionPane.showMessageDialog(null, new Object[] { new JCheckBox("check"), new JRadioButton("radio"), "plain text"}); There might be other special cases, but I haven't found them yet. That said, if what you want to display is a subclass of Component (or JComponent), just passing it in as the message parameter should work. If it doesn't, you might want to edit your question to describe whatever problems you are encountering in more detail, perhaps also providing some sample code.
has comment: http://stackoverflow.com/comment/38851433
has comment: http://stackoverflow.com/comment/38851203
has comment: http://stackoverflow.com/comment/38851316
upvote count: 3
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38851730
has comment: http://stackoverflow.com/comment/38851454

http://stackoverflow.com/comment/38787072
comment on: http://stackoverflow.com/q/24955834
type: Comment
type: QuestionComment
has text: what you want to do is use finish() to close the activity, what you are doing now is re-open the first activity.
score: 1

http://stackoverflow.com/q/25014210
type: Question
tagged with: encoding
upvote count: 0
has title: RC4 decrypting a file using Java
has comment: http://stackoverflow.com/comment/38958447
has comment: http://stackoverflow.com/comment/38918535
has comment: http://stackoverflow.com/comment/38912970
downvote count: 4
has comment: http://stackoverflow.com/comment/38950245
answer count: 1
has comment: http://stackoverflow.com/comment/38921138
has comment: http://stackoverflow.com/comment/38981215
favorite count: 0
tagged with: hash
type: UnansweredQuestion
score: -4
tagged with: encryption
has comment: http://stackoverflow.com/comment/38922655
has answer: http://stackoverflow.com/a/25060052
tagged with: java
has body: I have telephone exchange server which records calls and stores them encrypted. I need now to decrypt and convert all calls to .wav file. I can see they are encrypted using RC4 algorithm, but I can't figure out how to get a key for a decryption. Here's "serverController.class" from "AgentServer.jar: http://pastebin.com/3wVhhuqh All records are sorted in two MySQl tables. Here's one record from both tables and it's corresponding encrypted file: table "records": https://i.sstatic.net/PRwBN.png table "recordsdetails": https://i.sstatic.net/4tEir.png record file: https://dl.dropboxusercontent.com/u/19586312/00000000000000000000 Can anyone help me please? If I could decrypt that one file, then I would know what to do with others and try to automate it. Thanks! private byte[] getRC4Key(BigInteger paramBigInteger) { try { MessageDigest localMessageDigest = MessageDigest.getInstance("MD5"); localMessageDigest.reset(); localMessageDigest.update(ServerModel.getInstance().getConnection().getPassword().getBytes("ISO-8859-1")); byte[] arrayOfByte = localMessageDigest.digest(); localMessageDigest.reset(); localMessageDigest.update(arrayOfByte); localMessageDigest.update(ByteArraysUtils.BigInteger2ByteArray(paramBigInteger)); return localMessageDigest.digest(); } catch (NoSuchAlgorithmException localNoSuchAlgorithmException) { LOGGER.severe(localNoSuchAlgorithmException.getMessage()); } catch (PbxOperationException localPbxOperationException) { LOGGER.severe(localPbxOperationException.getMessage()); } catch (UnsupportedEncodingException localUnsupportedEncodingException) { LOGGER.severe(localUnsupportedEncodingException.getMessage()); } return null; } I think that if I got a key I would be able to decrypt the file. Would anybody mind explaining me the way that key is generated?

http://stackoverflow.com/comment/38767545
has text: sin and cos take in the angle in radians, is your getAngle returning degrees? if yes then multiply it by 0.0174532925 to convert it to radian
comment on: http://stackoverflow.com/q/24942229
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/38788304
has text: You can use `GridBagLayout` to control resizing weight of each component. When you do resize, components with lower weight take less space than components with higher weight.
score: 3
comment on: http://stackoverflow.com/q/24956245
type: Comment
type: QuestionComment

http://stackoverflow.com/tag/csv
tags question: http://stackoverflow.com/q/24964996
type: Tag
tags question: http://stackoverflow.com/q/24939425
tags question: http://stackoverflow.com/q/24929105
tags question: http://stackoverflow.com/q/24954152
tag name: csv
tags question: http://stackoverflow.com/q/24999198
tags question: http://stackoverflow.com/q/24991507
tags question: http://stackoverflow.com/q/24928743
tags question: http://stackoverflow.com/q/24947467
tags question: http://stackoverflow.com/q/25002823
tags question: http://stackoverflow.com/q/24912889
tags question: http://stackoverflow.com/q/24995282
tags question: http://stackoverflow.com/q/24990108
tags question: http://stackoverflow.com/q/25015978

http://stackoverflow.com/comment/38933506
comment on: http://stackoverflow.com/q/25032631
score: 0
type: QuestionComment
type: Comment
has text: Hi, it takes in as url1url2url3 ultimately it will not be a valid url

http://stackoverflow.com/a/26297425
downvote count: 0
has body: While trying play with Java, I was stuck with the same problem too. Cause : The problem seems to arise when you have Eclipse project preference set to Build automatically. This messes up the classes generated by play and overrides it with the classes generated by eclipse upon a change. The solution : Disable the 'build automatically' from Project settings and from the terminal, do a play clean to create classes from Play! Let me know if this works, a lot of people face the same problem. This should probably be a hint in the documentation itself Reference.
type: Answer
upvote count: 7
score: 7
accepted answer of: http://stackoverflow.com/q/24960959
answers question: http://stackoverflow.com/q/24960959
type: AcceptedAnswer

http://stackoverflow.com/comment/38875588
has text: @CoderOgden also, calling activity methods like that is bad practise, you should consider using activity reference to call them.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25002350
type: Comment

java-8
tags question: http://stackoverflow.com/q/24979611
tags question: http://stackoverflow.com/q/24974458
tags question: http://stackoverflow.com/q/25000687
tags question: http://stackoverflow.com/q/25049107
tags question: http://stackoverflow.com/q/25025715
tags question: http://stackoverflow.com/q/24946211
tags question: http://stackoverflow.com/q/24986266
tags question: http://stackoverflow.com/q/24943927
tags question: http://stackoverflow.com/q/24917053
tags question: http://stackoverflow.com/q/24975813
tags question: http://stackoverflow.com/q/24999622
tags question: http://stackoverflow.com/q/25019254
tags question: http://stackoverflow.com/q/24986279
tags question: http://stackoverflow.com/q/25007513
tags question: http://stackoverflow.com/q/25005906
tags question: http://stackoverflow.com/q/25002513
tags question: http://stackoverflow.com/q/24987021
tags question: http://stackoverflow.com/q/24996017
tags question: http://stackoverflow.com/q/25031328
tags question: http://stackoverflow.com/q/24981750
tags question: http://stackoverflow.com/q/25015773
tags question: http://stackoverflow.com/q/25048010
tags question: http://stackoverflow.com/q/24940742
tags question: http://stackoverflow.com/q/24926235
tags question: http://stackoverflow.com/q/24995066
tags question: http://stackoverflow.com/q/25062436
tags question: http://stackoverflow.com/q/25055392
tags question: http://stackoverflow.com/q/24953978
tags question: http://stackoverflow.com/q/24911052
tag name: java-8
tags question: http://stackoverflow.com/q/24911388
type: Tag
tags question: http://stackoverflow.com/q/25041177
tags question: http://stackoverflow.com/q/25051521
tags question: http://stackoverflow.com/q/24947198
tags question: http://stackoverflow.com/q/24938333
tags question: http://stackoverflow.com/q/24937618
tags question: http://stackoverflow.com/q/24943726

http://stackoverflow.com/comment/38943029
has text: @user1438038 Works just fine for me on Windows 7.
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24943125

http://stackoverflow.com/comment/38727568
has text: @mish: Have you only learned about for loops in the context of counting from one number to another? The termination condition doesn't have to have anything to do with `currentDepth` or `maxDepth`. You could make it something like `System.nanoTime() - startTime < someLimit`, or remove the condition entirely and add a check inside the loop that breaks the loop if it detects that the time is up.
comment on: http://stackoverflow.com/a/24923881
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/38991020
score: 0
has text: I find it very hard to believe that references regarding the module operator are "blocked".
comment on: http://stackoverflow.com/q/25064019
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38977913
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25057271
has text: Is the first number in 0 to 9 range?

http://stackoverflow.com/q/24993616
has title: android.view.InflateException: Binary XML file line #1: Error inflating class linearlayout
has comment: http://stackoverflow.com/comment/38858050
score: -3
accepted answer: http://stackoverflow.com/a/24993636
type: AnsweredQuestion
has body: I use below code to create dialog with checkbox like that: Create: AlertDialog.Builder builder = new AlertDialog.Builder(getContext()); LayoutInflater adbInflater = LayoutInflater.from(getContext()); LinearLayout eulaLayout = (LinearLayout) adbInflater.inflate(R.layout.checkbox, null); dontShowAgain = (CheckBox)eulaLayout.findViewById(R.id.skip); Layout of checbox.xml:
tagged with: java
downvote count: 3
type: Question
tagged with: android-layout
upvote count: 0
tagged with: layout
has comment: http://stackoverflow.com/comment/38858183
has answer: http://stackoverflow.com/a/24993636
tagged with: android
answer count: 1
has comment: http://stackoverflow.com/comment/38858056
favorite count: 0

http://stackoverflow.com/comment/73257095
type: AnswerComment
comment on: http://stackoverflow.com/a/24956121
type: Comment
has text: @LukaszLenart I perfectly agree, this answer is quite old, and at that time I used HTML messages, stripping harmful HTML code server-side... it was definitely a mistake not mentioning it in the answer, though (that I've edited now removing the escapes). Thanks for your feedback
score: 1

http://stackoverflow.com/comment/38767535
type: QuestionComment
type: Comment
score: 1
has text: You only need to insert one single line into your insertSort method. The line is `if(temp == a[j - 1]) temp = -1;`. Now you just need to figure out where to place it.
comment on: http://stackoverflow.com/q/24944844

http://stackoverflow.com/a/25055599
type: Answer
answers question: http://stackoverflow.com/q/25055508
has body: List&lt;Integer&gt; users = new ArrayList&lt;Integer&gt;(); Map&lt;String, Object&gt; hashMap = new HashMap&lt;String, Object&gt;(); hashMap.put("users",user); .... .... .... List&lt;Integer&gt; users = (List&lt;Integer&gt;)hashMap.get("users"); //assuming this is another method and 'users' is not defined here yet Integer[] usersArray = users.toArray(new Integer[users.size()]); System.out.println("" + usersArray[i]); Please note that this is an atrocity and you shouldn't be storing that List as an Object, you are pretty much circumventing what Generics are for.
upvote count: 3
has comment: http://stackoverflow.com/comment/38975182
downvote count: 0
score: 3
has comment: http://stackoverflow.com/comment/38975034

http://stackoverflow.com/comment/38920410
comment on: http://stackoverflow.com/q/25005088
has text: What you are looking for is probably something like Thrift/Nifty and Swift? https://github.com/facebook/swift/
type: QuestionComment
type: Comment
score: 0

http://stackoverflow.com/comment/38983643
comment on: http://stackoverflow.com/q/25060027
type: QuestionComment
has text: the http parameters are probbaly on the REST layer. repositories are the persistence layer. find what code calls this method...
score: 1
type: Comment

http://stackoverflow.com/comment/38775619
has text: No, it's working fine. But I just wanted to shorten it a bit more.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24949149
type: Comment

http://stackoverflow.com/a/25082622
score: 41
downvote count: 2
answers question: http://stackoverflow.com/q/25062082
upvote count: 43
accepted answer of: http://stackoverflow.com/q/25062082
type: AcceptedAnswer
has body: You need to import PowerMockRunner as follows: import org.powermock.modules.junit4.PowerMockRunner;
has comment: http://stackoverflow.com/comment/85206564
type: Answer

http://stackoverflow.com/comment/38977704
type: Comment
type: QuestionComment
score: 1
has text: You should be deleting the card by the id.
comment on: http://stackoverflow.com/q/25057117

http://stackoverflow.com/q/25015808
tagged with: jtable
answer count: 2
has answer: http://stackoverflow.com/a/25016342
has comment: http://stackoverflow.com/comment/38900740
accepted answer: http://stackoverflow.com/a/25016342
has body: for Java Kepler Eclipse and Jtable, I am trying to make it so as when a specific table cell is selected, that cell will work as an editorPane; or have the whole column work as editorPane. When I click a cell on column COMMENTS it enlargens the row but I cant get it to work as an editorPane. My project is actualy very different but I wrote this mini one with the table so you can copy, paste and run it to see exactly what the problem is when you click on a COMMENTS cell. I tried to make the column an editorPane to begin with like I made the column DONE with checkBox, but it doesnt work or I am doing it wrong. I also tried cellRenderer but I couldnt make that work either. Whether the whole column works as an editorPane or just the selected cell it doesnt matter, whatever is easier and as long as it works import javax.swing.*; import javax.swing.table.*; import java.awt.*; public class JavaTestOne { JFrame frmApp; private JTable table; private JCheckBox checkbox; DefaultTableModel model; public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { JavaTestOne window = new JavaTestOne(); window.frmApp.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); } public JavaTestOne() { initialize(); } private void initialize() { frmApp = new JFrame(); frmApp.getContentPane().setFont(new Font("Tahoma", Font.PLAIN, 13)); frmApp.setBounds(50, 10, 1050, 650); frmApp.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frmApp.getContentPane().setLayout(new CardLayout(0, 0)); frmApp.setTitle("App"); { JScrollPane scrollPane = new JScrollPane(); scrollPane.setBounds(0, 42, 984, 484); frmApp.add(scrollPane); { table = new JTable(); table.setFillsViewportHeight(true); Object[][] data = { {"I01", "Tom",new Boolean(false), ""}, {"I02", "Jerry",new Boolean(false), ""}, {"I03", "Ann",new Boolean(false), ""}}; String[] cols = {"ID","NAME","DONE","COMMENTS"}; model = new DefaultTableModel(data, cols) { private static final long serialV…
has title: Java Eclipse Jtable Cell / Column
favorite count: 0
score: 2
tagged with: jeditorpane
downvote count: 0
possible better answer: http://stackoverflow.com/a/25016222
has answer: http://stackoverflow.com/a/25016222
tagged with: swing
linked to: http://stackoverflow.com/q/12529200
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38901124
tagged with: java
has comment: http://stackoverflow.com/comment/38900155
tagged with: eclipse
type: Question
upvote count: 2

http://stackoverflow.com/q/24917253
possible better answer: http://stackoverflow.com/a/24917360
linked to: http://stackoverflow.com/q/1886329
has body: I'm having a heck of a time getting swing component transparency to work properly under Ubuntu 14.04. For example, if I employ the SwingJD library, the glossy buttons render properly under Windows and OSX but some (not all - I've inspected the source and can't figure out what the difference is between the ones that render correctly and the ones that fail to) don't render properly under Ubuntu 14.04. I've also tried making components like JToolBar translucent to no avail. I know there are issues with Swing and Linux where transparency is concerned, and I've already tried the solutions given here, and here, here, and here with no luck. Has anyone found a way around this problem? I'd hate to have to create a less-asthetically-interesting UI for only Linux users. here's a direct link to the SwingJD source jar if you want to re-create the issue for yourself. it comes with a test class that has a main method that will render three buttons, two of which won't render correctly under Ubuntu. EDIT>> constructors for SwingJD "STANDARD_ORANGE_THEME" works while "STANDARD_LIGHT_ORANGE_THEME" doesn't case Theme.STANDARD_ORANGE_THEME: buttonColor = new GradientPaint(0, 0, new Color(251, 139, 62), 0, height, new Color(255, 102, 0)); button.setForeground(Color.WHITE); break; case Theme.STANDARD_LIGHTORANGE_THEME: buttonColor = new GradientPaint(0, 0, new Color(247, 174, 24), 0, height, new Color(255, 133, 0)); button.setForeground(Color.WHITE); break;
tagged with: linux
type: AnsweredQuestion
tagged with: java
tagged with: transparent
tagged with: swing
type: Question
has answer: http://stackoverflow.com/a/24941425
accepted answer: http://stackoverflow.com/a/24941425
has answer: http://stackoverflow.com/a/24917360
tagged with: ubuntu
has title: java swing transparency issues under linux
score: 0
answer count: 2
linked to: http://stackoverflow.com/q/20255218

http://stackoverflow.com/q/24924932
tagged with: spring
has answer: http://stackoverflow.com/a/52330960
type: AnsweredQuestion
upvote count: 107
has answer: http://stackoverflow.com/a/71171218
tagged with: java
has answer: http://stackoverflow.com/a/35313349
tagged with: gradle
score: 107
has answer: http://stackoverflow.com/a/45315659
type: Question
has answer: http://stackoverflow.com/a/65092474
has answer: http://stackoverflow.com/a/34403196
has body: I'm trying to run a very simple project using Gradle and running into the following error when using the gradlew run command: could not find or load main class 'hello.HelloWorld' Here is my file structure: SpringTest -src -hello -HelloWorld.java -Greeter.java -build -libs -tmp -gradle -wrapper -build.gradle -gradlew -gradlew.bat I excluded the contents of the libs and tmp folders because I didn't think that would be relevant information for this issue, but I can add it in if need be. Here is my build.gradle file: apply plugin: 'java' apply plugin: 'application' apply plugin: 'eclipse' mainClassName = 'hello/HelloWorld' repositories { mavenLocal() mavenCentral() } dependencies { compile "joda-time:joda-time:2.2" } jar { baseName = "gs-gradle" version = "0.1.0" } task wrapper(type: Wrapper) { gradleVersion = '1.11' } Any idea on how to fix this issue? I've tried all sorts of things for the mainClassName attribute but nothing seems to work.
has answer: http://stackoverflow.com/a/24925020
has answer: http://stackoverflow.com/a/79445456
accepted answer: http://stackoverflow.com/a/24925020
has answer: http://stackoverflow.com/a/58511120
possible better answer: http://stackoverflow.com/a/32504818
has answer: http://stackoverflow.com/a/51775797
has answer: http://stackoverflow.com/a/68496920
has answer: http://stackoverflow.com/a/57508180
downvote count: 0
has answer: http://stackoverflow.com/a/54410104
answer count: 17
tagged with: build.gradle
favorite count: 0
has answer: http://stackoverflow.com/a/36673251
has answer: http://stackoverflow.com/a/32504818
has comment: http://stackoverflow.com/comment/131116211
has answer: http://stackoverflow.com/a/30031675
has answer: http://stackoverflow.com/a/41593353
has title: Gradle - Could not find or load main class

http://stackoverflow.com/a/24969985
answers question: http://stackoverflow.com/q/24960771
type: Answer
has body: As pointed out in the comments, it is difficult to tell without actually looking at the assembly. As yoy are using a REST-framework, I assume however that is would be hard to tell from the assembly as there is quite a lot of code to read. Instead, I want to give you an educated guess because your code is an archetypical example of applying costant folding. When a value is inlined and not read from a field, the JVM can safely assume that this value is constant. When JIT compiling the method, the constant expression can therefore be safely merged with your framework code what probably leads to less JIT assebly and therefore improved performance. For a field value, even a final one, a constant value cannot be assumed as the field value can change. (As long as the field value is not a compile time constant, a primitive or a constant String, which are inlined by javac.) The JVM can therefore probably not constant fold the value. You can read more on constant folding in the tutorial to the JMH where it is noted: If JVM realizes the result of the computation is the same no matter what, it can cleverly optimize it. In our case, that means we can move the computation outside of the internal JMH loop. This can be prevented by always reading the inputs from the state, computing the result based on that state, and the follow the rules to prevent DCE. I hope you used such a framework. Otherwise, you performance metric is unlikely to be valid. From reading the byte code, you can generally not learn much about runtime performance as the JIT compiler can tweak the byte code to anything during optimization. The byte code layout should only matter when code is interpreted which is generally not the state where one would measure performance as performance-critical, hot code is always JIT compiled.
has comment: http://stackoverflow.com/comment/38826720
score: 4
upvote count: 4
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24960771

http://stackoverflow.com/comment/40656842
has text: @HotLicks, I know this question is old and dead, but take a look at [this article](http://tburette.github.io/blog/2014/05/25/so-you-want-to-write-your-own-CSV-code/). Saying CSVreader is only combining readlines and splits is pretty far off base, it's not incredibly complex, but it starts getting messy quick if you try to parse it yourself. [Check out the source](http://sourceforge.net/p/opencsv/code/HEAD/tree/trunk/src/main/java/au/com/bytecode/opencsv/) and you'll see it's definitely a non-trivial problem.
comment on: http://stackoverflow.com/q/24999198
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/88165747
comment on: http://stackoverflow.com/a/25053646
type: Comment
has text: This worked for me but I also had to override the getCount() method to return the sizeof my list.
score: 1
type: AnswerComment

http://stackoverflow.com/a/25030116
score: 0
answers question: http://stackoverflow.com/q/25029966
type: Answer
has body: Personally, I'd write this as follows: String askForUsername() { for (;;) { String userName = ...; String validationMessage = validateUserName(userName); if (validationMessage == null) { return userName; } else { display(validationMessage); } } } String validateUserName(String userName) { if (...) { return "Username can not be blank"; } else if (...) { return "Username must be between 6 and 14 characters long"; } else if (...) { return "Username must contain only letters and numbers"; } return null; } Alternatively, validateUserName() could throw Exceptions. This would be more idiomatic, but require somewhat more code.

android-resources
tags question: http://stackoverflow.com/q/24922905
type: Tag
tag name: android-resources
tags question: http://stackoverflow.com/q/25028020
tags question: http://stackoverflow.com/q/25029902

http://stackoverflow.com/comment/38907468
has text: @gtgaxiola The file path should be correct, since it is working when I manually set the value. I just set the character encoding to "UTF-8", which works when i set some string like this: String tester = "This is a test", then I encode tester and include it with "data="+testerencoded. I can also see by the log that the string I want is definitely in the class, but for some reason it wont encode at all. I have no idea what the issue is. Its a string of various characters (letters, numbers, and "-" which should be fine), but it's pretty long. IS it possible its too long to be included?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25018706

http://stackoverflow.com/a/25015930
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: ext[0][0] not initialized as tile[][] ext = new tile[1][1]; is Array of instances of tile (Object In general term) but you have to initialize every object stored at array index before using those objects as default value is null for every element here. tile ext[0][0]= new tile(); //Have to initialize it first //And than use it in your code As I think you won't get anny issue during compilation but it will throw NullPointerException while you execute your code which is trying to manipulate null value.
score: 4
accepted answer of: http://stackoverflow.com/q/25015887
upvote count: 4
answers question: http://stackoverflow.com/q/25015887

http://stackoverflow.com/q/25052998
favorite count: 0
has title: Getting Class from jar within a jar
tagged with: classloader
type: UnansweredQuestion
tagged with: java
upvote count: 1
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/38970207
has comment: http://stackoverflow.com/comment/38982316
tagged with: jar
has body: Hi all Is there any way to load class from a jar within a jar file. I am working on a Installer making form install4j. It only allows a single jar(user.jar) for Custom code Installation for providing all resources. In my case there is also some dependency on third party api(jar) files so I give it directly to instal4j it extracts it and place all contents within user.jar. So how can I execute my Class from that third party api. My current dir structure is like this - User dir User.jar mythirdparty.jar I want to load class from my thirdparty jar file. Any suggestions how to accomplish this ?
score: 0
has answer: http://stackoverflow.com/a/25056465
has comment: http://stackoverflow.com/comment/38973929
answer count: 1

http://stackoverflow.com/q/24991507
has answer: http://stackoverflow.com/a/24991628
type: UnansweredQuestion
tagged with: http://stackoverflow.com/tag/csv
has title: Java load external CSV file not working after compiling to Jar
tagged with: netbeans
tagged with: java
has body: I am writing a Java program using NetBeans that times the process of developing black and white film. One of the options allows you to set the times manually and the other allows you to select the chosen film and developer to calculate the required times from a CSV file that is loaded into an array. There are 3 files that are loaded, filmdb.csv, masterdb.csv and usersettings.csv. The first two are loaded purely for reading and the third file is loaded and can be written too to save the users default settings. All 3 files are stored in the project directory and loaded in a similar way to the following code and called from main: static String[] filmArray; static int filmRows = 125; int selectedDevTime; int tempDevTime; int minDevTime; int secDevTime; public int count = -1; static void createFilmArray() { filmArray = new String[filmRows]; Scanner scanLn = null; int Rowc = 0; int Row = 0; String InputLine = ""; String filmFileName; filmFileName = "filmdb.csv"; System.out.println("\n****** Setup Film Array ******"); try { scanLn = new Scanner(new BufferedReader(new FileReader(filmFileName))); while (scanLn.hasNextLine()) { InputLine = scanLn.nextLine(); filmArray [Rowc] = InputLine; Rowc++; } } catch (Exception e) { System.out.println(e); } } When I press the run button in NetBeans all works well, the files are all loaded and stored to the appropriate array but when I build the file as a .jar the files are not loaded, I have tried copying the 3 files to the same directory as the .jar as well as importing the 3 files into the .jar archive but to no joy. Is there a specific location where the files should be placed, or should they be imported in a different way? I would rather not load them from an absolute directory as for example a Windows user may have the files stored in C:\users\somebody\devtimer\file.csv and a Linux user may have the files stored in /home/somebody/devtimer/file.csv. Cheers Jim
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/24991599
tagged with: jar
linked to: http://stackoverflow.com/q/5957589
score: 0
tagged with: file-io

http://stackoverflow.com/q/24988814
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/24988865
answer count: 6
downvote count: 0
accepted answer: http://stackoverflow.com/a/24988865
has answer: http://stackoverflow.com/a/24988910
has answer: http://stackoverflow.com/a/24988849
favorite count: 0
tagged with: android
has answer: http://stackoverflow.com/a/24988916
has body: So I am trying to get the float value from a EditText, add some number to it, then change whatever number was there before. I have had no problem with that - the code below works. What I want to do is make it so that a '$' is always displayed infront of the float. I don't have much problem putting the $ there, as I just make the setText to setText("$"+iprice3). The problem comes about when I take in the value from EditText and there is a '$' present - it makes the app crash. I am having trouble figuring out how to go to string, get rid of it, then go back to float. Any ideas? if(checkbox3.isChecked()) { EditText price3 = (EditText) findViewById(R.id.payment3); float floatprice3 = Float.valueOf(price3.getText().toString()); float newprice3 = everyOnePaying + floatprice3; String iprice3 = Float.toString(newprice3); price3.setText(iprice3); checkbox3.setChecked(false); } On a side note - I was wondering if anyone knew how I could format the float so that it displays only 2 decimals.
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24988875
possible better answer: http://stackoverflow.com/a/24988868
score: 1
tagged with: java
has title: How to remove '$' from EditText, modify the float, and put a $ back
has answer: http://stackoverflow.com/a/24988868

http://stackoverflow.com/comment/38723940
comment on: http://stackoverflow.com/q/24921877
score: 0
type: Comment
type: QuestionComment
has text: Have you seen this? http://docs.oracle.com/javase/tutorial/uiswing/components/dialog.html

executorservice
type: Tag
tag name: executorservice
tags question: http://stackoverflow.com/q/25048385
tags question: http://stackoverflow.com/q/24953978

http://stackoverflow.com/comment/38841644
score: 0
type: AnswerComment
has text: i found my bugs, it was output error in main() method and bugs in Horar-partition about what you wrote above. Thanks a lot for helping
type: Comment
comment on: http://stackoverflow.com/a/24931068

http://stackoverflow.com/comment/39005505
has text: @MagicMicky mean `onLocationChanged` is never invoked by play location services.
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25017764

http://stackoverflow.com/q/25003990
favorite count: 0
accepted answer: http://stackoverflow.com/a/25004017
possible better answer: http://stackoverflow.com/a/25004044
has answer: http://stackoverflow.com/a/25004044
has body: I have a multiple JPanels which are put in a dialogue and after many hours, I am still unable to find the frame in which the JPanels are stored in. I was wondering if there is a method which would return the JFrame (end goal is to call setDefaultCloseOperation() on the JFrame). I was thinking getParent() would do this however I am still unable to call setDefaultCloseOperation no matter how many layers of parents I go through.
has title: Java find what JFrame belongs to a JPanel
type: AnsweredQuestion
tagged with: jframe
upvote count: 1
tagged with: swing
type: Question
has answer: http://stackoverflow.com/a/25004017
has comment: http://stackoverflow.com/comment/38883089
tagged with: java
linked to: http://stackoverflow.com/q/9554636
answer count: 2
downvote count: 0
score: 1

http://stackoverflow.com/q/25032361
answer count: 1
has comment: http://stackoverflow.com/comment/38932049
accepted answer: http://stackoverflow.com/a/25032441
has comment: http://stackoverflow.com/comment/38931229
has comment: http://stackoverflow.com/comment/38931648
has title: Can't read '.dat' files from folder
has answer: http://stackoverflow.com/a/25032441
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38931247
tagged with: java
tagged with: file
has body: I am trying to read multiple '.dat' files one by one inside a specific folder. below is my code public void viewEngingeer() throws Exception { File f = new File("Users"); ArrayList&lt;String&gt; usersList = new ArrayList&lt;String&gt;(Arrays.asList(f.list())); int index=0; while (index &lt; usersList.size()) { User newUser=new User(); FileInputStream fis = new FileInputStream("Users/"+usersList.get(index)); ObjectInputStream ois = new ObjectInputStream(fis); newUser = (User) ois.readObject(); ois.close(); System.out.println(newUser.getUsername()); index++; } } but I am getting error on running Exception in thread "main" java.io.InvalidClassException: oodj.User; local class incompatible: stream classdesc serialVersionUID = -7994693857260427394, local class serialVersionUID = 4996613179002222501 any ideas? Thank you
type: Question
score: 0
has comment: http://stackoverflow.com/comment/38931122
linked to: http://stackoverflow.com/q/8335813

http://stackoverflow.com/q/25031410
score: 1
tagged with: java
tagged with: jboss
has answer: http://stackoverflow.com/a/25031554
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/39510917
downvote count: 0
favorite count: 0
has title: How to add date in jboss logs, Logger is Java.util.logging.Logger
type: UnansweredQuestion
upvote count: 1
tagged with: logging
has body: I have been searching in net a lot but haven't manage to find the exact solution. Currently the logs doesn't include date, it just include time Ex: 12:31:24,733 INFO [com ......] I need to prefix date in the all the logs. So I configured the formatter in $JBOSS_HOME/standalone/configuration/logging.property as formatter.PATTERN.pattern=%d{dd/MM/yyyy HH:mm:ss,SSS} %-5p [%c] %s%E%n Then I could see, only starting jboss logs have date but then other JAVA logs doesn;t include date. Example: 30/07/2014 13:11:30,480 INFO [org.jboss.modules] JBoss Modules version 1.1.3.GA 30/07/2014 13:11:30,642 INFO [org.jboss.msc] JBoss MSC version 1.0.2.GA 30/07/2014 13:11:30,699 INFO [org.jboss.as] JBAS015899: JBoss AS 7.1.3.Final "Arges" starting 30/07/2014 13:11:31,468 INFO [org.xnio] XNIO Version 3.0.6.GA 30/07/2014 13:11:31,470 INFO [org.jboss.as.server] JBAS015888: Creating http management service using socket-binding (management-http) 30/07/2014 13:11:31,474 INFO [org.xnio.nio] XNIO NIO Implementation Version 3.0.6.GA 30/07/2014 13:11:31,482 INFO [org.jboss.remoting] JBoss Remoting version 3.2.8.SP1 30/07/2014 13:11:31,503 INFO [org.jboss.as.logging] JBAS011502: Removing bootstrap log handlers 13:11:31,506 INFO [org.jboss.as.configadmin] (ServerService Thread Pool -- 26) JBAS016200: Activating ConfigAdmin Subsystem 13:11:31,511 INFO [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 31) JBAS010280: Activating Infinispan subsystem. System: JAVA6, JBOSS7, RHEL6.4 Please let me know, how to I include date in all the jboss logs. UPDATE : Logging.property # Additional logger names to configure (root logger is always configured) loggers=org.jboss.as.config # Dump system environment at boot by default logger.org.jboss.as.config.level=DEBUG # Root logger level logger.level=${jboss.boot.server.log.level:INFO} # Root logger handlers logger.handlers=FILE,CONSOLE # Console handler configuration handler.CONSOLE=org.jboss.logmanager.handlers.ConsoleHandler handler.CONSOLE.prope…

http://stackoverflow.com/a/24952941
type: Answer
has body: The correct syntax is as below INSERT INTO TB_AUTO_BAN (MEMO, REG_DATE, USER_ID, NAME, PHONE_NUM ) SELECT 'test',NOW(), a.USER_ID, a.NAME, a.CONTACT_NUM FROM TB_CONTACT AS a INNER JOIN TB_CONTACT_GROUP AS b ON a.GROUP_CONTACT_SEQ = b.GROUP_CONTACT_SEQ WHERE b.USER_ID= 'spark@naver.com' AND b.GROUP_CONTACT_SEQ = 12000
has comment: http://stackoverflow.com/comment/38781935
upvote count: 4
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/24952910
score: 4
accepted answer of: http://stackoverflow.com/q/24952910

http://stackoverflow.com/comment/38919218
comment on: http://stackoverflow.com/a/25025687
type: Comment
score: 0
has text: @Pshemo he just want to simplify it with lesser code.
type: AnswerComment

http://stackoverflow.com/a/25050658
has body: There are 2 work around for solving this problem. It depends on you which you want to prefer. See below : Use LinearLayout &lt;LinearLayout&gt; &lt;TextView ONE/&gt; //assign weight property &lt;TextView TWO/&gt; &lt;/LinearLayout&gt; Use Marquee property Use marquee property to your both textviews, so those'll marquee in particular area
has comment: http://stackoverflow.com/comment/38966542
has comment: http://stackoverflow.com/comment/38965993
score: 0
has comment: http://stackoverflow.com/comment/38965969
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38965891
has comment: http://stackoverflow.com/comment/38965978
accepted answer of: http://stackoverflow.com/q/25050496
type: Answer
answers question: http://stackoverflow.com/q/25050496

http://stackoverflow.com/comment/38733881
score: 0
type: Comment
comment on: http://stackoverflow.com/q/24927475
type: QuestionComment
has text: You need to step the x and y values accordingly...

http://stackoverflow.com/comment/38701474
score: 0
type: Comment
has text: Get the value of the button clicked in the dialog interface and then set that value as the text of the button "spinner_button".
comment on: http://stackoverflow.com/a/24910487
type: AnswerComment

http://stackoverflow.com/q/24926193
has answer: http://stackoverflow.com/a/24933433
has body: How we are able to create the instance of RowSetFactory interface using RowSetProvider class? RowSetFactory rsfactory=RowSetProvider.newFactory(); What is the implementation subclass of RowSetFactory interface and in which package it is available?
type: AnsweredQuestion
has title: RowSetFactory implementation subclass
type: Question
tagged with: jdbc
has comment: http://stackoverflow.com/comment/38773510
accepted answer: http://stackoverflow.com/a/24933433
has comment: http://stackoverflow.com/comment/38745760
score: 0
tagged with: java
answer count: 1
has comment: http://stackoverflow.com/comment/38845093

http://stackoverflow.com/a/24938498
type: AcceptedAnswer
downvote count: 0
has body: The Base64.decode method is returning a byte array, so you can use BitmapFactory's decodeByteArray method to build your bitmap, and set it on your ImageView. Ex: DatabaseHandler db = new DatabaseHandler(this); Car cars = db.getCurrentCar(); byte[] imageData = Base64.decode(cars.get_image(), 0); Bitmap bitmap = BitmapFactory.decodeByteArray(imageData, 0, imageData.length, new BitmapFactory.Options()); ImageView imageView = //find your image view; imageView.setImageBitmap(bitmap);
type: Answer
has comment: http://stackoverflow.com/comment/38757119
score: 4
has comment: http://stackoverflow.com/comment/38757101
accepted answer of: http://stackoverflow.com/q/24938197
upvote count: 4
answers question: http://stackoverflow.com/q/24938197

http://stackoverflow.com/comment/38751934
comment on: http://stackoverflow.com/q/24936915
has text: LogCats are your friend, show us your log please
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24980543
type: Answer
answers question: http://stackoverflow.com/q/24980191
accepted answer of: http://stackoverflow.com/q/24980191
score: 0
type: AcceptedAnswer
has body: The basic problem is the Layout that you have chosen for the project. You can get an in-depth knowledge about layouts, that javafx support over here StackPane stacks all the Nodes that you pass it. I would suggest you to use GridPane inplace of StackPane. GridPane root = new GridPane(); To add the nodes, use root.add(matrix[x][y], y, x); P.S. I would also advice you to rename your buttons, to give you more clarity on button representing row's and column's of the matrix. You can use something as, though its totally optional ! :) matrix[x][y].setText(x + "," + y);

http://stackoverflow.com/comment/38747841
type: Comment
type: QuestionComment
has text: I am trying to iterate the Map. To take first (i = 1) ArrayList (key) and check whether it matches, then second (i =2) etc. Like in case of arrays. I will now look more precisely how to iterate collections correctly.
score: 0
comment on: http://stackoverflow.com/q/24934782

http://stackoverflow.com/a/25065409
type: Answer
answers question: http://stackoverflow.com/q/25048280
has body: The default servlet of Wildfly/Undertow has a list of allowed and disallowed extensions which can be configured in web.xml via init parameters. jar is disallowed by default. Add the following to your web.xml to enable the jar extension: default io.undertow.servlet.handlers.DefaultServlet default-allowed true allowed-extensions jar disallowed-extensions exe,bat,sh
score: 3
has comment: http://stackoverflow.com/comment/39030873
upvote count: 3
accepted answer of: http://stackoverflow.com/q/25048280
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/39025618

http://stackoverflow.com/q/25066106
tagged with: java
tagged with: rsa
has comment: http://stackoverflow.com/comment/39011556
has title: Different file size when encrypting with Bouncy Castle (In Java) and GPG4Win
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/38997976
answer count: 1
has body: Here is the problem: I use Bouncy Castle (Java) library to encrypt a file, but the size of encrypted file that I get is much bigger than when I use other utilities (i.e. GPG4Win, FileAssurity). The encrypted file size that these utilities generate are very small comparing to what my code generates. I am wondering if there are different ways of encrypting when using RSA public keys as opposed DSA ones. Additional info: Public Key Certificate type: 2,047-bit RSA The code that I use to encrypt a data file (file is read and passed as byte array): private static byte[] encrypt(byte[] clearData, PGPPublicKey encKey, boolean withIntegrityCheck, boolean armor) throws IOException, PGPException, NoSuchProviderException { ByteArrayOutputStream encOut = new ByteArrayOutputStream(); OutputStream out = encOut; if(armor) { out = new ArmoredOutputStream(out); } ByteArrayOutputStream bOut = new ByteArrayOutputStream(); PGPLiteralDataGenerator lData = new PGPLiteralDataGenerator(); OutputStream pOut = lData.open(bOut/*cos*/, // the compressed output stream PGPLiteralData.BINARY, PGPLiteralData.CONSOLE, // "filename" to store (if provided) clearData.length, // length of clear data new Date() // current time ); pOut.write(clearData); PGPEncryptedDataGenerator cPk = new PGPEncryptedDataGenerator(PGPEncryptedData.CAST5, withIntegrityCheck, new SecureRandom(), C_BC_PROVIDER_NAME); cPk.addMethod(encKey); byte[] bytes = bOut.toByteArray(); bOut.close(); OutputStream cOut = cPk.open(out, bytes.length); cOut.write(bytes); cOut.close(); out.close(); return encOut.toByteArray(); } // encrypt
has answer: http://stackoverflow.com/a/25070937
favorite count: 0
tagged with: bouncycastle
upvote count: 2
type: UnansweredQuestion
tagged with: encryption
tagged with: size
has comment: http://stackoverflow.com/comment/38998243
score: 1

properties
tags question: http://stackoverflow.com/q/25053710
type: Tag
tags question: http://stackoverflow.com/q/25058405
tag name: properties
tags question: http://stackoverflow.com/q/24955679
tags question: http://stackoverflow.com/q/24920404
tags question: http://stackoverflow.com/q/25031373
tags question: http://stackoverflow.com/q/25052818
tags question: http://stackoverflow.com/q/25019877
tags question: http://stackoverflow.com/q/24962265

http://stackoverflow.com/a/24977728
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38828410
type: Answer
has body: According to PostgreSQL: Documentation: 9.3: Sequence Manipulation Functions, the sequence function currval: Return the value most recently obtained by nextval for this sequence in the current session. (An error is reported if nextval has never been called for this sequence in this session.) Because this is returning a session-local value, it gives a predictable answer whether or not other sessions have executed nextval since the current session did. So you will get the correct value. In another way, the sequences are non-transactional. Each session gets a distinct sequence value. The changes in the sequence can not be undone.
accepted answer of: http://stackoverflow.com/q/24977586
answers question: http://stackoverflow.com/q/24977586

http://stackoverflow.com/comment/38732392
type: AnswerComment
type: Comment
has text: Yes. I can but when i call criteria.list() it throws exception.
comment on: http://stackoverflow.com/a/24926618
score: 0

http://stackoverflow.com/comment/38893008
comment on: http://stackoverflow.com/q/25011968
type: Comment
type: QuestionComment
score: 0
has text: possible duplicate of [No suitable driver found for 'jdbc:mysql://localhost:3306/mysql](http://stackoverflow.com/questions/8146793/no-suitable-driver-found-for-jdbcmysql-localhost3306-mysql) - at least the answers there contain useful information how to solve the problem

http://stackoverflow.com/q/25068699
upvote count: 1
downvote count: 1
type: Question
has title: Nested JSON to POJO
tagged with: jackson
has body: I am trying to call an external RESTful web service and am in need of parsing out response that comes with a nested JSON. I am trying to parse out the following: { "list": [ { "list_id" : "abcdef", "list_name" : "testing123" }, {"list_id" : "xyz", "list_name" : "testing456" }]} My POJO Class looks like this: @JsonIgnoreProperties(ignoreUnknown = true) public class ListGetResponse { private String list = ""; private SMSList lists; public String getList() { return list; } public void setList(String list) { this.list = list; } public SMSList getLists() { return lists; } public void setLists(SMSList lists) { this.lists = lists; } @Override public String toString() { return "SMSListGetResponse [list=" + list + "]"; } @JsonIgnoreProperties(ignoreUnknown = true) public class SMSList { private String list = ""; private String list_id = ""; private String list_name = ""; public String getList() { return list; } public void setList(String list) { this.list = list; } public String getList_id() { return list_id; } public void setList_id(String list_id) { this.list_id = list_id; } public String getList_name() { return list_name; } public void setList_name(String list_name) { this.list_name = list_name; } @Override public String toString() { return "SMSList [list_id=" + list_id + ", list_name=" + list_name + "]"; } } I am calling this function through this method. public void get() { RestTemplate restTemplate = SMSRestFactory.getRestTemplate(); ResponseEntity&lt;ListGetResponse&gt; responseEntity = restTemplate.getForEntity(SMS_LIST_GET, ListGetResponse.class); ListGetResponse body = responseEntity.getBody(); System.out.println(responseEntity.getBody()); System.out.println(body); } When calling get(); I receive the following StackTrace Exception in thread "main" org.springframework.http.converter.HttpMessageNotReadableException: Could not read JSON: Can not deserialize instance of java.lang.String out of START_ARRAY token at [Source: sun.net.www.protocol.http.HttpURLConnection$Ht…
score: 0
has comment: http://stackoverflow.com/comment/39000999
has answer: http://stackoverflow.com/a/25082488
answer count: 1
favorite count: 0
tagged with: spring
accepted answer: http://stackoverflow.com/a/25082488
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39002881
tagged with: java
tagged with: http://stackoverflow.com/tag/json

http://stackoverflow.com/a/25006559
downvote count: 0
has body: You can try to add some print statements to help you debug. For example, before the line that is causing you problems: if(words[i].charAt(j)==rep[num.charAt(j)-48-2][column]) you can try adding a statement such as: System.out.println("The current num is: " + num); If right before the program crashes you see: "The current num is 12", then you know what is wrong because "12".charAt(2) will give you an out of bounds error.
type: Answer
upvote count: 2
answers question: http://stackoverflow.com/q/25006359
score: 2

http://stackoverflow.com/comment/38973620
type: QuestionComment
has text: No, I don't use any IOC container.
comment on: http://stackoverflow.com/q/25054460
score: 0
type: Comment

http://stackoverflow.com/q/25015832
tagged with: instance
tagged with: java
has comment: http://stackoverflow.com/comment/38900182
type: Question
tagged with: variables
has answer: http://stackoverflow.com/a/25015906
has answer: http://stackoverflow.com/a/25015942
score: 0
has comment: http://stackoverflow.com/comment/38900618
has answer: http://stackoverflow.com/a/25015934
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25016725
answer count: 4
has title: Why I can not assign the value in public location in java
has body: public class Test { int a=10; a=20; } why I can not assign the value as above;

http://stackoverflow.com/comment/38780155
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24951393
has text: Thanks .!. , it works with overriding. In the project i'm working on the superclass has a lot of methods returning this and it's useless to override then. i'll stick with the code that works
score: 0

http://stackoverflow.com/comment/38844038
score: 0
comment on: http://stackoverflow.com/a/24986013
type: AnswerComment
type: Comment
has text: Ahh yes thank you. Also I need to create a toString method and pur DrowRanger there?

http://stackoverflow.com/q/24991275
score: 12
answer count: 2
tagged with: rpc
linked to: http://stackoverflow.com/q/27047310
has answer: http://stackoverflow.com/a/37787016
favorite count: 0
has body: I need to implement RPC over STOMP, where the client runs with javascript in a browser, and the server side is implemented using Spring messaging capabilities. While using @MessageMapping is fine for normal messaging, I find using @SendToUser quite limitating for implementing RPC because the client has an hard time to understand which reply is associated with which request in a scenario when multiple simultaneous requests are being made from the client. Of course there is no problem when just only one request is made, and the client waits for its reply, but problems arise when the client has to keep track of multiple "open" rpc calls. I've managed to make the system mostly fine by associating an ID with every request, i.e.: the client sends an id together with the message, and the server replies with a special message wrapper that contains this id, so the client is able to associate asynchronous replies with requests. This works fine but has several limitations: I have to develop code that needs to understand this structure, and that defies the uitlity to have simple annotated methods when the server side code generates an Exception the Spring @MessageExceptionHandler get called and the correct Exception is returned to the client, but the request id is lost because the handler has no (easy) way to access it. I know that with rabbitmq we can add "reply-to" header to every request that needs to be associated with a special reply (the rpc response), and this is implemented by creating a special temporary queue that the user is automatically subscribed to, but how may I use this scheme in Spring? Also, that would tie me a specific broker. How may I elegantly implement a correct RPC call in Spring that correctly handles server side exceptions? I find this a general problem and I think Spring could benefit greatly to implement it natively.
type: UnansweredQuestion
tagged with: spring
has answer: http://stackoverflow.com/a/60997828
has title: RPC over STOMP using Spring, and correctly handling server side errors propagated to clients
tagged with: java
has comment: http://stackoverflow.com/comment/39052723
type: Question
upvote count: 12
tagged with: stomp
tagged with: spring-websocket
downvote count: 0

http://stackoverflow.com/a/25048106
has comment: http://stackoverflow.com/comment/39023575
accepted answer of: http://stackoverflow.com/q/25047289
answers question: http://stackoverflow.com/q/25047289
has comment: http://stackoverflow.com/comment/38989286
score: 0
has comment: http://stackoverflow.com/comment/81484558
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/81482006
type: Answer
has comment: http://stackoverflow.com/comment/38989807
has body: The answers to which you've linked are out of date. As of Java 1.7 (which came out in 2011), you should be copying files this way: Path afile = Paths.get("C:\\Users\\Documents\\testblankfiles\\xxxxxxxxxxxxx2.txt"); Path bfile = Paths.get("C:\\Users\\Documents\\testblankfilesdest\\2012\\xxxxxxxxxxxxx2.txt"); Files.copy(afile, bfile); And you should be moving files this way: Path afile = Paths.get("C:\\folderA\\Afile.txt"); Files.move(afile, Paths.get("C:\\folderB", afile.getFileName().toString())); Notice that Files.move doesn't return a value because, in proper object-oriented fashion, it throws an IOException if the move fails, unlike the ancient File.renameTo method. JB Nizet is correct about determining your destination folders: Use the charAt (or substring) method on the result of Path.getFileName().toString(). To go through all the files in a directory, use a DirectoryStream: try (DirectoryStream&lt;Path&gt; dir = Files.newDirectoryStream( Paths.get("C:\\Users\\Documents\\TestBlankFiles"))) { for (Path file : dir) { String name = file.getFileName().toString(); if (!Files.isDirectory(file) &amp;&amp; name.length() &gt;= 14) { char yearDigit = name.charAt(13); Path destDir = Paths.get( "C:\\Users\\Documents\\TestBlankFiles\\201" + yearDigit); Files.createDirectories(destDir); Files.move(file, destDir.resolve(name)); } } }
has comment: http://stackoverflow.com/comment/38994378

http://stackoverflow.com/a/25020318
type: Answer
answers question: http://stackoverflow.com/q/25018328
score: 0
has comment: http://stackoverflow.com/comment/38908993
has body: $http.get returns a promise, the simple thing to do is to resolve the promise in your controller... not in a factory. Meaning no .success() in your factory... only in the controller If you need this in the service... it would be like so: servicesModule.factory('ApiRef', function($resource, EnvVarApi){ var url = null; // this is ASYNC, meaning it will got to the return statement below and wait until the promise is resolved to assign the url EnvVarApi.getUrlApi('APIREF_KEY', function(data) { if (data) { url = data.valeur; $resource(url, {'cle' : '@cle'}, { // url defined here, gets put correctly put : {method : 'PUT'} }); } }); return $resource(url, {'cle' : '@cle'}, { put : {method : 'PUT'} }); });

http://stackoverflow.com/a/24923189
answers question: http://stackoverflow.com/q/24923159
has comment: http://stackoverflow.com/comment/38726277
has comment: http://stackoverflow.com/comment/38726477
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38726428
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/38726366
has body: Your problem is that even though you're using a SwingWorker, you immediately turn around and tell the UI to wait for it (worker.get()). Instead, your worker should use a callback--when its work is done, it should invoke some action, probably on the event thread, that tells the UI to do the next thing.
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/38726543
accepted answer of: http://stackoverflow.com/q/24923159

http://stackoverflow.com/a/25002510
has body: Bytecodes are counted only inside the interpreter, not in JIT-compiled code. Try -Xint The bytecode counter of HotSpot JVM is not thread-safe. It was never meant to be exact.
has comment: http://stackoverflow.com/comment/38926357
score: 0
answers question: http://stackoverflow.com/q/24996509
type: Answer

http://stackoverflow.com/comment/38775194
type: AnswerComment
has text: Glad to help you and if you carefully check your log error then you getting why is it not working.
type: Comment
comment on: http://stackoverflow.com/a/24948985
score: 0

http://stackoverflow.com/comment/38887867
type: QuestionComment
has text: But I have just made a Test code that make frame Transparent which is working for the Windows but not for Linux..I am able to click through the frame in windows but not in Linux
score: 0
comment on: http://stackoverflow.com/q/25009276
type: Comment

http://stackoverflow.com/q/24962937
has title: Unchecked cast: 'java.io.Serializable' to 'java.util.ArrayList<android.app.Fragment>'
score: 2
tagged with: unchecked-cast
answer count: 1
favorite count: 0
type: UnansweredQuestion
tagged with: android
has body: I am getting an unchecked cast warning and I am not sure if it is safe to suppress it. I am putting an ArrayList&lt;Fragment&gt; inside a Bundle. This Bundle is then put in my Intent as following: Intent mIntent = new Intent(getBaseContext(),MySecondActivity.class); Bundle myBundle = new Bundle(); myBundle.putSerializable("fragmentList",ArrayList&lt;Fragment&gt;); mIntent.putExtras(myBundle); startActivity(mIntent); Then on my new activity (MySecondActivity) I am retrieving this data with the following code: (ArrayList&lt;Fragment&gt;) getIntent().getSerializableExtra("fragmentList") My compiler gives me the following warning: " Unchecked cast: 'java.io.Serializable' to 'java.util.ArrayList' " Everything is working fine though, am I right to say I can safely suppress it? Thank you!
has comment: http://stackoverflow.com/comment/38800875
has answer: http://stackoverflow.com/a/24963219
has comment: http://stackoverflow.com/comment/38801265
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/38805947
downvote count: 1
type: Question

http://stackoverflow.com/q/24919222
type: Question
tagged with: configuration
has answer: http://stackoverflow.com/a/24919291
has title: Configuring Jenkins with Bitbucket URL
score: 0
answer count: 1
tagged with: jenkins
type: UnansweredQuestion
tagged with: maven
tagged with: git
has body: I am trying to configure a maven job to run in jenkins - I have been getting the following error for some time now (with other variations dependant on what I change) Failed to connect to repository : Failed to connect to https://bitbucket.org/rickilambert/secondstoryuk/Core.git using credentials (status = 404) I have tried many variations of connection URL inclusive of the 2 most recommended on stack overflow https://&lt;user&gt;:&lt;pass&gt;@bitbucket.org/&lt;user&gt;/&lt;project&gt;.git https://bitbucket.org/&lt;username&gt;/&lt;project&gt;.git Both to no avail - has anyone come across an error like this before or indeed have any idea how to fix it? For reference Jenkins is running the GIT plugin version 2.2.2 Thanks
has comment: http://stackoverflow.com/comment/38718945
tagged with: java

http://stackoverflow.com/q/25057147
tagged with: user-interface
possible better answer: http://stackoverflow.com/a/25057577
has body: I followed a tutorial on how to read from a text file to a JTextField. It has been a few hours that I keep getting the same error when I run the program: ** Exception in thread "main" java.util.NoSuchElementException at java.util.Scanner.throwFor(Scanner.java:907) at java.util.Scanner.next(Scanner.java:1416) at demo.Demo.Read(Demo.java:26) at demo.DemoSwing.main(DemoSwing.java:42) ** Here is the code that I am currently using: package demo; import java.io.*; import java.util.Scanner; public class Demo { Scanner scan; static String Name, Surname; public void open() { try { scan = new Scanner(new File("C:/cygwin/home/James/Demo/src/team1.txt")); System.out.println("it is working"); }catch (FileNotFoundException e){ System.out.println("it is not working"); } } public void Read() { do { Name = scan.next(); Surname = scan.next(); } while(scan.hasNext()); System.out.println(Name + Surname); scan.close(); } } package demo; import javax.swing.*; import java.awt.*; importjava.awt.event.ActionEvent; import java.awt.event.ActionListener; public class DemoSwing implements ActionListener { private JTextField T = new JTextField(30); private JTextField T1 = new JTextField(30); private JFrame f = new JFrame("Demo"); private JButton B = new JButton("View"); // Static variable static String N, S; public DemoSwing(){ f.add(new JLabel("Name")); T.setEditable(false); f.add(T); f.add(new JLabel("Surname")); T1.setEditable(false); f.add(T1); B.addActionListener(this); f.add(B); // JFrame f.setLayout(new FlowLayout()); f.setSize(300,100); f.setVisible(true); } public static void main (String[] args){ new DemoSwing(); Demo f = new Demo(); f.open(); f.Read(); } public void actionPerformed(ActionEvent e){ if(e.getSource()== B) { T.setText(N); T1.setText(S); } } }
type: AnsweredQuestion
tagged with: java.util.scanner
has title: Reading from text file to a JTextfield
tagged with: java
has comment: http://stackoverflow.com/comment/38977827
tagged with: swing
type: Question
has comment: http://stackoverflow.com/comment/38977732
has comment: http://stackoverflow.com/comment/38978112
has answer: http://stackoverflow.com/a/25057450
accepted answer: http://stackoverflow.com/a/25057450
has answer: http://stackoverflow.com/a/25057577
score: 0
answer count: 2

http://stackoverflow.com/a/25135369
accepted answer of: http://stackoverflow.com/q/25031545
answers question: http://stackoverflow.com/q/25031545
type: AcceptedAnswer
has body: You can add your JDK installation into update-alternative manually. How you can achieve that: download JDK you need, e.g. jdk-6u45-linux-x64.bin extract it; for example, chmod +x jdk-6u45-linux-x64.bin &amp;&amp; ./jdk-6u45-linux-x64.bin move it in the place you want; personally I prefer /opt, so sudo mv jdk1.6.0_45 /opt you can skip this step, but I'd recommend using symbolic links sudo ln -fs /opt/jdk1.6.0_45 /opt/jdk1.6 add manually this version sudo update-alternatives --install /usr/bin/java java /opt/jdk1.6/bin/java 1 Note: I'm using symbolic links there. Then you can always change current JDK with sudo update-alternatives --config java. And then you can check current version of Java being used in the system. >java - version java version "1.6.0_45" Java(TM) SE Runtime Environment (build 1.6.0_45-b06) Java HotSpot(TM) 64-Bit Server VM (build 20.45-b01, mixed mode) More information you can find in manual page of update-alternatives.
downvote count: 0
score: 1
type: Answer
upvote count: 1

http://stackoverflow.com/comment/38903118
has text: The goal is to understand what is the state of the art in client side encryption, not simply to get some opinions. Thanks for your feedback.
score: 0
comment on: http://stackoverflow.com/q/25017117
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38858862
type: QuestionComment
has text: i got this error "Error:Unable to bind to locking port 7054 within 45000 ms".. Is there any solution around this?
comment on: http://stackoverflow.com/q/24990015
score: 0
type: Comment

http://stackoverflow.com/comment/38704183
has text: This is indeed what I'm looking for. I don't need the bottom part, just basically a flow layout at the top and a grid layout below that it seems. But for some reason can't get it to work. Thanks for the help though
comment on: http://stackoverflow.com/a/24911594
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/25006682
downvote count: 3
answer count: 1
has comment: http://stackoverflow.com/comment/38882780
score: -3
has body: Sutck on a Code Challenge on refactoring Android Code. Refactor the code inside the two onClick() methods into a common method named trackButtonPress(). Make it a public method of MainActivity.java. public class MainActivity extends Activity { public static final String TAG = MainActivity.class.getSimpleName(); public Button mButton1; public Button mButton2; /* * Some code has been omitted for brevity */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mButton1 = (Button)findViewById(R.id.button1); mButton2 = (Button)findViewById(R.id.button2); trackButtonPress(); } mButton1.setOnClickListener(new View.OnClickListener() { trackButtonPress(); } } mButton2.setOnClickListener(new View.OnClickListener() { trackButtonPress(); } } public void trackButtonPress() { public void onClick(View view) { Toast.makeText(MainActivity.this, "A button was pressed", Toast.LENGTH_LONG).show(); Log.i(TAG, "A button was pressed"); } } HELP PLEASE!!!
has answer: http://stackoverflow.com/a/25007384
type: AnsweredQuestion
upvote count: 0
tagged with: android-activity
favorite count: 0
has comment: http://stackoverflow.com/comment/38883895
has comment: http://stackoverflow.com/comment/38883329
type: Question
tagged with: android
accepted answer: http://stackoverflow.com/a/25007384
has title: Refactor the code inside the two onClick() methods into a common method
tagged with: java

http://stackoverflow.com/comment/39185855
has text: the absolute path of the word file probably is "/usr/local/tomcat/webapps/www.ssoft.com/docs/wordfile.doc".
comment on: http://stackoverflow.com/a/25003267
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/38965281
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25050238
type: Comment
has text: You should just vote to close as a duplicate.

http://stackoverflow.com/a/30316508
score: 0
answers question: http://stackoverflow.com/q/24980364
type: Answer
has body: @Controller annotation is missing for your controller class.

http://stackoverflow.com/comment/38819884
score: 0
comment on: http://stackoverflow.com/q/24969545
has text: @DavidPostill It has to be *a* complete code sample, but it should not be *the* complete code
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24963620
has comment: http://stackoverflow.com/comment/38802182
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38802400
has comment: http://stackoverflow.com/comment/38802295
tagged with: java
downvote count: 7
has body: What is the difference between ArrayList and LinkedList? I watched a video on it by TheNewBoston but i am still confused. Please answer in a short form and in plain English. Please do not use any advanced code.
has comment: http://stackoverflow.com/comment/38802376
type: Question
has comment: http://stackoverflow.com/comment/38802234
has comment: http://stackoverflow.com/comment/38802179
possible better answer: http://stackoverflow.com/a/24963668
has comment: http://stackoverflow.com/comment/38802278
answer count: 2
duplicate of: http://stackoverflow.com/q/322715
has comment: http://stackoverflow.com/comment/38802343
has title: ArrayList vs LinkedList Java
favorite count: 0
has comment: http://stackoverflow.com/comment/38802200
has answer: http://stackoverflow.com/a/24963651
accepted answer: http://stackoverflow.com/a/24963651
has comment: http://stackoverflow.com/comment/38802302
has answer: http://stackoverflow.com/a/24963668
score: -3
upvote count: 4
linked to: http://stackoverflow.com/q/322715

http://stackoverflow.com/comment/131116211
type: QuestionComment
has text: Does not applying `application` also implicitly applies `java` plug-in?
score: 0
comment on: http://stackoverflow.com/q/24924932
type: Comment

http://stackoverflow.com/q/25044227
tagged with: java
has body: I assume I have an error in my code, but I can't find which one I have three nodes : a, b and c there are linked so (a)-[r1]->(b)&lt;-[r2]-(c) (I'm 100% sure of this, I checked with neo4j Community) But my Program can only find the first and the last one. The second one, b, is always ignored. Here is my method : static List&lt;Node&gt; getNodes(Node startNode,final Node endNode,boolean uniqueResult,List&lt;RelationshipType&gt; relationshipTypes) { List&lt;Node&gt; result=new ArrayList&lt;&gt;(); try(Transaction tx=getInstance()._graph.beginTx()) { TraversalDescription td = getInstance()._graph.traversalDescription().breadthFirst(); for(RelationshipType relationshipType:relationshipTypes) td=td.relationships(relationshipType); td=td.evaluator(Evaluators.excludeStartPosition()); if(!uniqueResult) td=td.uniqueness(Uniqueness.NODE_PATH); td=td.evaluator(new Evaluator() { @Override public Evaluation evaluate(Path path) { boolean isEndNode=path.endNode().equals(endNode); return Evaluation.of(isEndNode, !isEndNode); } }); Traverser tr=td.traverse( startNode ); for(Path path:tr) result.add(path.endNode()); tx.success(); } return result; } startNode is a endNode is c uniqueResult is true (but I tried with false, no change) relationShipTypes contains r1 and r2. I have no clue, why it doesn't work Thanks for your help
has comment: http://stackoverflow.com/comment/38961288
type: Question
has title: neo4j : Traverser only get first and last node
tagged with: traversal
upvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/38954640
tagged with: neo4j
favorite count: 0
has answer: http://stackoverflow.com/a/25054987
accepted answer: http://stackoverflow.com/a/25054987
type: AnsweredQuestion
downvote count: 0
score: 1

http://stackoverflow.com/a/24949703
score: 3
answers question: http://stackoverflow.com/q/24949497
accepted answer of: http://stackoverflow.com/q/24949497
type: AcceptedAnswer
downvote count: 0
has body: It will require web-services, You can not access your MySqlSQL/Oracle database from Your application. just because of all of these database are deployed some other environment , and can not deploy huge database like MySQL on a mobile environment. So that you need to use web-services for accessing those database(MySQL/Oracle). WebServices: Just kind of a mechanism which call some server side script like PHP, ASP, JSP etc. All these script have API for accessing your MySQL database. finally this script will return result in form JSON/XML to your application. through HTTP connection. YourAPP ->It Will execute some peace code which talk to your server (Calling web services-> getStudent()-) Server -> *It will execute something like getStudent()- "select * from student" - > Budle data into json/xml formet. - > return as response to your App.* YourApp -> callback(Student data) -> it will get response. Web- Services tutorials
type: Answer
upvote count: 3

http://stackoverflow.com/comment/38921951
comment on: http://stackoverflow.com/q/25026476
has text: Indeed; that so happens to be the case, and apparently there is no way to do that except read a bunch of chars until you hit a null char - which brings me to another question: what if there is a null char in the text. I could keep reading to see if there are 100 or so concurrent null chars I guess, but it raises a fair point that you can't really just look for a null char.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24947561
answer count: 3
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/24947831
tagged with: design-patterns
possible better answer: http://stackoverflow.com/a/24947694
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24947694
score: 1
tagged with: java
upvote count: 1
has title: What would be an efficient design for this use case
has answer: http://stackoverflow.com/a/24947757
type: Question
accepted answer: http://stackoverflow.com/a/24947831
has body: I have a use case where I am starting a timer on a particular method to see if it takes more than x seconds . If so, I am logging a fatal in our logs as follows. private boolean isDpxTimedOut(StopWatch stopWatch) { stopWatch.stop(); long elapsedTime = stopWatch.getNanoTime(); Double elapsedTimeInSeconds = elapsedTime/NANO_DIVISOR; return (elapsedTimeInSeconds &gt;= DPX_TIMEOUT_VALUE); } public void callDPX() { try{ StopWatch stopWatch = new StopWatch(); //body of the method } catch(Exception e) { e.printStackTrace(); } finally { //putting a check here to see if DPX timed out and then logging a FATAL. if(isDpxTimedOut(stopWatch)) { log.fatal("[DPX TIMEOUT] The request took more than 12 seconds."); } } Now I have a use case where I have to put this stoip watch on multiple methods in different classes. How should I design that?. The timeouts for different classes will be diffrent and should be read from a Config file. Can someone point me to a good design for this use case.
has comment: http://stackoverflow.com/comment/38772266

http://stackoverflow.com/q/25005404
tagged with: java
has answer: http://stackoverflow.com/a/25238064
has title: Advantages of Maven Tycho over Eclipse PDE Tools for exporting RCP
has comment: http://stackoverflow.com/comment/39316081
downvote count: 0
type: UnansweredQuestion
tagged with: eclipse-rcp
score: 1
has body: In the light of some recent issues regarding JavaFX and exporting an Eclipse RCP application, I'm considering abandoning the Eclipse PDE exporter, and switching to a Tycho build. Which approach is simpler, and which is over-complicated? Do I need to constantly tweak the Tycho build configuration? Current project is already using ant scripts to build a core EAR. Should that be built with Maven to be consistent? I'm aware of some issues between Maven and Eclipse Plug-ins. Is there anything critical I should be worried about? I'm in heavy R&amp;D mode. Also, I don't consider this to be opinion-based, rather a topic asking for strong arguments in favour of each one of these two.
tagged with: eclipse-plugin
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25010461
answer count: 2
tagged with: maven
upvote count: 1
tagged with: tycho

http://stackoverflow.com/q/25000434
accepted answer: http://stackoverflow.com/a/25006301
answer count: 1
downvote count: 0
favorite count: 0
upvote count: 1
tagged with: tomcat7
has body: Hello I am having troubles 'serving' resources with my web server, while some of my other resources are 'serving.' (graphs.js is loading) In my browser console: GET http://localhost:8080/js/app.js [HTTP/1.1 400 Bad Request 2ms] GET http://localhost:8080/includes/header.html [HTTP/1.1 400 Bad Request 4ms] GET http://localhost:8080/cs/bootstrap.min.css [HTTP/1.1 400 Bad Request 3ms] But these files are located in my directory as such: css/ bootstrap.min.css includes/ header.html js/ app.js controllers/ graphs.js When my server starts: 2014-07-28 08:25:06.748 INFO 5260 --- [ main] .t.TomcatEmbeddedServletContainerFactory : Server initialized with port: 8080 2014-07-28 08:25:06.939 INFO 5260 --- [ main] o.apache.catalina.core.StandardService : Starting service Tomcat 2014-07-28 08:25:06.940 INFO 5260 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet Engine: Apache Tomcat/7.0.52 2014-07-28 08:25:07.017 INFO 5260 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext 2014-07-28 08:25:07.017 INFO 5260 --- [ost-startStop-1] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 1146 ms 2014-07-28 08:25:07.346 INFO 5260 --- [ost-startStop-1] o.s.b.c.e.ServletRegistrationBean : Mapping servlet: 'dispatcherServlet' to [/] **mapping** 2014-07-28 08:25:07.903 INFO 5260 --- [ main] o.s.w.s.c.a.WebMvcConfigurerAdapter : Adding welcome page: jndi:/localhost/index.html 2014-07-28 08:25:07.905 INFO 5260 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Root mapping to handler of type [class org.springframework.web.servlet.mvc.ParameterizableViewController] 2014-07-28 08:25:07.912 INFO 5260 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler] 2014-07-28 08:25:07.912 INFO 5260 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/webjars/*…
tagged with: spring
type: AnsweredQuestion
tagged with: spring-boot
score: 1
has title: Web App not serving static resources using Spring Boot and Tomcat
tagged with: java
has answer: http://stackoverflow.com/a/25006301
type: Question
tagged with: tomcat

http://stackoverflow.com/a/25055266
type: Answer
has comment: http://stackoverflow.com/comment/38975859
downvote count: 0
has body: Depends on how often it will be called. If you declare it outside of the method then Javas escape analysis will flag it and surround it with locking code when compiled to byte code, meaning it is less efficient. Declaring it inside the method will create a new String every time it is called, which could be just as inefficient if it is called a lot. So basically either way is fine, these are just things to be aware of. To spot which is faster you'd probably need to profile it. Also Your code wont compile. ;)
score: 2
upvote count: 2
accepted answer of: http://stackoverflow.com/q/25054866
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25054866
has comment: http://stackoverflow.com/comment/38974936

http://stackoverflow.com/a/24981832
upvote count: 6
has body: Yes, assuming multiple threads are interacting with the set, and at least one is modifying, there are concurrency concerns. In particular, you mention multiple threads doing the add operation, which is definitely going to cause problems - worse however, they may not raise ConcurrentModificationExceptions. The purpose of ConcurrentModificationException is to alert you to clearly erroneous concurrency issues, such as attempting to remove an item from a collection as you iterate over it (it's unclear what the collection should even do, in such a case). However the exception can only be raised when the collection is aware of the erroneous modification. Since the collection is not thread-safe it explicitly does not guarantee multi-threaded operations will be done correctly, and you are expected to take care of manually protecting the collection yourself. The easiest, though least efficient, way to do this is to wrap the set with Collections.synchronizedSortedSet() before using it, i.e.: SortedSet synchronizedSet = Collections.synchronizedSortedSet(new TreeSet()); This ensures that each method call will be done in serial, that is to say they will block waiting for any earlier calls to finish. However as such, you essentially lose most of the benefits of multi-threading. Another alternative is to use an explicitly thread-safe SortedSet, namely ConcurrentSkipListSet: This implementation provides expected average log(n) time cost for the contains, add, and remove operations and their variants. Insertion, removal, and access operations safely execute concurrently by multiple threads. This implementation allows you to interact with the set from multiple threads without further concern. That isn't to say it is the best way to implement the behavior you're looking for, but given what you've described - add and access the maximum value in a sorted set from multiple threads - it's what you're looking for. See also: When is a ConcurrentSkipListSet useful?
downvote count: 0
has comment: http://stackoverflow.com/comment/38837983
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38838358
accepted answer of: http://stackoverflow.com/q/24981551
has comment: http://stackoverflow.com/comment/38837471
answers question: http://stackoverflow.com/q/24981551
type: Answer
score: 6

http://stackoverflow.com/comment/38966788
comment on: http://stackoverflow.com/q/25051031
type: Comment
type: QuestionComment
score: 0
has text: @SubhrajyotiMajumder i am not getting other printouts out-of-seq even..!

http://stackoverflow.com/a/25048144
has body: When a program starts it's an empty room before a party. Then Alice comes in with her tote bag and starts cleaning things up. After some time, Alice rings Bob up and later Bob comes to help Alice in the kitchen. Alice and Bob prepare some sweets, and after a while Steve and Sarah knock at the door with some beer and chips. Alice, Bob, Steve and Sarah are threads. Alice is the main thread because she organized the party. Sweets, beer and chips are the objects. Note that Steve brought the chips, but Alice can eat them, too! Sarah was responsible for the beers, but others can certainly drink. It doesn't matter who (which thread) brought what (created object) to the party: memory is shared among threds. Now, let's examine how your Alice works. The main thread of an Android application is an event loop, that can be seen as: while (running) { if (input != null) dispatch(input); sleepForSomeTime(); } The call to dispatch() will finally reach your listeners code, so that it's executed on the same thread that handles the touch event. It doesn't matter who created the objects, who registered the listeners and so on. I think it's not the case for your application, but one may actually need to process events in a pool of background threads. This is accomplished by giving your threads a queue of tasks to be done, and by having your event-driven code update that queue (or you can use the executors framework in java.util.concurrent) As a note, you should not start threads inside your constructors because some objects may be seen before they are fully constructed (if you use an inner class or an anonymous one) the purpose of a constructor is to initialize fields. The creation of a background thread should be handled by the user of the newly constructed object
score: 0
type: Answer
answers question: http://stackoverflow.com/q/25047083

http://stackoverflow.com/comment/38845136
comment on: http://stackoverflow.com/a/24976236
type: Comment
has text: `well I tried...` you tried what? Where is your [SSCCE](http://sscce.org/) that shows what you tried? Remember when you ask a question we don't have access to your database. So when you try to understand a new concept then use hardcoded data so everybody can test your code.
type: AnswerComment
score: 0

http://stackoverflow.com/q/24963807
has comment: http://stackoverflow.com/comment/38802710
tagged with: java
has comment: http://stackoverflow.com/comment/38803160
has comment: http://stackoverflow.com/comment/38802755
type: Question
has comment: http://stackoverflow.com/comment/38803040
has comment: http://stackoverflow.com/comment/38802589
has answer: http://stackoverflow.com/a/24966541
has comment: http://stackoverflow.com/comment/38802898
has title: Is there a way to draw shapes on a JPanel from another method inside same class?
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/24963985
has comment: http://stackoverflow.com/comment/38802853
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24964239
tagged with: swing
has comment: http://stackoverflow.com/comment/38802933
has body: I am working to develop a GUI in which I paint some 2D shapes repeatedly on different locations. Currently I am having a method createGUI() that creates the basic layout and the panels and then I call the constructor for the content_panel to create 2D shapes in the content_panel. But, I want to use another method to create the shapes in the main JPanel. Is there a way in Java, so that I can have two method calls in main. First method createGUI() creates the GUI including JFrames and JPanel. While the second method createShapes() creates shapes in the one specific JPanel - content_panel. I would like to call this createShapes() method repeatedly and pass different arguments to see shapes at different locations. Please let me know if you need some more info or the question is unclear. Thanks Code: import java.awt.*; import java.util.*; import javax.swing.*; public class Board{ public static void main(String[] args) { createGUI(); drawShapes(); } //This method creates the basic GUI private static void createGUI() { //Creating the JFrame main window JFrame mainFrame = new JFrame(); mainFrame.setSize(800, 500); mainFrame.setTitle("Particle Filter"); mainFrame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); mainFrame.setLocation(100, 100); mainFrame.getContentPane().setLayout(new BoxLayout(mainFrame.getContentPane(), BoxLayout.X_AXIS)); //creates two panels content and sidebar. Sidebar has null layout JPanel content = new JPanel(); content.setPreferredSize(new Dimension(700,500)); content.setBackground(Color.LIGHT_GRAY); mainFrame.getContentPane().add(content); JPanel sidebar = new JPanel(); sidebar.setBackground(Color.LIGHT_GRAY); sidebar.setPreferredSize(new Dimension(100,500)); mainFrame.getContentPane().add(sidebar); sidebar.setLayout(null); //creates three buttons in sidebar JButton start_button = new JButton("START"); start_button.setBounds(10, 75, 77, 23); sidebar.add(start_button); JButton stop_button = new JButton("STOP"); stop_button.setBounds(10, 109, …
has comment: http://stackoverflow.com/comment/38803006
has comment: http://stackoverflow.com/comment/38802733

http://stackoverflow.com/a/25058182
score: 0
answers question: http://stackoverflow.com/q/25058094
type: AcceptedAnswer
type: Answer
has body: The problem with a Queue in this case is that it is not designed to be traversed more than once. I suggest switching to a sorted List. I think what is happening is that it is being drawn once which empties the Queue and any subsequent refresh, redraw or redering sees an empty Queue
accepted answer of: http://stackoverflow.com/q/25058094

http://stackoverflow.com/comment/38810279
type: QuestionComment
score: 1
has text: Can you post the screen shot of you enviroment variables?
comment on: http://stackoverflow.com/q/24968031
type: Comment

http://stackoverflow.com/q/24976711
has comment: http://stackoverflow.com/comment/38878248
tagged with: java
has title: Getting and passing structs by value in Clojure with JNA
type: Question
tagged with: struct
has body: I have a C API that I'm trying to use within Clojure, through the JNA API. My issue can best be demonstrated with the following example. Say I have this C code in a library: typedef struct { int foo; int bar; double baz; } MyStruct; MyStruct createStruct() { MyStruct myStruct; myStruct.foo = 3; myStruct.bar = 4; myStruct.baz = 3.14; return myStruct; } double addStruct(MyStruct myStruct) { return myStruct.foo + myStruct.bar + myStruct.baz; } In this example, I'd like to call createStruct, and then pass that result to addStruct. The important point here is that MyStruct is passed by value as both a return type and an argument. At no point do I need to actually read the values of the fields in MyStruct. Additionally, in my system, native functions are wrapped like this: ; `quux` is defined in `some-lib` and returns an `int` (let [fn- (com.sun.jna.Function/getFunction "some-lib" "quux")] (fn [&amp; args] (.invoke fn- Integer (to-array args)))) The goal is to get a type to substitute for Integer above that will wrap MyStruct as a value. The only resource that I've found covering this subject is this article, but it only discusses how to pass structs by reference. Given that, here are the different approaches I've tried to take to solve this problem: Create a class that inherits from Structure, which is JNA's built-in mechanism for creating and using structs. Given the information on that page, I tried to create the following class using only Clojure: class MyStruct extends Structure implements Structure.ByValue { int foo; int bar; double baz; } deftype doesn't work for this scenario, since the class needs to inherit from the abstract class Structure, and gen-class doesn't work because the class needs to have the public non-static fields foo, bar and baz. From what I can tell, none of the standard Clojure Java interop facilities can create the above class. Create a class that inherits from Structure and override the struct field getter/setter methods. Since gen-class is (…
score: 5
downvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/25008510
accepted answer: http://stackoverflow.com/a/25008510
tagged with: pass-by-value
has comment: http://stackoverflow.com/comment/38838694
favorite count: 0
has comment: http://stackoverflow.com/comment/38877744
tagged with: jna
upvote count: 5
has comment: http://stackoverflow.com/comment/38878371
tagged with: clojure
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38839967

http://stackoverflow.com/comment/38711165
type: Comment
has text: @Adam Please read my comments and you will get to know the problem
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24914329

http://stackoverflow.com/comment/38883089
type: QuestionComment
has text: See [The Use of Multiple JFrames, Good/Bad Practice?](http://stackoverflow.com/q/9554636/418556)
score: 1
comment on: http://stackoverflow.com/q/25003990
type: Comment

http://stackoverflow.com/comment/38714033
has text: looks like it's getting the tables for the "system" schema (or whatever)
comment on: http://stackoverflow.com/q/24916471
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38814597
comment on: http://stackoverflow.com/a/24969070
score: 0
has text: OK, great. - For your info: The code shown here was run with your XML sample and worked fine.
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/38872856
comment on: http://stackoverflow.com/q/24999490
has text: I will post it as an answer since it will take up more than a comment will allow
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24952292
type: UnansweredQuestion
has body: I am using Jhipster to develop a Spring application. When I need to deploy, I use mvn -Pprod package. This command generates 2 War files: xxx.war and xxx.original.war. I deploy the xxx.original War file in a local Tomcat. Although I am convinced this is the right procedure, the application is still behaving as when the DEV profile is used. Is the production mode supported or not ?
downvote count: 1
tagged with: spring-boot
tagged with: java
has answer: http://stackoverflow.com/a/67973354
type: Question
upvote count: 4
tagged with: jhipster
favorite count: 0
answer count: 3
score: 3
has answer: http://stackoverflow.com/a/37828011
has title: Production mode not enabled in Jhipster Application
has answer: http://stackoverflow.com/a/26403975

http://stackoverflow.com/comment/38800809
comment on: http://stackoverflow.com/q/24960771
type: Comment
type: QuestionComment
score: 0
has text: @ThorbjørnRavnAndersen I've verified that the response is not cached. The REST framework (which I have excluded to simplify) should not interfere because the class expose exactly the same functional behavior in the three methods. The only difference is the implementation, which is visible only to the JVM.

http://stackoverflow.com/a/24910591
type: Answer
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/38701887
downvote count: 0
has comment: http://stackoverflow.com/comment/38702206
answers question: http://stackoverflow.com/q/24910541
has body: The compiler error is because you passed three arguments, when the method requires four. The following code would compile: purchase(isbn, price, copies, books); However, your code looks wrong in other ways, since you've assigned no values to isbn, price or copies. Your Bookclass already contains theses values, so you only need to supply an array of Book objects to your print method. E.g. change your purchase method to: public static Book[] purchase(Book[] books) { int itemsSold = 0; double totalMade = 0; Scanner input = new Scanner(System.in); int desiredCopies = 0; System.out .println("Please enter the ISBN number of the book you would like to purchase: "); String desiredIsbn = input.next(); for (int index = 0; index &lt; books.length; index++) { if (!books[index].getISBN().equals(desiredIsbn)) System.out.println("We do not have that book in our inventory."); if (books[index].getISBN().equals(desiredIsbn) &amp;&amp; books[index].getCopies() == 0) System.out.println("That book is currently out of stock."); if (books[index].getISBN().equals(desiredIsbn) &amp;&amp; books[index].getCopies() &gt; 0) { System.out .println("How many copies of this book would you like to purchase?"); desiredCopies = input.nextInt(); } if (desiredCopies &gt; books[index].getCopies()) System.out.println("We only have " + books[index].getCopies() + "in stock. Please select another quantity: "); desiredCopies = input.nextInt(); // copies = copies - desiredCopies double total = books[index].getPrice() * desiredCopies; System.out.println("Thank you for your purchase, your order total is: $" + total); itemsSold += desiredCopies; totalMade += total; // update array System.out.print(books[index]); System.out.println("We sold " + itemsSold + " today."); System.out.println("We made $" + totalMade + "today."); } return books; } Some other notes: Try a for-each loop, e.g. for (Book book : books) { Consider using a currency type rather than a double. Don't declare variables before you need them.

http://stackoverflow.com/comment/38732407
comment on: http://stackoverflow.com/q/24926507
score: 0
type: Comment
type: QuestionComment
has text: how to retrieve stored procedure contents to .txt file in oracle sql

http://stackoverflow.com/q/24991805
type: AnsweredQuestion
tagged with: java
has body: i'm trying to make insert call to add row to my table in sqlite code, every time insert return 1, and also after i insert row i check that the row was insert and it can't be found. here is my code: create tables: public void onCreate(SQLiteDatabase db) { // TODO Auto-generated method stub // create table artists String createTableStatement1 = "CREATE TABLE " + TABLE_ARTISTS +" ("+ KEY_ID + " INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL UNIQUE , " + KEY_ARTIST_NAME + " TEXT UNIQUE , " + KEY_ARTIST_IMAGE + " BLOB, " + KEY_ARTIST_JSON + " TEXT, " + KEY_ARTIST_DATE + " DATETIME DEFAULT (datetime('now')), " + KEY_ARTIST_FLAG + " INTEGER NOT NULL DEFAULT 1);"; db.execSQL(createTableStatement1); //creat table users String createTableStatement2 = "CREATE TABLE "+ TABLE_USERS + " ("+ KEY_USER_ID + " INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL UNIQUE, " + KEY_PROFILE_ID + " TEXT UNIQUE, " + KEY_PROFILE_JSON + " TEXT, "+ KEY_PROFILE_IMAGE + " BLOB, " + KEY_PROFILE_FLAG + " INTEGER NOT NULL);"; db.execSQL(createTableStatement2); } upgrade tables @Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { // TODO Auto-generated method stub // Drop older table if existed db.execSQL("DROP TABLE IF EXISTS " + TABLE_ARTISTS); db.execSQL("DROP TABLE IF EXISTS " + TABLE_USERS); // Create tables again onCreate(db); } insert user row public void insertUserToDB(User user) { SQLiteDatabase db = this.getWritableDatabase(); ContentValues values = new ContentValues(); values.put(KEY_PROFILE_FLAG, user.getProfile_flag()); values.put(KEY_PROFILE_IMAGE, user.getProfileImageByteArray()); values.put(KEY_PROFILE_JSON, user.getProfile_json()); values.put(KEY_PROFILE_ID, user.getProfile_id()); db.beginTransaction(); long result = db.insertOrThrow(TABLE_USERS, null, values); db.endTransaction(); db.close(); } check user in database public boolean isUserInDB(String profileID) { SQLiteDatabase db = this.getReadableDatabase(); db.beginTransaction(); String sqlStatement = "SELECT * …
accepted answer: http://stackoverflow.com/a/24991823
possible better answer: http://stackoverflow.com/a/24991899
type: Question
has answer: http://stackoverflow.com/a/24991823
score: 0
answer count: 2
upvote count: 1
tagged with: sqlite
downvote count: 1
has answer: http://stackoverflow.com/a/24991899
favorite count: 0
has title: Insert in sqlite doesn't work
tagged with: android

http://stackoverflow.com/comment/38839533
type: AnswerComment
comment on: http://stackoverflow.com/a/24983650
type: Comment
has text: This is the correct answer see 15.7.4 of the [Java specification](http://docs.oracle.com/javase/specs/jls/se7/html/jls-15.html)
score: 0

http://stackoverflow.com/a/24940906
score: 0
has body: It returns the next line, waiting if necessary for the line to become available (i.e. the user types out something and presses enter).
type: Answer
answers question: http://stackoverflow.com/q/24940873

http://stackoverflow.com/q/25054717
tagged with: mongodb
score: 0
answer count: 1
tagged with: jboss7.x
has answer: http://stackoverflow.com/a/26074745
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38974222
tagged with: maven
tagged with: java
tagged with: objectid
has body: I'm having some trouble to sort out a issue that came out yesterday in my web application. So here's the scenario : I have web application running on Jboos 7 , that often consults a mongodb database. Every document on this database has an ObjectId as _id . The converters and id serializers and deserializers are in an api that my web application includes in its manifestEntries of the pom.xml . Now every time I try to get a Document from mongodb I get the following exception org.springframework.core.convert.ConverterNotFoundException: No converter found capable of converting from type org.bson.types.ObjectId to type org.bson.types.ObjectId For me, this would make some sense if the objects where actually different but they are the same. I'm not posting any code because I believe this might be or a Jboss thing or a Maven issue . Can anyone give some lights over this problem ? Thank you, Pedro
has title: No converter found capable of converting from type org.bson.types.ObjectId to type org.bson.types.ObjectId
has comment: http://stackoverflow.com/comment/38973463
has comment: http://stackoverflow.com/comment/38974290
type: Question

http://stackoverflow.com/q/24983983
has comment: http://stackoverflow.com/comment/38840302
upvote count: 5
tagged with: long-integer
tagged with: arrays
has comment: http://stackoverflow.com/comment/38840763
has answer: http://stackoverflow.com/a/24984054
has body: I would like to convert a (positive) primitive long to a byte[] in its textual form, in Java. For example an easy way would be: 123 =&gt; "123" =&gt; [49, 50, 51] However converting long to String heap-allocates a String and I'm trying to avoid this for my GC-free library. I would rather render this directly on a pre-allocated byte array. Hence, my question is how do I go directly from long to a byte[] representation, which if I call with a String constructor would (for the above example) given me "123". To clarify, I'm not looking to encode the long as a byte[] in binary form, but rather textual form. Thanks! N
has answer: http://stackoverflow.com/a/24984175
has answer: http://stackoverflow.com/a/24984137
tagged with: string
has title: Convert long to "byte-array-ed" text, without heap allocations
favorite count: 0
has answer: http://stackoverflow.com/a/24984209
answer count: 5
accepted answer: http://stackoverflow.com/a/24984054
possible better answer: http://stackoverflow.com/a/24984137
downvote count: 2
tagged with: garbage-collection
has answer: http://stackoverflow.com/a/24984058
has comment: http://stackoverflow.com/comment/38840320
has comment: http://stackoverflow.com/comment/38841900
type: AnsweredQuestion
score: 3
tagged with: java
has comment: http://stackoverflow.com/comment/38840326
type: Question
has comment: http://stackoverflow.com/comment/38840998
has comment: http://stackoverflow.com/comment/38840378

http://stackoverflow.com/q/25020838
has comment: http://stackoverflow.com/comment/38909811
has comment: http://stackoverflow.com/comment/38910003
score: 0
has title: maven build offline error- must specify a valid lifecycle phase
has body: I am still getting the hang of Maven and spring, but am having an odd problem. Up until a few days ago I could build maven fine by using the command: mvn -Dmaven.test.skip=true clean install eclipse:eclipse –o not sure what changed but i started getting the error: BUILD FAILURE Invalid task 'uo': you must specify a valid lifecycle phase, or a goal in the format plugin:goal or pluginGroupIf:pluginArtifactId:pluginVersion:goal for mor information run with the -e switch I tried updating all my code from SVN and got the same error. I finally completed building all packages with online with: mvn -Dmaven.test.skip=true clean install eclipse:eclipse which gave be BUILD SUCCESSFUL for all project packages. Yet when I try building maven offline again i continue to get the same Build Failure error. Any thoughts? Note: there is about 8 packages in my project and they all get the same build failure error
answer count: 1
has answer: http://stackoverflow.com/a/25020969
tagged with: maven
tagged with: spring
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/38909947
type: Question
accepted answer: http://stackoverflow.com/a/25020969

http://stackoverflow.com/q/24947483
has body: Im having trouble getting my map to display on an Android App. I have watched videos and read many forums (including this one) on troubleshooting the issues. My code isnt displaying any errors but every time I run it whether it be on an phone, tablet or emulator it says "Unfortunately, stuff has stopped". Any help or assistance would be greatly appreciated. SN: SDK and Google Play Services are up to date. MainActivity.Java package com.stuff; import com.google.android.gms.maps.CameraUpdateFactory; import com.google.android.gms.maps.GoogleMap; import com.google.android.gms.maps.SupportMapFragment; import com.google.android.gms.maps.model.LatLng; import com.google.android.gms.maps.model.MarkerOptions; import android.location.Criteria; import android.location.Location; import android.location.LocationManager; import android.os.Bundle; import android.view.Menu; import android.support.v4.app.FragmentActivity; public class MainActivity extends FragmentActivity { private GoogleMap googleMap; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); setUpMapIfNeeded(); } private void setUpMapIfNeeded() { // TODO Auto-generated method stub if (googleMap == null) { googleMap = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map)).getMap(); if (googleMap != null) { setUpMap(); } } } private void setUpMap() { // TODO Auto-generated method stub googleMap.setMyLocationEnabled(true); LocationManager locationManager = (LocationManager) getSystemService(LOCATION_SERVICE); Criteria criteria = new Criteria(); String provider = locationManager.getBestProvider(criteria, true); Location myLocation = locationManager.getLastKnownLocation(provider); googleMap.setMapType(GoogleMap.MAP_TYPE_HYBRID); double latitude = myLocation.getLatitude(); double longitude = myLocation.getLongitude(); LatLng latLng = new LatLng(latitude, longitude); googleMap.moveCamera(CameraUpdateFactory.newLatLng(latL…
has answer: http://stackoverflow.com/a/24947625
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/38927560
tagged with: runtime-error
score: 0
has title: Google Maps APIv2 app not working, keeps crashing
tagged with: android
answer count: 4
tagged with: google-maps-android-api-2
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24947529
has answer: http://stackoverflow.com/a/24947659
has answer: http://stackoverflow.com/a/26614872

http://stackoverflow.com/q/25026377
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/25026637
tagged with: java
linked to: http://stackoverflow.com/q/16269956
tagged with: eclipse
has title: How to install content in a app with other app
type: Question
has body: My question is simple, as in other operating systems like Windows, you can install a program specific content, such as images in the directory of another program so he can have it available for use. I have understood that Android is based on Linux, and the app can not communicate directly with other. So i was wondering if it is possible to do this, and if possible what steps should I consider. To understand that I mean an example would be an app that you install emoticons in whatsapp for example. Thanks.
has answer: http://stackoverflow.com/a/25026585
has answer: http://stackoverflow.com/a/25026886
score: 0
answer count: 3

http://stackoverflow.com/comment/38845233
comment on: http://stackoverflow.com/q/24977548
type: Comment
type: QuestionComment
has text: @MadProgrammer Yea, something like a generate/get next Graphics(2D) in my Canvas class. By default it uses the current buffer strategy to get the Graphics2D, but it could be overridden. However, my server doesn't override my Canvas, it wraps one. This way I can use different subclasses of my canvas with more functionality; (I need this ability.) So my Canvas might need a setGraphicsGenerator method that accepts some functional interface perhaps. Thanks for the help with brainstorming. (Let me know if you want to see the code. It's was just to much to post here.)
score: 0

http://stackoverflow.com/comment/38961587
type: Comment
comment on: http://stackoverflow.com/a/25047955
score: 0
type: AnswerComment
has text: When I did this, I got an java.lang.indexOutOdBoundsException, any ideas of what the cause is?

http://stackoverflow.com/a/24953400
accepted answer of: http://stackoverflow.com/q/24953328
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: You can try and built it from source from this github repo: https://github.com/sosandstrom/docrest From the command line you can do the following: git clone https://github.com/sosandstrom/docrest.git cd docrest git checkout docrest-1.21
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/38782561
has comment: http://stackoverflow.com/comment/38928859
answers question: http://stackoverflow.com/q/24953328
has comment: http://stackoverflow.com/comment/38782674
has comment: http://stackoverflow.com/comment/38788876

http://stackoverflow.com/comment/38864659
type: AnswerComment
has text: Thanks for the input, I'm aware of this option, but this disables the @Override for *all* overriden methods. I only want to disable it for interfaces.
comment on: http://stackoverflow.com/a/24964967
type: Comment
score: 1

http://stackoverflow.com/q/25031528
tagged with: java
tagged with: .class-file
type: Question
upvote count: 4
has answer: http://stackoverflow.com/a/25031621
has body: I want a sort of minimal "smoke test" for a series of JVMs, ranging from JDK 1 - 8, OpenJDK, IBM JDK, and even Microsoft JDKs if possible. Is there a way to make a minimal Java class file that should be able to test this? Update It should be possible to run: java -cp ClassName And have output that confirms that the JVM is running properly. Also, for those who think that JVMs are always functioning should know that I use systems which have up to 20 JVMs on one machine, and some of the JVMs can be corrupted. Also note that not all JVMs can run all .class files
downvote count: 0
score: 4
has title: What is the minimal Java class file that works on every JVM?
answer count: 3
has comment: http://stackoverflow.com/comment/38939754
has answer: http://stackoverflow.com/a/25031722
tagged with: jvm
favorite count: 0
has comment: http://stackoverflow.com/comment/38929625
possible better answer: http://stackoverflow.com/a/25031621
has comment: http://stackoverflow.com/comment/38935957
has answer: http://stackoverflow.com/a/25050224
accepted answer: http://stackoverflow.com/a/25050224
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38936603
has comment: http://stackoverflow.com/comment/38935817

http://stackoverflow.com/comment/38945705
type: QuestionComment
comment on: http://stackoverflow.com/q/25039915
score: 0
has text: i only wrote this line of code just to illustrate that I should at least see "Cookies:..." on the display but I see nothing. The rest of the html prints ok. Do you want me to include all the index.jsp code?
type: Comment

http://stackoverflow.com/comment/44778958
has text: Spring is able to find log4j2.xml that's why its giving parsing error. I think Spring expecting for log4j v1 but found log4j v2. How to resolve it?
type: Comment
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/25048261

http://stackoverflow.com/q/24961909
downvote count: 0
favorite count: 0
tagged with: rest
type: UnansweredQuestion
tagged with: grails-orm
score: 6
upvote count: 6
has answer: http://stackoverflow.com/a/24964449
has body: I'm having issues understanding how Grails Restful controllers work. I'm attempting to make a post request (see below) to a nested resource. I'm not sure I understand what I need to change to make this work, as it seems that GET requests build the Bid's association with it's parent resource Item, but when I attempt to POST I am warned that the Item cannot be blank. Any help is appreciated! Item.groovy class Item { static hasMany = [bids:Bid] } Bid.groovy class Bid { Integer ownerId Double amount static belongsTo = [item:Item] static constraints = { ownerId nullable: false amount nullable: false } } BidController.groovy class BidController extends RestfulController&lt;Bid&gt; { static responseFormats = ['json', 'xml'] BidController() { super(Bid) } @Override def getObjectToBind() { request.parameterMap.put('itemId', params.itemId) return request } } ItemController.groovy class ItemController extends RestfulController&lt;Item&gt; { static responseFormats = ['json', 'xml'] ItemController() { super(Item) } } UrlMappings.groovy class UrlMappings { static mappings = { "/items"(resources:"item") { "/bids"(resources: "bid") } } } URL Mappings Controller: item | GET | /items | Action: index | GET | /items/create | Action: create | POST | /items | Action: save | GET | /items/${id} | Action: show | GET | /items/${id}/edit | Action: edit | PUT | /items/${id} | Action: update | PATCH | /items/${id} | Action: patch | DELETE | /items/${id} | Action: delete Controller: bid | GET | /items/${itemId}/bids | Action: index | GET | /items/${itemId}/bids/create | Action: create | POST | /items/${itemId}/bids | Action: save | GET | /items/${itemId}/bids/${id} | Action: show | GET | /items/${itemId}/bids/${id}/edit | Action: edit | PUT | /items/${itemId}/bids/${id} | Action: update | PATCH | /items/${itemId}/bids/${id} | Action: patch | DELETE | /items/${itemId}/bids/${id} | Action: delete Post Request POST /AuctionService/items/1/bids HTTP/1.1 Content-Type: application/json Host: localhost…
tagged with: java
type: Question
has title: Issues posting nested resource in Grails
has answer: http://stackoverflow.com/a/25819182
tagged with: grails
has answer: http://stackoverflow.com/a/30068237
answer count: 3
tagged with: groovy

http://stackoverflow.com/q/25041177
has body: How do you convert a collection like ["a", "b", "c"] to a map like {"a": 0, "b":1, "c":2} with the values being the order of iteration. Is there a one liner with streams and collectors in JDK8 for it? Old fashion way is like this: Collection&lt;String&gt; col = apiCall(); Map&lt;String, Integer&gt; map = new HashMap&lt;&gt;(); int pos = 0; for (String s : collection) { map.put(s, pos++); }
has answer: http://stackoverflow.com/a/35607527
favorite count: 0
upvote count: 9
has answer: http://stackoverflow.com/a/25041562
tagged with: lambda
tagged with: java-8
has answer: http://stackoverflow.com/a/25062895
downvote count: 0
tagged with: java-stream
type: UnansweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/39704904
has comment: http://stackoverflow.com/comment/38947926
linked to: http://stackoverflow.com/q/17640754
type: Question
has comment: http://stackoverflow.com/comment/38948143
has answer: http://stackoverflow.com/a/25041371
has title: Java 8 lambda: convert Collection to Map of element, iteration position
answer count: 6
score: 9
has answer: http://stackoverflow.com/a/25042862

http://stackoverflow.com/comment/38747578
type: QuestionComment
has text: can you explain?i didn't get it
comment on: http://stackoverflow.com/q/24934777
score: 0
type: Comment

http://stackoverflow.com/q/24911008
has answer: http://stackoverflow.com/a/24918845
tagged with: java
has title: Dynamic calculation of a TextView that is linked to a seris of buttons
type: Question
has body: I'm trying to create this flow on an application I'm building. I am having a little bit of trouble getting the TextView to be friendly with any kind of formula/conditions. Any suggestions on how I can get the TextView to output the result dynamically through my text watchers? Thanks in advance! Text Views //------------------DISPLAY-----------------\\ netsale = (TextView)findViewById(R.id.netsale_input); //--------------WAIT ASSISTANT--------------\\ waMain = (TextView)findViewById(R.id.txt_wa_main); waSplit = (TextView)findViewById(R.id.txt_wa_split); Clear Button public void clr_Clicked(View sender){ netsale.setText("0"); isempty=true; } Number Pad static boolean isempty=true; public void num_Clicked(View sender){ Button bt=(Button)sender; if(netsale.getText().length()&gt;5)return; if(isempty) { if(bt.getText().toString().equals("0"))return; netsale.setText(bt.getText()); isempty=false; } else { netsale.append(bt.getText()); } } Text Watchers private TextWatcher filterTextWatcher = new TextWatcher() { @Override public void onTextChanged(CharSequence s, int start, int before, int count) { } @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @Override public void afterTextChanged(Editable s) { } }
tagged with: javascript
score: 0
answer count: 1
tagged with: textview
type: UnansweredQuestion
tagged with: android

http://stackoverflow.com/comment/38745114
type: QuestionComment
type: Comment
has text: http://docs.oracle.com/javase/tutorial/essential/exceptions/
comment on: http://stackoverflow.com/q/24933493
score: 1

http://stackoverflow.com/a/25032444
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24957513
score: 8
upvote count: 8
type: Answer
has body: This is as per Hibernate Validator FAQ at http://hibernate.org/validator/faq/ What’s the difference between Hibernate Validator 3, 4 and 5? Hibernate Validator 3.x and 4.x/5.x are different codebases. Hibernate Validator is the original validation framework from the Hibernate team and is now referred to as "Legacy Hibernate Validator". Hibernate Validator 4.x is the reference implementation of Bean Validation 1.0 (JSR 303), while Hibernate Validator 5.x is the reference implementation of Bean Validation 1.1 (JSR 349). Active development happens on the 5.x codebase. Also as you are using spring validation framework for MVC: &lt;!-- JSR-303 support will be detected on classpath and enabled automatically --&gt; &lt;mvc:annotation-driven /&gt; Thus the discrepancy might be : hibernate-validator-5.x won't support JSR303, try downgrading the version to 4.x. Also prefer Hibernate Validator 4.3.1.Final. rather than 4.2.x as both have different package structures.
answers question: http://stackoverflow.com/q/24957513

http://stackoverflow.com/a/24930708
score: 1
has comment: http://stackoverflow.com/comment/38745262
answers question: http://stackoverflow.com/q/24930336
has body: You need to add a Class-Path entry to the manifest file (META-INF/manifest.mf) inside the jar: Class-Path: /C:/.../MyProgram/ . This assumes that there are dependent classes under C:/.../MyProgram/, not jar files. You should also add an entry for the Main-class: Main-Class: main.Main Then just execute your jar as java -jar MyProgram.jar
upvote count: 1
has comment: http://stackoverflow.com/comment/38739950
has comment: http://stackoverflow.com/comment/38740516
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/38748515

http://stackoverflow.com/comment/38870576
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25000172
has text: I try to download a file after clicking on a link, with selenium it's not possible to download the file even by setting the firefox profile, so i try Java robot function to click on Enter button

http://stackoverflow.com/comment/38921851
has text: This is a *Link-Only Question* :) You should add the commands you used, and not send folks offsite to some blog.
type: QuestionComment
comment on: http://stackoverflow.com/q/25023685
score: 0
type: Comment

http://stackoverflow.com/comment/38851749
type: AnswerComment
type: Comment
has text: @user3771102 use if statement instead
comment on: http://stackoverflow.com/a/24989649
score: 0

http://stackoverflow.com/a/25008547
has comment: http://stackoverflow.com/comment/38915504
answers question: http://stackoverflow.com/q/25008513
score: 3
type: AcceptedAnswer
upvote count: 3
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25008513
has body: What you are looking for is a if-then-else if-then statement. Basically, add the ActionListener to all three buttons as you have been doing... JButton startButton = new JButton("Start"); JButton stopButton = new JButton("Stop"); JButton pauseButton = new JButton("Pause"); startButton.addActionListener(this); stopButton.addActionListener(this); pauseButton.addActionListener(this); Then supply a if-else-if series of conditions to test for each possible occurrence (you are expecting) public void actionPerformed(ActionEvent e) { Calendar aCalendar = Calendar.getInstance(); if (e.getSource() == startButton){ start = aCalendar.getTimeInMillis(); aJLabel.setText("Stopwatch is running..."); } else if (e.getSource() == stopButton) { aJLabel.setText("Elapsed time is: " + (double) (aCalendar.getTimeInMillis() - start) / 1000 ); } else if (e.getSource() == pauseButton) { // Do pause stuff } } Take a closer look at The if-then and if-then-else Statements for more details Instead of trying to use the reference to the buttons, you might consider using the actionCommand property of the AcionEvent instead, this means you won't need to be able to reference the original buttons... public void actionPerformed(ActionEvent e) { Calendar aCalendar = Calendar.getInstance(); if ("Start".equals(e.getActionCommand())){ start = aCalendar.getTimeInMillis(); aJLabel.setText("Stopwatch is running..."); } else if ("Stop".equals(e.getActionCommand())) { aJLabel.setText("Elapsed time is: " + (double) (aCalendar.getTimeInMillis() - start) / 1000 ); } else if ("Pause".equals(e.getActionCommand())) { // Do pause stuff } } It also means that you could re-use the ActionListener for things like JMenuItems, so long as they had the same actionCommand... Now, having said that, I would encourage you not to follow this paradigm. Normally, I would encourage you to use the Actions API, but that might be a little too advanced for where you're up to right now, instead, I would encourage you to take advantage of Ja…
type: Answer

jfilechooser
tags question: http://stackoverflow.com/q/24993234
tags question: http://stackoverflow.com/q/25051305
tags question: http://stackoverflow.com/q/25007111
tags question: http://stackoverflow.com/q/24983962
tag name: jfilechooser
tags question: http://stackoverflow.com/q/24942322
type: Tag

http://stackoverflow.com/comment/38875459
type: AnswerComment
comment on: http://stackoverflow.com/a/25002261
type: Comment
has text: I've given this a try. So far the obscuring is working greater than I could've possibly asked for. The link was very useful. I still need to deobscure and make sure all the characters are returned properly
score: 0

http://stackoverflow.com/q/24969561
type: AnsweredQuestion
downvote count: 0
favorite count: 0
tagged with: maven-shade-plugin
possible better answer: http://stackoverflow.com/a/31122116
has answer: http://stackoverflow.com/a/31122116
has answer: http://stackoverflow.com/a/64027964
type: Question
accepted answer: http://stackoverflow.com/a/24971574
has answer: http://stackoverflow.com/a/74517053
tagged with: maven-lifecycle
tagged with: maven
has body: I am using maven for configuration of an application consisting of multiple small services. Most of the services developed in java share the same maven configuration, as in the same build lifecycle, some shared resources (like spring AMQP). So I have organized the shared resources in a SuperPom. While the shade plugin doesn't really seem to disturb the install process, the antrun plugin of course won't find any of the files it should copy, due to there not being created any jar files by the shade plugin. As I'd like the configuration of the shade/antrun plugin to be abstracted in the SuperPom, I need to skip the shade/copy goal. I have tried mvn clean install -Dmaven.shade.skip=true, mvn clean install -Dmaven.copy.skip=true, mvn clean install -Dmaven.shade.shade.skip=true Here is a small sample for you to play with: 4.0.0 Test SuperTest 0.0.1-SNAPSHOT pom <log4j.version>1.2.17</log4j.version> pleasedeleteme com.uk.cc.it.info.gov.test.xxx maven-compiler-plugin 3.1 1.7 1.7 org.apache.maven.plugins maven-shade-plugin 2.2 package shade ${mainpackage}.Main org.apache.maven.plugins maven-dependency-plugin 2.8 copy package copy ${groupId} ${artifactId} ${version} jar true ${destination} log4j log4j ${log4j.version}
has title: How to skip the maven antrun copy/shade:shade goal dynamically?
score: 4
tagged with: maven-antrun-plugin
has answer: http://stackoverflow.com/a/66146448
tagged with: java
has answer: http://stackoverflow.com/a/24971574
answer count: 5
has comment: http://stackoverflow.com/comment/116339994
upvote count: 4

http://stackoverflow.com/comment/38816055
has text: Whenever I am trying to add an account to product, the added account stays in the the product's HashSet just during the addAccount() method . Later when I am calling another action method which displays all the added accounts, it returns empty. Thanks for being responsive Roman!
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24970060

playframework
tags question: http://stackoverflow.com/q/24951669
tags question: http://stackoverflow.com/q/25014416
tags question: http://stackoverflow.com/q/25001180
tags question: http://stackoverflow.com/q/24909459
tags question: http://stackoverflow.com/q/24970848
tags question: http://stackoverflow.com/q/24954234
tags question: http://stackoverflow.com/q/24973171
tags question: http://stackoverflow.com/q/24960831
tags question: http://stackoverflow.com/q/24985473
tags question: http://stackoverflow.com/q/25009557
tags question: http://stackoverflow.com/q/24981337
tags question: http://stackoverflow.com/q/25057854
type: Tag
tags question: http://stackoverflow.com/q/25005274
tags question: http://stackoverflow.com/q/24960959
tag name: playframework
tags question: http://stackoverflow.com/q/24971165
tags question: http://stackoverflow.com/q/25042100
tags question: http://stackoverflow.com/q/24970707

http://stackoverflow.com/comment/39183225
type: QuestionComment
has text: the problem is not solved yet... =(
type: Comment
comment on: http://stackoverflow.com/q/25031880
score: 0

http://stackoverflow.com/comment/38756634
type: QuestionComment
has text: You say you are using Struts. First is it Struts1 or Struts2 ? They are really different frameworks only sharing the name. And the way of passing objects from the controller to the JSP is not exactly the same.
comment on: http://stackoverflow.com/q/24938666
score: 0
type: Comment

http://stackoverflow.com/comment/38980840
type: Comment
comment on: http://stackoverflow.com/a/25058502
type: AnswerComment
has text: @samir - No, but translating to Objective-C is trivial.
score: 0

http://stackoverflow.com/comment/38925378
has text: The Q is much clearer now! (Header could have been formulated better.)
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25028932

http://stackoverflow.com/q/24961701
tagged with: string
has body: I would like to only add Strings to the list if the list not already contains an entry that contains the exact same character sequence. This does not work... "String" will be added list1.add("String"); list2.add("Hello I am String"); for (String str : list1) { if (!list2.contains(str)) list2.add(str); } The word "String" will be added even though an entry of list2 contains "String". How can I tell it to not only check of identical character sequences? Do I have to get through every single entry manually with forloops or RegEx? Or is there a nicer way?
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24961776
tagged with: list
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/24961759
possible better answer: http://stackoverflow.com/a/24961754
type: Question
has answer: http://stackoverflow.com/a/24961754
answer count: 3
accepted answer: http://stackoverflow.com/a/24961759
has title: Check if list entry contains word sequence java

http://stackoverflow.com/comment/38820940
has text: @AbhinavKumar you can get the dimension by calling the method multiple times and using a counter...
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24973699

http://stackoverflow.com/q/24936621
has comment: http://stackoverflow.com/comment/38751965
has answer: http://stackoverflow.com/a/24936691
has answer: http://stackoverflow.com/a/24936713
has body: Is it possible to have Java object dynamically? I am new in this language and curious too. Edit: Apology, I think I posted the wrong word. Thanks for any answer.
has title: Runtime object creation in java
type: AnsweredQuestion
upvote count: 0
has comment: http://stackoverflow.com/comment/38751508
possible better answer: http://stackoverflow.com/a/24936746
tagged with: java
has comment: http://stackoverflow.com/comment/38751762
has comment: http://stackoverflow.com/comment/38751758
has comment: http://stackoverflow.com/comment/38751059
type: Question
linked to: http://stackoverflow.com/q/13868986
downvote count: 8
has answer: http://stackoverflow.com/a/24936746
has comment: http://stackoverflow.com/comment/38751124
answer count: 3
has comment: http://stackoverflow.com/comment/38751281
accepted answer: http://stackoverflow.com/a/24936691
favorite count: 0
score: -8

http://stackoverflow.com/comment/38725235
score: 2
comment on: http://stackoverflow.com/q/24922452
has text: See http://stackoverflow.com/questions/17977495/java-object-hashcode-algorithm - which has links to the native source. However, after reading the source I am even more confused.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38841512
type: Comment
comment on: http://stackoverflow.com/a/24984374
has text: I test it using advanced rest client chrome extension and the same exception appear
type: AnswerComment
score: 0

http://stackoverflow.com/comment/38890666
score: 0
type: Comment
has text: @JonSkeet well that gives vision to what the error actually is, I personally had not known that the enum would be a subclass of the original `MyEnum` class when it provides an implementation to an abstract function, although it does make sense. This is interesting.
type: QuestionComment
comment on: http://stackoverflow.com/q/25010763

http://stackoverflow.com/a/24999400
type: Answer
has comment: http://stackoverflow.com/comment/38869039
has comment: http://stackoverflow.com/comment/38869053
answers question: http://stackoverflow.com/q/24999306
score: 0
has body: Before initializing the FileWriter you can use file.exists() (which returns a boolean) to see if the file exists. Then you can do other checks such as file.isFile() and !file.isDirectory() to make sure that these are files you can write to.

http://stackoverflow.com/comment/38821272
has text: What IDE do you use Eclipse or Android Studio?
comment on: http://stackoverflow.com/q/24973616
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/24990757
linked to: http://stackoverflow.com/q/13979845
has comment: http://stackoverflow.com/comment/38863369
type: AnsweredQuestion
has title: Certifying Pdf document with iText
tagged with: java
tagged with: itext
has answer: http://stackoverflow.com/a/24996276
type: Question
accepted answer: http://stackoverflow.com/a/24996276
has comment: http://stackoverflow.com/comment/38856628
tagged with: java-security
score: 0
has body: I can sign my pdf and verify it by adding my smith.crt to be trusted in adobe reader (i get the green check mark) , my problem is certifying my pdf, i can not get the blue ribbon in the top left corner of my pdf, is it because i use the self-signed certificate? I get the message: The validity of the document certification is UNKNOWN. The author could not be verified. Can you please help me out, how can I get that blue ribbon? import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.security.GeneralSecurityException; import java.security.KeyStore; import java.security.PrivateKey; import java.security.Security; import java.security.cert.Certificate; import org.bouncycastle.jce.provider.BouncyCastleProvider; import com.itextpdf.text.Document; import com.itextpdf.text.DocumentException; import com.itextpdf.text.Paragraph; import com.itextpdf.text.Rectangle; import com.itextpdf.text.pdf.PdfReader; import com.itextpdf.text.pdf.PdfSignatureAppearance; import com.itextpdf.text.pdf.PdfStamper; import com.itextpdf.text.pdf.PdfWriter; import com.itextpdf.text.pdf.security.BouncyCastleDigest; import com.itextpdf.text.pdf.security.ExternalDigest; import com.itextpdf.text.pdf.security.ExternalSignature; import com.itextpdf.text.pdf.security.MakeSignature.CryptoStandard; import com.itextpdf.text.pdf.security.PrivateKeySignature; import com.itextpdf.text.pdf.security.MakeSignature; public class SO { public static String ORIGINAL = "src/test.pdf"; public static String SIGNED1 = "src/signedtest.pdf"; public void createPdf(String filename) throws IOException, DocumentException { Document document = new Document(); PdfWriter.getInstance(document, new FileOutputStream(filename)); document.open(); document.add(new Paragraph("Test!")); document.close(); } public void signPdf(String src, String dest) throws IOException, DocumentException, GeneralSecurityException { String path = "src/keyS"; String keystore_password = "SOSOSO"; String key_pass…
tagged with: http://stackoverflow.com/tag/pdf
answer count: 1
has comment: http://stackoverflow.com/comment/38852852
tagged with: digital-signature

finite-automata
tags question: http://stackoverflow.com/q/24956164
type: Tag
tag name: finite-automata

http://stackoverflow.com/q/25030737
has title: Storing json string in Hadoop file with delimiter
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25033026
tagged with: java
type: Question
tagged with: hadoop
answer count: 1
has body: I am converting object into json string and storing it into hadoop file system with each string is seperated by some delimter. FSDataOutputStream out = null; try { FileSystem fs = FileSystem.get(hadoopConfiguration); out = fs.exists(outFile) ? fs.append(outFile) : fs.create(outFile); ConnTrackInfo conntrack = new ConnTrackInfo(124, "ranjeet@triconinfotec.com", "instrutor", new Date(), "Section", 234,"Economics",9991, "EZT", "124XSD234", 33, "GeneralEconomics", "192.168.1.210"); Gson gson = new Gson(); String jsonstring = null; jsonstring = gson.toJson(conntrack); out.writeUTF(jsonstring.concat("@@@")); } catch (Exception e) { logger.error("Unable to persist tracking data", e); } finally { out.close(); } It is storing data fine but its adds some extra digits with my delimiter. my file data is like this 1{"userId":124,"emailId":"ranjeet@triconinfotec.com","role":"instrutor","date":"Jul 30, 2014 11:56:12 AM","target":"Section","sectionId":234,"sectionName":"Economics","assignmentId":9991,"assignmentName":"EZT","isbn":"124XSD234","courseId":33,"courseName":"GeneralEconomics","ipaddress":"192.168.1.210"}@@@1{"userId":124,"emailId":"ranjeet@triconinfotec.com","role":"instrutor","date":"Jul 30, 2014 11:56:55 AM","target":"Section","sectionId":234,"sectionName":"Economics","assignmentId":9991,"assignmentName":"EZT","isbn":"124XSD234","courseId":33,"courseName":"GeneralEconomics","ipaddress":"192.168.1.210"}@@@1{"userId":124,"emailId":"ranjeet@triconinfotec.com","role":"instrutor","date":"Jul 30, 2014 12:15:02 PM","target":"Section","sectionId":234,"sectionName":"Economics","assignmentId":9991,"assignmentName":"EZT","isbn":"124XSD234","courseId":33,"courseName":"GeneralEconomics","ipaddress":"192.168.1.210"}@@@1{"userId":124,"emailId":"ranjeet@triconinfotec.com","role":"instrutor","date":"Jul 30, 2014 12:18:25 PM","target":"Section","sectionId":234,"sectionName":"Economics","assignmentId":9991,"assignmentName":"EZT","isbn":"124XSD234","courseId":33,"courseName":"GeneralEcono…
score: 0

http://stackoverflow.com/q/25059688
has answer: http://stackoverflow.com/a/25059719
has answer: http://stackoverflow.com/a/25059843
answer count: 4
has answer: http://stackoverflow.com/a/25059971
type: UnansweredQuestion
tagged with: multithreading
tagged with: methods
linked to: http://stackoverflow.com/q/7569459
has title: How to run a class' method using thread
has answer: http://stackoverflow.com/a/25059796
tagged with: java
tagged with: class
type: Question
has comment: http://stackoverflow.com/comment/38982805
score: 0
has body: If I do the following, I will be able to create an object as a thread and run it. class ThreadTest { public static voic main(String[] args) { HelloThread hello = new HelloThread(); Thread t = new Thread(hello); t.start(); } } class HelloThread extends Thread { public void run() { System.out.println(" Hello "); } } Now, if my HelloThread class has a another method call runThisPlease(), how are we supposed to run it with a thread? Example: class HelloThread extends Thread { public void run() { System.out.println(" Hello "); } public void runThisPlease(String input) { System.out.println (" Using thread on another class method: " + input ); } } Que: When I try Thread t = new Thread(hello.runThisPlease());, it doesn't work. So how can we call the method runThisPlease() using a thread? Edit: Argument needed in method for runThisPlease();
has comment: http://stackoverflow.com/comment/38982949

http://stackoverflow.com/comment/43856531
has text: Same problem, although the file "tools.jar" is there in subfolder "C:\Program Files\Java\jdk1.8.0_25\lib"
comment on: http://stackoverflow.com/q/24915686
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25018308
has comment: http://stackoverflow.com/comment/38905209
answer count: 1
has body: I have selenium test written in java, I want to use regular expression in verifyEquals() to match with selenium.getText(id="something") can I use it like this? verifyEquals("regexp: Regular Expression", selenium.getText("id=something"))
has answer: http://stackoverflow.com/a/25018590
tagged with: regex
type: UnansweredQuestion
has title: Using regex in verifyEquals()
has comment: http://stackoverflow.com/comment/38907433
tagged with: java
tagged with: selenium
type: Question
score: 0

http://stackoverflow.com/q/24942101
has answer: http://stackoverflow.com/a/32081505
score: 1
tagged with: java
answer count: 2
has body: For WorkLight applications I don't see some cookie headers being sent to the server for basic WL.Client.invokeProcedure calls. How do you properly add cookie headers? Ideally, these would be global but I read that there may be issues using WL.Client.addGlobalHeader("Cookie"). procedure). This is basically the code in Javascript: var invocationData = { adapter : "data", procedure : procedure, headers : { "Cookie", "CookieData=val" } parameters : parms, }; WL.Client.invokeProcedure(invocationData) Edited: http://www-01.ibm.com/support/docview.wss?uid=swg21678099 "The WL.Client.addGlobalHeader API replaces the entire 'Cookie' header and destroys the session state."
downvote count: 0
tagged with: javascript
has comment: http://stackoverflow.com/comment/38762243
favorite count: 0
type: UnansweredQuestion
tagged with: ibm-mobilefirst
tagged with: cordova
has answer: http://stackoverflow.com/a/24942920
has title: Worklight : how to set use addGlobalHeader for WL.Client.invokeProcedure calls
upvote count: 1
has comment: http://stackoverflow.com/comment/38762054
type: Question

http://stackoverflow.com/comment/38742500
type: QuestionComment
comment on: http://stackoverflow.com/q/24931543
score: 0
type: Comment
has text: By "design in illustrator" you mean Adobe Illustrator? What is the format of this design? Could you please clarify what you already have? Do you want to scale this image in your application or draw it based on this design draft?

http://stackoverflow.com/a/24972846
has body: I've found the problem: The original minSphereCenter code used a scaleAdd() function, which I assumed worked like an addScale() function. The original question has been edited with the solution.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/24972740

http://stackoverflow.com/a/33498233
answers question: http://stackoverflow.com/q/24935706
upvote count: 1
has body: this is because of something wrong with the netbeans and dealing with the glassfish because of the glassfish cant see the my sql database even if you told him to build it correctly so to solve this problem you must go to the server panel go to glassfish server rightclick on it and go to "view Domain Admin Console" like here: example and open it with any browser now choose JDBC and expand it like here: example now you should creat a new "JDBC Resource " and a new "JDBC connection Pool" then it will work finally correctly !
downvote count: 0
type: Answer
score: 1

http://stackoverflow.com/comment/38834410
score: 0
type: AnswerComment
has text: https://github.com/DENMROOT/spring_mvc_test - feel free to inspect my project on github.
comment on: http://stackoverflow.com/a/24980808
type: Comment

http://stackoverflow.com/comment/38826650
type: QuestionComment
comment on: http://stackoverflow.com/q/24976683
score: 1
has text: Post the contents of /data/anr/traces.txt, or at least the final crash in it. You're crashing in C code and that file will give more details.
type: Comment

http://stackoverflow.com/comment/38953329
type: Comment
comment on: http://stackoverflow.com/a/25044047
score: 0
type: AnswerComment
has text: Only one record in table and facebookid is null thats why i am updating it

http://stackoverflow.com/comment/38854237
has text: Brian Goetz's answer does that.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24986266
score: 1

http://stackoverflow.com/a/25011314
downvote count: 1
score: 0
answers question: http://stackoverflow.com/q/25010496
type: Answer
has body: I don't think there is anything wrong with your code. The grammar file just does not have a rule defined for #include &lt;foo.h&gt;. So what you could do is extending the grammar (which could be rather complicated when you are not familiar with antlr) or delete the include-statement for now to get antlr work with your grammar.
upvote count: 1

http://stackoverflow.com/comment/38931560
type: Comment
comment on: http://stackoverflow.com/a/25032490
has text: *{if true execute this} : {else do this}* It does not just execute, it ***assigns***
score: 0
type: AnswerComment

http://stackoverflow.com/q/24924013
has answer: http://stackoverflow.com/a/24924030
type: Question
tagged with: plist
has body: I am using a Java library for parsing plist files. This is how you parse a file: File file = new File("Info.plist"); NSDictionary rootDict = (NSDictionary)PropertyListParser.parse(file); As you can see, the parse method returns an NSObject object, which you cast to NSDictionary or NSArray depending on what you're working with. But what if I don't know whether the root is a dictionary or an array? Given an NSObject instance, how can I tell what does it represent?
upvote count: 1
answer count: 1
favorite count: 0
has title: Java plist parsing: how to determine if an NSObject is an array or a dictionary
accepted answer: http://stackoverflow.com/a/24924030
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java

messagebox
tags question: http://stackoverflow.com/q/24927587
type: Tag
tag name: messagebox

http://stackoverflow.com/q/24960162
tagged with: android
has comment: http://stackoverflow.com/comment/38795386
has body: I'm trying to use gson to connect to a server but i have a problem with the code, I found out that you need AsyncTask for network connections since it would not run in the main thread, hence the exception I got as stated in the title. public class SendPostRequest extends AsyncTask&lt;String, Void, String&gt; { private Gson gson = new GsonBuilder().create(); public String sendMessage(Object message, String address) { String url = "http://192.168.87.108:8080/MSS/" + address; String data = gson.toJson(message); HttpPost post = new HttpPost(url); List&lt;NameValuePair&gt; nameValuePairs = new ArrayList&lt;NameValuePair&gt;(1); nameValuePairs.add(new BasicNameValuePair("report", data)); try { post.setEntity(new UrlEncodedFormEntity(nameValuePairs)); } catch (UnsupportedEncodingException e) { System.out.println("Your url encoding is shiat fail"); e.printStackTrace(); } HttpClient client = new DefaultHttpClient(); HttpResponse response = null; try { response = client.execute(post); } catch (ClientProtocolException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } HttpEntity entity = response.getEntity(); String responseText = ""; try { responseText = EntityUtils.toString(entity); } catch (ParseException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } return responseText; } @Override protected String doInBackground(String... params) { return ""; } } I am aware i need to move the code into the doInBackground method, but I also need to use the SendMessage method with its parameters by calling it in other classes to correspond with the server parameters(like save, register, etc), so i'm not sure how to go about moving the contents so it would work as an AsyncTask. Any help would be appreciated, thank you
tagged with: android-asynctask
type: AnsweredQuestion
upvote count: 2
has title: Challenge in using AsyncTask to avoid AndroidNetworkOnMainThreadException
downvote count: 1
has answer: http://stackoverflow.com/a/24960331
type: Question
score: 1
tagged with: java
tagged with: gson
answer count: 1
accepted answer: http://stackoverflow.com/a/24960331
favorite count: 0

http://stackoverflow.com/comment/38968068
comment on: http://stackoverflow.com/a/25051389
has text: @SubhrajyotiMajumder The ternary is part of the language. But you could always implement it as a simple `if else` if you prefer.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/38978382
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25048463
has text: the problem is in the design of my code. that variable should not be visible anyhow. It is an implementation detail. I must hide that

http://stackoverflow.com/a/24974190
type: Answer
has body: Yes, Before publishing the message to RabbitMQ, convert your message to a Json String. Now on the receiving end, when the message is received, Parse it to convert into the same format. In ruby this can be done with while sending => Message.to_json on Receiving => message = JSON.parse(received_msg) To get the class of data, you can send a variable specifying the class of the data along with the data.
answers question: http://stackoverflow.com/q/24974143
has comment: http://stackoverflow.com/comment/38822101
has comment: http://stackoverflow.com/comment/38822347
score: 0
has comment: http://stackoverflow.com/comment/38898898

http://stackoverflow.com/comment/38993097
has text: Have you tried this: http://stackoverflow.com/questions/14779994/annotation-based-factory-methods
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25065036
score: 0

http://stackoverflow.com/comment/38773062
type: QuestionComment
has text: Your problem is in batch file ?? But I guess you need to invoke a java program through batch file which gives you these options.
score: 0
comment on: http://stackoverflow.com/q/24948004
type: Comment

http://stackoverflow.com/comment/38904195
comment on: http://stackoverflow.com/q/25017930
score: 1
has text: They're objects. == compares references. To check for value equality, use .equals() instead.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38873220
type: Comment
has text: What is the keygenerator javax.crypto.KeyGenerator ? Could you include imports in the code ?
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/25001500

http://stackoverflow.com/comment/38857424
type: QuestionComment
has text: @user3218114 - subtracting `diffs[1] - diffs[0]`, `diffs[2] - diffs[1]` (although I don't know from where the `0` came :P). This is pretty simple, why not loop from 1 to n-1 and try `arr[counter]-arr[counter-1]` ?
score: 0
comment on: http://stackoverflow.com/q/24993266
type: Comment

http://stackoverflow.com/comment/38898214
comment on: http://stackoverflow.com/q/25014814
type: Comment
type: QuestionComment
has text: he he he :) On-topic: research into connection pooling / datasources. That is not going to prevent an error as a 'permission denied' however, that is unrelated to performance.
score: 2

validation
tags question: http://stackoverflow.com/q/24941427
tags question: http://stackoverflow.com/q/24979824
tags question: http://stackoverflow.com/q/24968820
tags question: http://stackoverflow.com/q/25027081
tags question: http://stackoverflow.com/q/24966334
tags question: http://stackoverflow.com/q/24952055
tags question: http://stackoverflow.com/q/24955817
type: Tag
tag name: validation
tags question: http://stackoverflow.com/q/24920665
tags question: http://stackoverflow.com/q/24957513
tags question: http://stackoverflow.com/q/24935893
tags question: http://stackoverflow.com/q/24974816
tags question: http://stackoverflow.com/q/24924072
tags question: http://stackoverflow.com/q/24957878
tags question: http://stackoverflow.com/q/24914646
tags question: http://stackoverflow.com/q/24924321
tags question: http://stackoverflow.com/q/25057736
tags question: http://stackoverflow.com/q/24949946
tags question: http://stackoverflow.com/q/25054549
tags question: http://stackoverflow.com/q/24927048
tags question: http://stackoverflow.com/q/24994652
tags question: http://stackoverflow.com/q/24935991
tags question: http://stackoverflow.com/q/25034829
tags question: http://stackoverflow.com/q/24914993

http://stackoverflow.com/comment/49059750
type: Comment
has text: The cited link http://www.eclipse.org/downloads/java8/ returns a 404. I did find https://wiki.eclipse.org/JDT_Core/Java8
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/24947937

http://stackoverflow.com/comment/38966081
has text: You need to print the output, for example `System.out.println(Reverse.putTogether());` for example...
type: QuestionComment
comment on: http://stackoverflow.com/q/25050735
type: Comment
score: 1

http://stackoverflow.com/a/25046278
answers question: http://stackoverflow.com/q/25046122
has body: You should Class getClass() method to detect the exact class at runtime. if (t.getClass() == SubType.class) do SubType stuff else if (t.getClass() == SuperType.class) do SuperType stuff else do your stuff
type: Answer
has comment: http://stackoverflow.com/comment/38957790
has comment: http://stackoverflow.com/comment/38958029
has comment: http://stackoverflow.com/comment/38958121
has comment: http://stackoverflow.com/comment/38958424
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/38959382
has comment: http://stackoverflow.com/comment/38958479
has comment: http://stackoverflow.com/comment/38958963
has comment: http://stackoverflow.com/comment/38958309
has comment: http://stackoverflow.com/comment/38957807
has comment: http://stackoverflow.com/comment/38957948
score: 0
has comment: http://stackoverflow.com/comment/38957861
has comment: http://stackoverflow.com/comment/38958847

http://stackoverflow.com/q/24971552
has comment: http://stackoverflow.com/comment/38819954
has comment: http://stackoverflow.com/comment/38880678
favorite count: 0
has comment: http://stackoverflow.com/comment/38836789
has answer: http://stackoverflow.com/a/25005558
tagged with: x509certificate
has comment: http://stackoverflow.com/comment/38986456
has comment: http://stackoverflow.com/comment/38896342
tagged with: localhost
possible better answer: http://stackoverflow.com/a/25109421
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25109421
has comment: http://stackoverflow.com/comment/38836768
has comment: http://stackoverflow.com/comment/38842940
tagged with: java
has body: Our Java 7 application needs to listen for HTTPS requests on localhost. It must accept connections on https://localhost:8112 and https://127.0.0.1:8112. To do so we have programmatically built an auto-signed X509v3 certificate, and we have installed this certificate in the Windows-ROOT keystore, as follows: KeyStore.TrustedCertificateEntry trustedCert = ...; KeyStore ks = KeyStore.getInstance("Windows-ROOT"); ks.load(null, null); ks.setEntry("xxxx_localhost", trustedCert, null); This makes the certificate accepted by Chrome 36 in both cases (localhost and 127.0.0.1), but IE 11 does not recognize the certificate as valid when accessing 127.0.0.1 while it does when accessing localhost: Why? The certificate is built as follows, with BasicConstraints, ExtendedKeyUsage and SubjectAlternativeName extensions, by using the sun.security.x509 package: KeyPairGenerator generator = KeyPairGenerator.getInstance("RSA"); generator.initialize(2048); KeyPair kp = generator.generateKeyPair(); X509Certificate cert = generateCertificate("CN=localhost, OU=XXX, O=XXX", kp, 1825, "SHA256withRSA", "ip:127.0.0.1,dns:localhost,uri:https://127.0.0.1:8112"); /** * Create a self-signed X.509 Certificate. * @param dn the X.509 Distinguished Name * @param pair the KeyPair * @param days how many days from now the Certificate is valid for * @param algorithm the signing algorithm, eg "SHA256withRSA" * @param san SubjectAlternativeName extension (optional) */ private static X509Certificate generateCertificate(String dn, KeyPair pair, int days, String algorithm, String san) throws GeneralSecurityException, IOException { PrivateKey privkey = pair.getPrivate(); X509CertInfo info = new X509CertInfo(); Date from = new Date(); Date to = new Date(from.getTime() + days * 86400000l); CertificateValidity interval = new CertificateValidity(from, to); BigInteger sn = new BigInteger(64, new SecureRandom()); X500Name owner = new X500Name(dn); info.set(X509CertInfo.VALIDITY, interval); info.set(X509CertInfo.SERIAL_…
has comment: http://stackoverflow.com/comment/38871283
linked to: http://stackoverflow.com/q/8443081
type: Question
score: 5
accepted answer: http://stackoverflow.com/a/25005558
tagged with: internet-explorer
has comment: http://stackoverflow.com/comment/39076715
upvote count: 5
has comment: http://stackoverflow.com/comment/38874174
tagged with: ssl
has comment: http://stackoverflow.com/comment/38842668
has comment: http://stackoverflow.com/comment/38820055
has comment: http://stackoverflow.com/comment/38842262
answer count: 2
has title: Why IE rejects a self-signed localhost certificate for 127.0.0.1 only, when Chrome accepts it?
has comment: http://stackoverflow.com/comment/38870643
downvote count: 0

http://stackoverflow.com/comment/38838443
score: 1
type: AnswerComment
type: Comment
has text: You're exactly right! So your next question should be, "When *does* it make sense to use more than one thread?" And the answer is, when the *activity* takes a long time. Here's a hint: You need to sum the numbers from 1 to 20, and you have two people to do it. You can give them a specific task/input, and they can only come back to you *once* with a result. How can you optimize the way they're working to allow for this?
comment on: http://stackoverflow.com/a/24982826

http://stackoverflow.com/comment/38888929
type: Comment
has text: @immibis tags include [svn] and he mentions VisualSVN Server in question, so I wanna give him complete answer on this matter. BTW, not using version-control nowadays is awkward.
comment on: http://stackoverflow.com/a/25009881
type: AnswerComment
score: 0

http://stackoverflow.com/q/24931583
tagged with: jackson
favorite count: 0
tagged with: rest
has answer: http://stackoverflow.com/a/24931716
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24931932
tagged with: spring
has body: I have entity class: @Entity @Table(name="person") public class Person implements Serializable { @Id @Column(unique=true) private int id; private String title; // getter, setter, constructor,... } In controller: @RequestMapping(value="/get/{id}", method=RequestMethod.GET) public @ResponseBody Person getPerson(@PathVariable int id) { return personManager.findById(id); } @RequestMapping(value="/add", method=RequestMethod.POST) public @ResponseBody void addPerson(@RequestBody Person person) { String log = parse_json_from_input("log"); // How can I do it? // do something with log personManager.save(person); } I would like to send additional parameters in JSON and parse it. If I execute below command I get Person entity - it is ok. But I need to get log attribute in addPerson method for other usage. curl -X POST -H "Content-Type: application/json" -H "Accept: application/json" \ -d '{"title":"abc","log":"message..."}' http://localhost:8080/test/add How can I parse it?
type: Question
has title: Spring REST - manually parse JSON attributes in @RequestBody
score: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json
answer count: 2
upvote count: 1
downvote count: 0

http://stackoverflow.com/comment/38928291
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25030600
score: 0
has text: Please use 'view source' of the browser and check that the jQuery js path is correct.

http://stackoverflow.com/comment/38917098
comment on: http://stackoverflow.com/q/25024500
type: QuestionComment
has text: Try `java.util.Arrays.sort(castNames);`. Since your class name is `Array`, there seems to be some confusion (so you could also change your class name to something else like `ArrayTest`).
type: Comment
score: 1

http://stackoverflow.com/a/25018701
has comment: http://stackoverflow.com/comment/38914618
has comment: http://stackoverflow.com/comment/38916142
has comment: http://stackoverflow.com/comment/38916401
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/38912516
score: 6
type: Answer
upvote count: 6
has body: I'm not sure of another way, but I think you have to install your own customized TabbedPaneUI on your JTabbedPane. Example: import java.awt.*; import javax.swing.*; import javax.swing.plaf.basic.*; public class JTabbedPaneWithSpaces implements Runnable { public static void main(String[] args) throws Exception { SwingUtilities.invokeLater(new JTabbedPaneWithSpaces()); } public void run() { JTabbedPane pane = new JTabbedPane(); pane.setUI(new SpacedTabbedPaneUI()); pane.addTab("One", new JPanel()); pane.addTab("Two", new JPanel()); pane.addTab("Threeeeeee", new JPanel()); pane.addTab("Four", new JPanel()); JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.add(pane); frame.setSize(500, 200); frame.setLocationRelativeTo(null); frame.setVisible(true); } public class SpacedTabbedPaneUI extends BasicTabbedPaneUI { @Override protected LayoutManager createLayoutManager() { return new BasicTabbedPaneUI.TabbedPaneLayout() { @Override protected void calculateTabRects(int tabPlacement, int tabCount) { final int spacer = 20; // should be non-negative final int indent = 4; super.calculateTabRects(tabPlacement,tabCount); for (int i = 0; i &lt; rects.length; i++) { rects[i].x += i * spacer + indent; } } }; } } }
accepted answer of: http://stackoverflow.com/q/25007809
answers question: http://stackoverflow.com/q/25007809

http://stackoverflow.com/q/24978230
has comment: http://stackoverflow.com/comment/38829320
tagged with: loops
type: Question
tagged with: arrays
score: -1
tagged with: stack-overflow
accepted answer: http://stackoverflow.com/a/24978414
tagged with: runtime-error
answer count: 2
has body: The following code works fine But as soon i take any integer input at the beginning it goes in infinite loop. I need the integer value for testcases. import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; class TestClass { public static void main(String args[] ) throws Exception { Scanner stdin = new Scanner(System.in); //HERE I JUST INPUT AN // INT VALUE PROGRAM GOES INFINITE LIKE int t = stdin.nextInt(); long count = 0; String str = stdin.nextLine(); char[] c = str.toCharArray(); for(int j=0;j&lt;str.length();j++){ switch(c[j]){ case 'a': case 'e': case 'i': case 'o': case 'u': count++; default : break; } } arrangement(count,str.length()); } public static void arrangement(long v,long n){ long total = fact(n); long together = ((combination(v))*(fact(n-1))*2); long answer = (total - together); if(answer&gt;0) System.out.println(answer); else System.out.println("-1"); } public static long fact(long n){ long ans; if(n==1 || n==0) return 1; else ans = fact(n-1)*(n); return ans; } public static long combination(long n){ if(n==0) return 0; if(n==1) return 0; if(n==2) return 1; else return ((fact(n))/((fact(n-2))*2)); } } why is this problem occuring? any possible runtime error reason>?
has comment: http://stackoverflow.com/comment/38829233
favorite count: 0
has answer: http://stackoverflow.com/a/24978414
has title: Strange Run Time Error
possible better answer: http://stackoverflow.com/a/24978293
downvote count: 2
linked to: http://stackoverflow.com/q/5032356
upvote count: 1
has comment: http://stackoverflow.com/comment/38829245
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24978293
tagged with: java

http://stackoverflow.com/comment/38710867
type: Comment
comment on: http://stackoverflow.com/q/24914144
type: QuestionComment
score: 0
has text: Yes, it does help. You had claimed that "fileProvider.delete(fileToDelete, null, null); is throwing a NullPointerException" but that is not true. Rather, FileProvider.delete() ie *the internal implementation* is, which has different implications for what is null.

http://stackoverflow.com/comment/38805148
has text: A word of advice: set up an Event class with common fields that can be extended for corner cases, then write the fields to a SQLite3 database. Millions of little files on your mobile device will only lead to confusion and poor performance.
type: Comment
comment on: http://stackoverflow.com/q/24965229
type: QuestionComment
score: 1

http://stackoverflow.com/q/25046225
has comment: http://stackoverflow.com/comment/39196986
tagged with: google-cloud-datastore
has comment: http://stackoverflow.com/comment/39034395
has comment: http://stackoverflow.com/comment/38969392
type: UnansweredQuestion
tagged with: google-app-engine
has comment: http://stackoverflow.com/comment/39043844
has comment: http://stackoverflow.com/comment/39225151
answer count: 0
has title: How avoid NoTableManagedException on GAE
tagged with: jdo
has comment: http://stackoverflow.com/comment/39185903
type: Question
tagged with: java
has body: When I debug my GAE project on eclipse, using the defautl jdo values configuration, I´m getting the exception "NoTableManagedException" className does not seem to have been enhanced. How can I fix it? Here is part of the pom and the project structure: com.google.code.findbugs jsr305 1.3.9 javax.inject javax.inject 1 com.google.appengine appengine-api-1.0-sdk ${appengine.target.version} com.google.appengine appengine-api-labs ${appengine.target.version} com.google.appengine appengine-endpoints ${appengine.target.version} com.google.appengine appengine-endpoints-deps ${appengine.target.version} com.google.appengine appengine-jsr107cache ${appengine.target.version} org.ow2.asm asm 4.0 org.datanucleus datanucleus-api-jdo 3.1.3 org.datanucleus datanucleus-api-jpa 3.1.3 javax.servlet javax.servlet-api 3.1.0 provided javax.jdo jdo-api 3.0.1 net.sf.jsr107cache jsr107cache 1.1 org.datanucleus datanucleus-core 3.1.3 org.apache.geronimo.specs geronimo-jpa_2.0_spec 1.0 com.google.appengine.orm datanucleus-appengine 2.1.2 javax.transaction jta 1.1 com.google.appengine appengine-testing ${appengine.target.version} test com.google.appengine appengine-api-stubs ${appengine.target.version} test ${project.build.directory}/${project.build.finalName}/WEB-INF/classes org.apache.maven.plugins 3.1 maven-compiler-plugin 1.7 1.7 org.apache.maven.plugins maven-war-plugin 2.4 ${project.build.directory}/generated-sources/appengine-endpoints/WEB-INF/web.xml ${project.build.directory}/generated-sources/appengine-endpoints WEB-INF/*.discovery WEB-INF/*.api com.google.appengine appengine-maven-plugin 1.9.8 -Xdebug -Xrunjdwp:transport=dt_socket,address=1044,server=y,suspend=y true false endpoints_get_discovery_doc org.apache.maven.plugins maven-dependency-plugin 2.8 org.codehaus.mojo versions-maven-plugin 2.1 maven-eclipse-plugin 2.9 true true <additionalProjectnatures> com.google.appengine.eclipse.core.gaeNature </additionalProjectnatures> org.datanucleus datanucleus-maven-plugin 4.0.0-release ${b…
score: 0

http://stackoverflow.com/q/24970914
linked to: http://stackoverflow.com/q/17484764
tagged with: java
tagged with: mysql
type: Question
possible better answer: http://stackoverflow.com/a/24970936
has title: Exception with Java-MySQL connection
has answer: http://stackoverflow.com/a/24970928
accepted answer: http://stackoverflow.com/a/24970928
score: 0
tagged with: exception
tagged with: connector
has answer: http://stackoverflow.com/a/24971276
tagged with: connection
has answer: http://stackoverflow.com/a/24970936
has answer: http://stackoverflow.com/a/24970966
has body: I want to connect to DB with Java and MySQL but I´m having problems. I have a class in a package to connect with MySQL so I only have to create an object of this class in jsp file and this package is in Source Packages. I have added the MySQL Java connector to my Project Libraries too. But when I run the project and try to connect with DB I get an exception and I don't know what is the problem. Can you help me please? Thanks! The exception in NetBeans console: *Grave: null java.lang.ClassNotFoundException: com.mysql.jdbc.Driver at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1714) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1559) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:190) at DataBase.Model_DB.connectToDB(Model_DB.java:41) at DataBase.Model_DB.executeSelect(Model_DB.java:57) at org.apache.jsp._004_002dLogin.registrar_jsp._jspService(registrar_jsp.java:81) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) at javax.servlet.http.HttpServlet.service(HttpServlet.java:728) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334) at javax.servlet.http.HttpServlet.service(HttpServlet.java:728) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171) at org.apache.catalina.valves.ErrorReportValve.invoke(E…
duplicate of: http://stackoverflow.com/q/17484764
answer count: 4
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38815834

http://stackoverflow.com/comment/38844845
type: QuestionComment
comment on: http://stackoverflow.com/q/24979565
score: 1
has text: "...all the other threads..." I've got a feeling that your problem runs deeper than just how to hand off an object reference from one thread to another. (Hint: use a queue) I've got a feeling that you are still struggling to define the responsibilities of each thread. (Hint: Each thread usually should loop, waiting for _just one_ kind of event, and then it should do _just one_ thing to handle the event each time it happens.) You really should post some code that illustrates the structure of your program instead of just talking about it.
type: Comment

http://stackoverflow.com/comment/39011089
has text: Thank you so much. I tried and it works fine except the line in the end of the document.
type: Comment
comment on: http://stackoverflow.com/a/25060078
score: 0
type: AnswerComment

http://stackoverflow.com/a/24954730
has comment: http://stackoverflow.com/comment/38785034
downvote count: 0
has body: I get the result that you expect using weight: <TextView android:id="@+id/TextView02" android:layout_width="wrap_content" android:layout_height="wrap_content" android:ellipsize="end" android:singleLine="true" android:text="Lorem ipsumsvasvdfbfgnbgndnnghnghnghngngnbfgbsdfbsdfdsfvsdfvfv" android:textColor="#ff0000" android:layout_weight="1" android:layout_width="0dp" /> <TextView android:id="@+id/TextView01" android:layout_width="wrap_content" android:layout_height="wrap_content" android:singleLine="true" android:text="Test 2" android:textColor="#00ff00" />
answers question: http://stackoverflow.com/q/24954418
has comment: http://stackoverflow.com/comment/38785085
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/a/24957168
answers question: http://stackoverflow.com/q/24956584
upvote count: 2
has comment: http://stackoverflow.com/comment/101093772
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/48751786
type: Answer
score: 2
downvote count: 0
has body: I've found a solution. Proper ReloadableResourceBundleMessageSource configuration looks like this: <property name="basename" value="classpath:com/mypackage/i18n/messages" /> <property name="useCodeAsDefaultMessage" value="false" /> <property name="fileEncodings" value="UTF-8" /> <property name="defaultEncoding" value="UTF-8" /> <property name="cacheSeconds" value="-1"/>
accepted answer of: http://stackoverflow.com/q/24956584

http://stackoverflow.com/comment/38703659
type: Comment
has text: Your last question along with the other reply helped me solve the issue. I was accidentally saying take a passwordOptions character from a random index between 0 and passwordLength + 1. However the user could set the passwordLength so it wasn't choosing from the full range of characters available in password options. I changed this parameter to (passwordOptions.length()); so that it could pick a character from the whole range of characters available, instead of just a range given by the user. I'm sure you know I am just explaining for others and saying thanks.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24911211

http://stackoverflow.com/a/24937927
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38753788
type: Answer
has body: The output means 'java.exe' is not found in the current directory, nor in the path. Note that setting JAVA_HOME does not imply it is included in the path variable. Also java.exe is located in %JAVA_HOME%\bin You're probably best off modifying the scrip to : "%JAVA_HOME%"\bin\java -jar "%~dp0\apktool.jar" %1 %2 %3 %4 %5 %6 %7 %8 %9* This way you use the JAVA_HOME variable regardless of what the current directory or path variable is.
accepted answer of: http://stackoverflow.com/q/24936560
answers question: http://stackoverflow.com/q/24936560
score: 0

http://stackoverflow.com/comment/38774576
type: QuestionComment
comment on: http://stackoverflow.com/q/24948688
has text: Upgrade your Selenium server and disable auto-updates from firefox. This might be due to mis-match of FF with Selenium
score: 0
type: Comment

http://stackoverflow.com/q/24982217
accepted answer: http://stackoverflow.com/a/24982430
type: Question
tagged with: lazy-loading
answer count: 1
upvote count: 3
has title: Why does this result in non-lazy fetching and N+1 select statements?
tagged with: java
tagged with: hibernate
linked to: http://stackoverflow.com/q/24984188
has answer: http://stackoverflow.com/a/24982430
has body: I expect to get only one sql query, but I run into the N+1 select trap. I don't really understand why. Here is is the problem in detail: I have an entity "PlayerRef": @Entity @Table(name = "player_ref") public class PlayerRef { //constructor etc... @OptimisticLock(excluded = true) @OneToMany(fetch = FetchType.LAZY, mappedBy = "playerRef") public Set&lt;Player&gt; getPlayers() { return players; } } And a class Player: @Entity @Table(name = "player") public class Player { //constructor etc... @OptimisticLock(excluded = true) @ManyToOne(optional = true, fetch = FetchType.LAZY) @JoinTable(name="cr_player_ref_player", joinColumns = { @JoinColumn(name="player_id", unique = true) } ,inverseJoinColumns = { @JoinColumn(name="player_ref_id") } ) public PlayerRef getPlayerRef() { return this.playerRef; } } Now, in my program I use the following HQL query to get all playerRef entities: Query playerRefQ = session.createQuery("select playerRef from PlayerRef playerRef ") .setReadOnly(true); playerRefQ.setParameter("sport", sport); @SuppressWarnings("unchecked") List&lt;PlayerRef&gt; allPlayerRefs = playerRefQ.list(); This results in the N+1 Select statements: 1) select playerref0_.id as id1_21_, playerref0_.... from player_ref playerref0_ N times) select players0_.player_ref_id as player_r1_21_0_, players0_.player_id as player_i2_34_0_, player1_.id as id1_19_1_, player1_...., player1_1_.player_ref_id as player_r1_34_1_, ... from cr_player_ref_player players0_ inner join player player1_ on players0_.player_id=player1_.id left outer join cr_player_ref_player player1_1_ on player1_.id=player1_1_.player_id where players0_.player_ref_id=? This is very unexpected, since I thought the collection is lazy loaded and the set of players of each playerRef should be a hibernate-proxy. Anyone knows how I can really only load the playerRef entities without also loading the associated players? For my use case I need all playerRefs but not the associated players.
type: AnsweredQuestion
score: 3
downvote count: 0
favorite count: 0

http://stackoverflow.com/comment/39121438
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25055867
has text: I've tested this but I cannot make it fail. Basically, the client uses just one connection to the broker (thanks to `CachingConnectionFactory`), no matter how many Threads are used to send the messages. My client is a simple `public static void main()` class. I only get this exception if I start that many clients so that each uses one connection and the number of connections is exhausted.
score: 0

http://stackoverflow.com/comment/39084859
type: Comment
comment on: http://stackoverflow.com/a/25079609
has text: I want to provide one big XML as input and need output in JSON format.
type: AnswerComment
score: 0

http://stackoverflow.com/a/25022988
upvote count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/38936634
answers question: http://stackoverflow.com/q/24993790
type: Answer
has body: -XX:+UseParallelGC uses a parallel collector only for Young generation. It doesn't matter how many threads you have, your Old generation collection always happens in serial mode using only 1 thread if you've only UseParallelGC enabled. Looking at your logs, I see only a summary of GC which is usually the output of -XX+PrintGC which will not give much clue about the issue. I suggest you to try -XX:+PrintGCDetails -XX:+PrintTenuringDistribution -XX:-PrintGCTimeStamps (or) -Xloggc with some location to store ur gc output. Using the above flags, you can find out more details like memory before and after GC for each generation instead of a one-liner In your logs, Full GC might be a Major GC which is happening in your Old generation and with just UseParallelGC flag, its always done using a single thread. After doing some proper analysis, you can use -XX:+UseParallelOldGC which will do the old generation collection in parallel or a CMS or a G1 GC if you're using latest JDK7
score: 2

http://stackoverflow.com/comment/38782515
comment on: http://stackoverflow.com/q/24953306
score: 0
type: Comment
has text: @sᴜʀᴇsʜᴀᴛᴛᴀ if(mat1[i][j] == mat2[i][j])
type: QuestionComment

http://stackoverflow.com/a/25050779
type: Answer
score: 1
has comment: http://stackoverflow.com/comment/38966513
upvote count: 1
has comment: http://stackoverflow.com/comment/38966607
has body: You need to print the output, for example public static void main(String[] args) { Scanner input = new Scanner(System.in); //create a new scanner ToBeReversed = input.nextLine(); System.out.println("ToBeReversed = " + ToBeReversed); Reverse.reversal(); System.out.println("newString = " + newString); System.out.println(Reverse.putTogether()); } I don't want to give a complete answer, as that would spoil your fun (and steal an opportunity for your to get started with using a debugger), but here are some hints... You can use String#charAt to get an individual character from a String at a given index Java is generally 0 indexed, that means that things like arrays, String, List start at index 0 and go through to length - 1 null + String = nullString ;) You can run a loop backwards. for-loop doesn't have to run from 0-x in ascending order, they can run x-0 in descending order ;)
accepted answer of: http://stackoverflow.com/q/25050735
has comment: http://stackoverflow.com/comment/38966334
answers question: http://stackoverflow.com/q/25050735
has comment: http://stackoverflow.com/comment/38966152
has comment: http://stackoverflow.com/comment/38966187
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/38966191
has comment: http://stackoverflow.com/comment/38966358

http://stackoverflow.com/q/25014363
downvote count: 2
upvote count: 1
has answer: http://stackoverflow.com/a/25014400
answer count: 4
has title: why java is unable to initialize a set object?
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/25014383
has body: package generics_practice_test; import java.util.Set; public class Main { public static void main (String args[]) { Set&lt;String&gt; set = new Set&lt;String&gt;();// set object cannot be initialized } } The set object cannot be initialized by Java but when I replace Set by HashSet and import the java.util.HashSet and use the code Set&lt;String&gt; set = new HashSet&lt;String&gt; then the code works. I want to please know why.
has answer: http://stackoverflow.com/a/25014383
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25014445
accepted answer: http://stackoverflow.com/a/25014400
score: -1
has answer: http://stackoverflow.com/a/25014406
tagged with: java

http://stackoverflow.com/comment/38760202
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24941074
has text: Use a List and the `contains` method. Or, if one insists on using a vanilla array, write a recursive method.
score: 0

http://stackoverflow.com/q/24959111
score: 3
upvote count: 3
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26241582
has title: Generating QueryDSL classes with maven fails since 3.1.0
downvote count: 0
has body: When generating QueryDSL's Q... classes with the apt-maven-plugin the maven build fails with a NullPointerException in SimpleSerializerConfig - but only for maven versions since 3.1.0. We already tried debugging into the maven build but that did not lead to any conclusions. The maven configuration looks like this: com.mysema.maven apt-maven-plugin 1.1.1 process target/generated-sources/java com.mysema.query.apt.jpa.JPAAnnotationProcessor true com.mysema.querydsl querydsl-apt ${querydsl.version} com.mysema.querydsl querydsl-jpa apt ${querydsl.version} with ${querydsl.version} being 2.9.0 - using a newer version does not fix the problem. The exact stacktrace is java.lang.RuntimeException: java.lang.NullPointerException at com.sun.tools.javac.main.Main.compile(Main.java:469) at com.sun.tools.javac.api.JavacTaskImpl.call(JavacTaskImpl.java:132) at com.mysema.maven.apt.AbstractProcessorMojo.execute(AbstractProcessorMojo.java:314) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:106) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59) at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:318) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:153) at org.apache.maven.cli.MavenCli.execute(MavenCli.java:555) at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:214) at org.apache.maven.cli.MavenCli.main(MavenCli.java:15…
has answer: http://stackoverflow.com/a/24971207
answer count: 3
tagged with: querydsl
accepted answer: http://stackoverflow.com/a/24971207
favorite count: 0
possible better answer: http://stackoverflow.com/a/45875910
has answer: http://stackoverflow.com/a/45875910
tagged with: maven
type: AnsweredQuestion

http://stackoverflow.com/q/25020348
answer count: 2
possible better answer: http://stackoverflow.com/a/25020684
has answer: http://stackoverflow.com/a/25020684
has title: Java unable to import normal libraries in eclipse
has body: This question may be too easy for you guys, but I'm really new to java and have no idea how to solve it. I added some external libraries to my project in eclipse, which work well, but some of my normal imports show errors, and has red line under import. like: import java.awt.Dimension; import java.io.File; import java.io.IOException; How should I solve this? Thank you in advance.
has answer: http://stackoverflow.com/a/25020417
type: AnsweredQuestion
tagged with: java
type: Question
tagged with: eclipse
accepted answer: http://stackoverflow.com/a/25020417
score: 0

http://stackoverflow.com/q/24976211
tagged with: serialization
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38825473
has body: This could just be me being stupid, but I'm opening up two different applications on my computer that connect to the same port of a server running on the computer. Now, it's fine with one application connected, but once the other one is launched it starts throwing a bunch of exceptions about java.io.StreamCorruptedException: invalid type code: AC.. Is this because I'm trying to have the 1 server + 2 clients running on the same machine? Edit: Code: Socket socket = new Socket(InetAddress.getByName("127.0.0.1"),12352); SocketThread sthread = new SocketThread(socket); ... sthread.start(); Inside the socket thread: this.ois = new ObjectInputStream(socket.getInputStream()); &lt;-- ois is a variable for the ObjectInputStream ... Packet packet = (Packet) ois.readObject(); &lt;-- Error appears on this line. Edit #2: Second - server code: while(true) { Socket player = server.accept(); System.out.println(player.getRemoteSocketAddress().toString() + " connected."); startSocket(player); } public static void startSocket(Socket player) throws IOException { new SocketThread(player).start(); } Now, there is no errors on the server.
accepted answer: http://stackoverflow.com/a/24976305
score: 0
answer count: 1
tagged with: java
has title: Opening up two sockets in java from different instances of an application to the same source
has answer: http://stackoverflow.com/a/24976305
linked to: http://stackoverflow.com/q/2393179
has comment: http://stackoverflow.com/comment/38825595
duplicate of: http://stackoverflow.com/q/2393179

http://stackoverflow.com/q/25066032
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38994807
has body: Added an OnClickListener to my button. I would like it to switch to 'Step1' activity when I click the button. When I debugged it, I clicked on the button but nothing happened. It stayed on 'MyActivity' activity. Here's my main activity: package apk.olley102.roothelp; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.TextView; public class MyActivity extends Activity { Button step1btn; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_my); step1btn = (Button) findViewById(R.id.step1btn); step1btn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent openStep = new Intent("apk.olley102.roothelp.Step1"); startActivity(openStep); } }); } } I added the button in the activity_main.xml and associated the layout to the activity. Also added MainActivity.java and Step1.java to the AndroidManifest.xml Any help would be appreciated!
tagged with: java
has comment: http://stackoverflow.com/comment/39034525
accepted answer: http://stackoverflow.com/a/25107091
type: Question
has comment: http://stackoverflow.com/comment/38994875
has title: Android Studio - Button click not switching to next activity
has comment: http://stackoverflow.com/comment/38995063
score: 0
answer count: 2
possible better answer: http://stackoverflow.com/a/25089345
has answer: http://stackoverflow.com/a/25089345
has answer: http://stackoverflow.com/a/25107091
has comment: http://stackoverflow.com/comment/38994986
tagged with: android
has comment: http://stackoverflow.com/comment/38995461

http://stackoverflow.com/a/24982130
answers question: http://stackoverflow.com/q/24982076
has comment: http://stackoverflow.com/comment/38836442
has comment: http://stackoverflow.com/comment/38836493
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/38836486
has comment: http://stackoverflow.com/comment/38836571
has body: You can change the title of actionbar using setTitle() method: setTitle("awsome");

http://stackoverflow.com/comment/39180360
type: Comment
score: 0
type: AnswerComment
has text: Could you please clarify the absolute path to your doc file in the ptoduction environment.
comment on: http://stackoverflow.com/a/25003267

identifier
tag name: identifier
type: Tag
tags question: http://stackoverflow.com/q/24929076

http://stackoverflow.com/comment/38785366
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/24925905
has text: I suggest you try to implement some of this functionality yourself and come back with a precise coding question. You hide and show things by removing and adding them to the screen (or a Manager that is added to the screen). So add a ButtonField to this screen, and have the ButtonField change listener add additional Fields.
type: Comment

http://stackoverflow.com/comment/39766413
has text: :For that I would have to type each and every folder and its sub-folders name which is not practical in case of multiple folders.@DavidPostill:I am not deleting the original .java files.Will make .class files of a copy of j.ava files
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24979666

http://stackoverflow.com/a/25015632
score: 1
answers question: http://stackoverflow.com/q/25015338
downvote count: 0
upvote count: 1
type: Answer
has body: There is no way to do this with Java since the Java runtime has no clear way to say "this is application A and this is B". When you run several applications in one Java VM, you're just running one: JBoss. JBoss then has a very complex classloader but the app you're profiling is actually JBoss. To do what you want to do, you have to apply filters but this only works when you have a memory leak in a class which isn't shared between applications (so when com.pany.app.a.Foo leaks, you can do this). If you can't use filters, you have to look harder at the numbers to figure out what's going on. That means you'll probably have to let the app server run out of memory, create a heap dump and then look for what took most of the memory and work from there. The only other alternative is to install a second server, deploy just one app there and watch it.

http://stackoverflow.com/a/24973051
has body: create Class according to those attributes. download Gson of Google Class Example Name : Objects Example : String json = "...."; Gson gson = new Gson(); Objects obj = (Objects) gson.fromJson(json,Objects.class); Hope it Helps.
type: Answer
score: 0
answers question: http://stackoverflow.com/q/24972589

http://stackoverflow.com/a/25079958
has body: A continue statement without a label will re-execute from the condition the innermost while or do, or loop, and from the update expression the innermost for loop. It is often used to early-terminate a loop's processing and thereby avoid deeply-nested if statements. In the following example continue will get the next line, without processing the following statement in the loop. while (getNext(line)) { if (line.isEmpty() || line.isComment()) continue; // More code here } With a label continue will execute in the same way the correspondingly labeled loop. This can be used to escape deeply-nested loops, or simply for clarity. If you're truly perverse you can also use it to simulate a limited form of goto. In the following example the continue will re-execute the for (;;) loop. aLoopName: for (;;) { // ... while (someCondition) // ... if (otherCondition) continue aLoopName; Sometimes continue is also used as a placeholder in order to make an empty loop body clearer. for (count = 0; foo.moreData(); count++) continue; The same statement without a label also exists in C and C++. In Perl it's named next. source
answers question: http://stackoverflow.com/q/24996852
score: 0
type: Answer

http://stackoverflow.com/q/25054482
has answer: http://stackoverflow.com/a/25056859
has comment: http://stackoverflow.com/comment/38974955
has comment: http://stackoverflow.com/comment/38975324
score: 0
answer count: 2
tagged with: file-io
has comment: http://stackoverflow.com/comment/38975141
has comment: http://stackoverflow.com/comment/38975356
has answer: http://stackoverflow.com/a/25056810
accepted answer: http://stackoverflow.com/a/25056810
has comment: http://stackoverflow.com/comment/38975904
has comment: http://stackoverflow.com/comment/38973012
has body: I am trying to read a jpeg image in java and convert it into two dimensional array. Code is as follows import java.awt.image.BufferedImage; import java.io.IOException; import java.net.URL; import javax.imageio.ImageIO; public class JpegToArray { public static void main(String[] args) throws IOException { URL url = JpegToArray.class.getResource("img/abc.jpg"); BufferedImage img = ImageIO.read(url); @SuppressWarnings("unused") int[][] _img = convert_to_2d_Array(img); } private static int[][] convert_to_2d_Array(BufferedImage image) { int width = image.getWidth(); int height = image.getHeight(); int[][] result = new int[height][width]; for (int row = 0; row &lt; height; row++) { for (int col = 0; col &lt; width; col++) { result[row][col] = image.getRGB(col, row); System.out.println(result[row][col]); } } return result; } } When I run ths in Eclipse following error occurs Exception in thread "main" java.lang.IllegalArgumentException: input == null! at javax.imageio.ImageIO.read(ImageIO.java:1388) at JpegToArray.main(JpegToArray.java:11) What am I doing wrong here?
has comment: http://stackoverflow.com/comment/38975079
tagged with: input
possible better answer: http://stackoverflow.com/a/25056859
tagged with: javax.imageio
type: AnsweredQuestion
has title: Error reading file in java
has comment: http://stackoverflow.com/comment/38975334
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/38973125
has comment: http://stackoverflow.com/comment/38973006
has comment: http://stackoverflow.com/comment/38973000
has comment: http://stackoverflow.com/comment/38973124

http://stackoverflow.com/q/25058362
has answer: http://stackoverflow.com/a/25058510
score: 0
has body: I have a word document with sample text from new york times like below: Sample Text: KABUL, Afghanistan – Secretary of State John Kerry began a series of meetings in Kabul on Friday in hopes of finding a way out of a presidential election crisis that has threatened to split the Afghan government and prompted Western officials to warn that Afghanistan risked losing billions of dollars in air on which it depends. When I upload the document to docx4java online demo I get the following PartsList: &lt;w:p w14:paraId="4CB9CEA6" w14:textId="77777777"&gt; &lt;w:r&gt; &lt;w:t&gt;Sample Text:&lt;/w:t&gt; &lt;/w:r&gt; &lt;/w:p&gt; &lt;w:p w14:paraId="0F399D69" w14:textId="77777777"/&gt; &lt;w:p w14:paraId="0C68A7DC" w14:textId="6C93B9E5"&gt; &lt;w:r&gt; &lt;w:t&gt;KABUL, Af&lt;/w:t&gt; &lt;/w:r&gt; &lt;w:r&gt; &lt;w:t&gt;g&lt;/w:t&gt; &lt;/w:r&gt; &lt;w:r&gt; &lt;w:t xml:space="preserve"&gt;hanistan – Secretary of State John Kerry began a series of meetings in Kabul on Friday in hopes of finding a way out of a presidential election crisis that has threatened to split the Afghan government and prompted Western officials to warn that Afghanistan risked losing billions of dollars in air on which it depends. &lt;/w:t&gt; &lt;/w:r&gt; &lt;w:bookmarkStart w:name="_GoBack" w:id="0"/&gt; &lt;w:bookmarkEnd w:id="0"/&gt; &lt;/w:p&gt; Note how the word Afghanistan is broken into three different tags? I'm not sure why that happens. I am extracting text from this docx using docx4j with the code below: StringBuilder builder; class DocumentTraverser extends TraversalUtil.CallbackImpl { @Override public List&lt;Object&gt; apply(Object o) { if (o instanceof org.docx4j.wml.Text) { builder.append(((org.docx4j.wml.Text) o).getValue()); } return null; } } Using this code builder has the following content: Sample Text:KABUL, Afghanistan – Secretary of State John Kerry began a series of meetings in Kabul on Friday in hopes of finding a way out of a presidential election crisis that has threatened to…
answer count: 1
type: UnansweredQuestion
has title: How to fetch all text from the DOCX as-is
tagged with: java
type: Question
tagged with: docx4j

http://stackoverflow.com/comment/39060691
comment on: http://stackoverflow.com/a/24928787
has text: You should given an example - link-only replies are discouraged on SO and liable to be closed.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/38829378
type: Comment
comment on: http://stackoverflow.com/a/24978197
has text: There are many problems about server side session variables. The most big one is server scaleable and performance. Consider if you got many servers, and one of them down, what would happen? The session datas in this server would lost. Of course you can stored your session datas in db or memcached server, but that means all session operations triggers a net IO, that costs lot.
type: AnswerComment
score: 2

http://stackoverflow.com/comment/38747456
type: Comment
comment on: http://stackoverflow.com/a/24934423
type: AnswerComment
score: 0
has text: Oh. Good call, I thought that the queries waiting for a commit were stored in a temp space into the database. But if they are also stored into my application, that explains why it gets slower, and why the heap space explodes. I'll try to comment my `begin()` and `commit()`, and let's see if it speeds up :)

http://stackoverflow.com/comment/38986090
has text: Thank you for you reply, I forgot to mention I don't want to set the addressList to null. I updated my question.
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25061122

http://stackoverflow.com/a/24951687
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24932061
score: 0
type: Answer
answers question: http://stackoverflow.com/q/24932061
has body: So, in the end, this code was just fine. It worked today. To answer the question: where to look first in a similar case (SELECT works but UPDATE / INSERT / DELETE does not) If rights are not the problem, then there is probably a lock on the table you try to modify. In my case, someone left with an uncommited transaction open. Proper SQL exceptions logging (which was suboptimal in my case) will help you figure it out.

http://stackoverflow.com/comment/38972151
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25054052
score: 1
has text: implements != extends

http://stackoverflow.com/comment/38801250
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24962891
has text: Don't you want `roundNearestTiesToEven` instead of `roundTowardZero`?

http://stackoverflow.com/comment/38836477
score: 0
type: AnswerComment
has text: It would help if you edited the post to include some actual use cases. Why do you search with `Price=17` and `Brand=Dunlop` and what do you do with the results. What are these category brackets used for?
type: Comment
comment on: http://stackoverflow.com/a/24962071

http://stackoverflow.com/comment/38821109
score: 0
type: QuestionComment
has text: @geonal yeah i've notice that too, i'm using a different tool now for my Rest request (IntelliJ plugin ) and i don't get the following exception but the parameter: budgetPerDate is sending as null for some reason
type: Comment
comment on: http://stackoverflow.com/q/24972437

http://stackoverflow.com/comment/38965483
score: 1
comment on: http://stackoverflow.com/a/25050002
type: AnswerComment
has text: You should put it in the onPostExecute method on your AsyncTask class. This way, when the task finishes, it will put the arraylist(s) into the intent and start the new activity
type: Comment

http://stackoverflow.com/comment/38815592
has text: Could you please clarify where the ToDo.html is located? If I had understood your comment correctly all you want to do is display a view template for the */todo* route.
comment on: http://stackoverflow.com/a/24960939
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/38924193
score: 0
comment on: http://stackoverflow.com/a/25018666
type: AnswerComment
has text: Thanks, but I have a more complicated one. for example : n3=x2* (n1+n2- n1*n2) +x1* (n1-n2) *(n1-n2), then how to deal with it? here all variables are all 0 or 1.
type: Comment

http://stackoverflow.com/q/24910262
has comment: http://stackoverflow.com/comment/38701837
tagged with: java
tagged with: whitespace
has comment: http://stackoverflow.com/comment/38701016
has comment: http://stackoverflow.com/comment/38701269
has answer: http://stackoverflow.com/a/24910643
accepted answer: http://stackoverflow.com/a/24910643
type: Question
downvote count: 2
score: -2
answer count: 1
has comment: http://stackoverflow.com/comment/38701688
has title: How to remove the space and "\n" only in both ends
has comment: http://stackoverflow.com/comment/38701139
has comment: http://stackoverflow.com/comment/38700996
linked to: http://stackoverflow.com/q/2461331
has comment: http://stackoverflow.com/comment/38701187
tagged with: string
has body: I have read the thread of How to remove the \n, \t and spaces between the strings in java? But I hope to reserve the space or \n in the middle, so that at last I will check every split the elements by space or \n as commands. And something is even more,for example. If the user enter \n command1\n command2 \n(and the command may be more than twice or only once). I hope to get the String as command1 command2. It will be great that if the \n in the middle will be all replaced as white space since after that, I will only need to NEWSTRING.split(" ") to get all the command. But it is ok to keep the '\n'(mutiple times) inside So, if the string is splited by \n or space, I just hope to keep the space, but if there are \n(perhaps multiple times), it is ok to keep them in the middle. In conclusion, I hope my String will be formated as "some string"+[space or \n] +""some string". If the Regrex can not help me, any good way to do that? Thank you very much! More example: The reason I do this is that I hope to understand what command user is exactly speaking. For example, he may say " 1 " which means only "1", and he may says"\n1\n apple\n "which means "1 apple".
favorite count: 0
upvote count: 0
has comment: http://stackoverflow.com/comment/38701144
tagged with: regex
has comment: http://stackoverflow.com/comment/38701107
has comment: http://stackoverflow.com/comment/38701691
has comment: http://stackoverflow.com/comment/38701418
type: AnsweredQuestion

http://stackoverflow.com/a/24973452
has comment: http://stackoverflow.com/comment/38894438
score: 3
has comment: http://stackoverflow.com/comment/38821613
upvote count: 3
has comment: http://stackoverflow.com/comment/38894216
has comment: http://stackoverflow.com/comment/38820978
has body: here's how we did it: for every application/service (ear or war, take your pick), have a "startupFinished" @Startup @Singleton. this singleton will depend on all other singletons within that application - those would be that singletons that do all the actual init work (and to avoid pitfalls with lazy-initialization of reference its best to call some isInitialized() method on all of them). all MDBs within an application depend on that application's StartupFinished singleton (see this question for how). for dependencies across applications (cross ears) - if A.ear depends on B.ear have A's StartupFinished singleton inject B's StartupFinished (you will need to expose it as a @Remote EJB). even better, to do this properly you will need a StartupStarted singleton in A that depends on B's StartupFinished one - to really make sure that B is entirely and completely up before A starts initialization.
answers question: http://stackoverflow.com/q/24973381
downvote count: 0
type: Answer

http://stackoverflow.com/q/25054095
accepted answer: http://stackoverflow.com/a/25662944
has comment: http://stackoverflow.com/comment/38972688
has comment: http://stackoverflow.com/comment/38972507
type: AnsweredQuestion
has title: How to solve java.sql.SQLNonTransientConnectionException: Could not read resultset: Connection reset?
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/38972485
has comment: http://stackoverflow.com/comment/40246134
tagged with: mysql
has body: I am getting an exception when calling database code after a period of inactivity java.sql.SQLNonTransientConnectionException: Could not read resultset: Connection reset at org.mariadb.jdbc.internal.SQLExceptionMapper.get(SQLExceptionMapper.java:136) at org.mariadb.jdbc.internal.SQLExceptionMapper.throwException(SQLExceptionMapper.java:106) at org.mariadb.jdbc.MySQLStatement.executeQueryEpilog(MySQLStatement.java:264) at org.mariadb.jdbc.MySQLStatement.execute(MySQLStatement.java:288) at org.mariadb.jdbc.MySQLStatement.executeQuery(MySQLStatement.java:302) at org.mariadb.jdbc.MySQLStatement.executeQuery(MySQLStatement.java:361) at org.apache.commons.dbcp.DelegatingStatement.executeQuery(DelegatingStatement.java:208) at org.apache.commons.dbcp.DelegatingStatement.executeQuery(DelegatingStatement.java:208) at com.vimba.database.DBFactory.attemptLoginWithTempPasswordDetails(DBFactory.java:181) at com.vimba.database.DBFactory.authenticate(DBFactory.java:131) at com.vimba.service.ExposedFunctions.login(ExposedFunctions.java:88) 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.xml.ws.api.server.InstanceResolver$1.invoke(InstanceResolver.java:210) at com.sun.xml.ws.server.InvokerTube$2.invoke(InvokerTube.java:132) at com.sun.xml.ws.server.sei.EndpointMethodHandler.invoke(EndpointMethodHandler.java:241) at com.sun.xml.ws.server.sei.SEIInvokerTube.processRequest(SEIInvokerTube.java:74) at com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:559) at com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:518) at com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:503) at com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:400) at com.sun.xml.ws.server.WSEndpointImpl$2.process(WSEndpointImpl.java:226) at com.sun.xml.ws.transport.http.HttpAdapter$HttpTool…
has comment: http://stackoverflow.com/comment/38972549
upvote count: 1
has comment: http://stackoverflow.com/comment/38972356
type: Question
has comment: http://stackoverflow.com/comment/38972721
has comment: http://stackoverflow.com/comment/38972259
has answer: http://stackoverflow.com/a/25662944
has answer: http://stackoverflow.com/a/72001572
has comment: http://stackoverflow.com/comment/39011284
answer count: 3
possible better answer: http://stackoverflow.com/a/25685453
tagged with: sql
has comment: http://stackoverflow.com/comment/120356444
downvote count: 0
has answer: http://stackoverflow.com/a/25685453
tagged with: mariadb
has comment: http://stackoverflow.com/comment/38973131
favorite count: 0
tagged with: exception

http://stackoverflow.com/q/24972005
has comment: http://stackoverflow.com/comment/38818164
tagged with: casting
score: 0
answer count: 3
tagged with: exception
has body: I'am working on a class to simplify the handling of sockets. I have an InputStream which contains the received message and I want to cast it to another class defined by the user when he declare my class. So that's the code private T read() throws IOException, ClassNotFoundException{ ObjectInput ois = new ObjectInputStream (reader); T message = (T) ois.readObject(); return message; } But it throws an exception : ClassNotFoundException I d'ont know why. When T is of type String it works well but when it's a custom class it doesn't. So I'm asking here :p Thank you in advance
has answer: http://stackoverflow.com/a/24972036
has comment: http://stackoverflow.com/comment/38817859
has answer: http://stackoverflow.com/a/24972121
type: UnansweredQuestion
tagged with: sockets
tagged with: stream
has answer: http://stackoverflow.com/a/24972392
tagged with: java
has title: Cast from Object to T
has comment: http://stackoverflow.com/comment/38818217
type: Question

http://stackoverflow.com/q/25067871
type: AnsweredQuestion
downvote count: 0
tagged with: swing
has comment: http://stackoverflow.com/comment/39001862
type: Question
has comment: http://stackoverflow.com/comment/39001767
has comment: http://stackoverflow.com/comment/39001027
tagged with: java
accepted answer: http://stackoverflow.com/a/25074123
has body: I'll start explaining from the bottom to top, so you will actually understand what I was trying to do, and understand my code better. I am creating a library, that let's you capture an area, whether if the capture is a gif animation or an image. After capturing is finished, the library will return an object that contains ByteArrayInputStream and util methods like createImage etc. While reading this, you can have access to the library here: https://github.com/BenBeri/WiseCapturer/ Now this is a dummy example on how my library works: Your application creates an instance of bootstrap with the capturer class, and begins a capture: public static void main(String[] args) throws AWTException { final Bootstrap b = new Bootstrap(new ScreenshotCapturer()); b.beginCapture(new ScreenCaptureCallback() { @Override public void captureEnded(CapturedImage img) { b.beginCapture(new ScreenCaptureCallback() { @Override public void captureEnded(CapturedImage img) { JFrame frame = new JFrame(); frame.add(new JLabel(new ImageIcon(img.getBufferedImage()))); frame.pack(); frame.setVisible(true); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } }); } }); } The listener will return CapturedImage which you can use to do whatever you wish to. Now with this example, this should let you capture twice, once and again after you're done, and once it's done, it will show the 2nd capture in a JFrame window. Now I am not talking about this JFrame. The problem only occurs with ScreeenshotCapturer, it will work fine with GifCapturer instance. The problem After finishing the first capture, the second capture JFrame transparent window will not come up, I don't see it in the windows toolbar, nor anywhere, but the application still runs. However, as I said it does work if I use GifCapturer instance. Now let's debug how my library works: Bootstrap constructor: /** * Bootstrap consturctor, let it bootstrap! * @param c * Capturer instance * @throws AWTException */ public Bootstrap(Capturer c) throws AWTE…
upvote count: 2
has title: Java JFrame won't show up after using .setVisible(true) after being invisible
tagged with: user-interface
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/25074123
has comment: http://stackoverflow.com/comment/39002529
has comment: http://stackoverflow.com/comment/39002645
score: 2

http://stackoverflow.com/comment/38975438
comment on: http://stackoverflow.com/q/25055742
score: 0
type: Comment
type: QuestionComment
has text: Try my suggestion and look the generated code there. SO you can modify it the way you want.

http://stackoverflow.com/comment/38875392
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25002681
score: 0
has text: What do you mean by "exclude all methods from old API"? Are you talking about code completion? Maybe you should start with the `@Deprecated` annotation?

http://stackoverflow.com/comment/38781444
score: 1
comment on: http://stackoverflow.com/a/24951985
type: AnswerComment
has text: I wasn't aware how a marked error influences other error markings. The first error marking in a Java source file does not have to be the first error [top down] in a source file. Also correcting one error [witch removes the error marking] can show new error markings above or below the corrected line or remove one or more error markings from the file.
type: Comment

http://stackoverflow.com/q/25016179
answer count: 1
has body: So, I have my SQLite DataBase set-up, but now I want to know how can I make data update if a certain name already exist. For example, my app has the user input the name of a chore or errand. Then I have the user input information about this chore or errand such as priority, and time needed to complete the task. And when the user clicks a "create activity" button, my code creates a button with the name of the chore as its text. And I have my app set-up where the user can click on this chore button, and it will show the information that was entered in for this specific chore. It leads the user to another activity in which the user can change the information about the chore(such as priority and time needed), but it doesn't allow them to change the name of the chore. And so, when the user clicks on a button saying "update", I want my data base to identify the chore by its name, and replace every other variable. I have looked up other post on this question, and I have found satisfying answers, but I can not figure out the odd syntax that is needed to write a SQlite method. I saw a post that says this code is how you would update data: INSERT OR REPLACE INTO Employee (id, role, name) VALUES ( 1, 'code monkey', (SELECT name FROM Employee WHERE id = 1) ); But, I'm a beginner to using a SQLite database, and so I'm confused on what the whole method code would look like. Could you post an update method code that uses name, timeNeeded, and priority as the columns, and mytable as the table name. I need the code to identify the data set by the name, and update the other data. Please include the parameters, complete syntax, and return code if needed. This is code I was able to come up with when I tried to create my own update code: public void UpdateData(String activityName,int priority, int leastTime) { String sql="UPDATE "+TABLE_NAME+ " SET priority='"+priority+"' ,leastTime='"+leastTime+"' ,activityName='"+activityName; db.execSQL(sql); }
has comment: http://stackoverflow.com/comment/38901184
has answer: http://stackoverflow.com/a/25016733
accepted answer: http://stackoverflow.com/a/25016733
favorite count: 0
has comment: http://stackoverflow.com/comment/38901543
tagged with: android
has comment: http://stackoverflow.com/comment/38901160
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38901528
has title: How to Update the data in a SQLite database?
tagged with: java
downvote count: 1
type: Question
score: -1
upvote count: 0
tagged with: sqlite

http://stackoverflow.com/q/25029906
has comment: http://stackoverflow.com/comment/38942903
has comment: http://stackoverflow.com/comment/38938368
has comment: http://stackoverflow.com/comment/38941953
has comment: http://stackoverflow.com/comment/39343736
type: Question
has comment: http://stackoverflow.com/comment/38926736
has title: A way to filter data at selection on DB with spring and JPA
has comment: http://stackoverflow.com/comment/38941056
has body: I'm looking for a simple and practice solution to have the following: a) filter data on DB on a certain field stored on a Table (example: if field status is greater than 5 then it would never return) b) this filter has to work with field with values and null values (for example Date types) c) I would forgot for the future to remember every time when I write a select or JPA method that has access to this table to add this "filter". Concrete Example: I have a Repository for Users where I access and get back the list of all users. Now I whant to add a condition/filter that say that only users with status 5 have to return. Then I can write ewryting like this: List&lt;User&gt; findAllAndTypeGreatherThan(int status); Now when I came back in a few months and I have to add a new method like List&lt;User&gt; findByName(String name); I musst remember that I have to filter out the types greater than 5 or I forget this. I don't whant remeber this..... How can I solve this?
score: 0
tagged with: jpa
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38974221
tagged with: spring
has comment: http://stackoverflow.com/comment/38933842
has comment: http://stackoverflow.com/comment/38933554
has comment: http://stackoverflow.com/comment/38938322
has comment: http://stackoverflow.com/comment/38983403
has comment: http://stackoverflow.com/comment/38926771
answer count: 0
has comment: http://stackoverflow.com/comment/38954833
tagged with: java
has comment: http://stackoverflow.com/comment/38940347

http://stackoverflow.com/comment/38712479
comment on: http://stackoverflow.com/a/24915871
type: AnswerComment
score: 0
type: Comment
has text: The method delete(String, String, String[]) in the type SQLiteDatabase is not applicable for the arguments (String, String)..I see this

http://stackoverflow.com/q/24914067
has comment: http://stackoverflow.com/comment/38709936
favorite count: 0
has comment: http://stackoverflow.com/comment/38709133
has comment: http://stackoverflow.com/comment/38708747
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38709219
tagged with: windows
has comment: http://stackoverflow.com/comment/38708670
has title: Making a jar file runnable on other machines?
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/38709131
has comment: http://stackoverflow.com/comment/38709646
upvote count: 1
has comment: http://stackoverflow.com/comment/38710331
has answer: http://stackoverflow.com/a/24914314
type: Question
has comment: http://stackoverflow.com/comment/38708754
has comment: http://stackoverflow.com/comment/38709189
has comment: http://stackoverflow.com/comment/38708917
has answer: http://stackoverflow.com/a/24914452
answer count: 3
has body: I have created jar file that performs some file operations and I need to distribute them to a few people on the network. To my surprise though, the jar isn't runnable on their machines! I was told that another working was able to get it to run by installing the Java developer's kit, but this isn't the best way if I need to distribute to multiple people. What are my options here, and what are the 'best practice' solutions? I would prefer not to install the JDK (I think I only need the JRE here but haven't tested), would I simply be able to rewrite the jar into an applet so that it could run in a browser? Or should I just pop up a link to the latest JRE version and ask that they download it? Edit: I created the jar through eclipse(Export>Runnable Jar) and it produces a runnable jar that I can run. When moved to another machine windows does not know what to open the file with. It would seem I need the JRE (the java we install on our machines is just the browser plug in, not the JRE I have found.) I was wondering if there was a way to do more work on my end to prevent this so that the end use would have it simpler (Launch4j has been suggested and is what I am moving into, or simply installing manually.) I have taken a few classes in java but they are pure coding and never covered how a jar should be 'distributed'.
downvote count: 0
has answer: http://stackoverflow.com/a/24914286
tagged with: jar
has comment: http://stackoverflow.com/comment/38708850

http://stackoverflow.com/q/25022699
has answer: http://stackoverflow.com/a/25037606
tagged with: z3c.form
upvote count: 3
type: UnansweredQuestion
has body: I am trying to learn Z3 using the java API, since there is not documentation I've been looking at the C API documentation but until now I can't find a clear example of how to use some basic functions. I am trying to encode this Z3 code (which works in the online version) ;general options for getting values when sat (set-option :produce-models true) (set-option :produce-assignments true) ;declaring new sorts (declare-sort Task) (declare-sort User) ;function for assign an specific user (declare-fun assignUser (Task) User) ;creating a relation between a task and a usert (declare-fun TaskUser (Task User) Bool) ;stablishing order (declare-fun mustPrecede (Task Task) Bool) (assert(forall((t Task)) (not (mustPrecede t t)))) (assert(forall((t1 Task)(t2 Task)(t3 Task)) (implies (and (mustPrecede t1 t2)(mustPrecede t2 t3)) (mustPrecede t1 t3)))) ;asserting that all task must have one assigned user (assert(forall((t Task)(u User)) (TaskUser t u))) ;asserting that all task must have one assigned user ;(assert(forall((t1 Task)(t2 Task)) (not(= (assignUser t1) (assignUser t2))))) Until now I just manage to declare the uninterpreted sorts and to declare my functions as follows HashMap&lt;String, String&gt; cfg = new HashMap&lt;String, String&gt;(); cfg.put("proof", "true"); cfg.put("auto-config", "false"); Context ctx = new Context(cfg); //cfg.put("model", "true"); Sort USER = ctx.mkUninterpretedSort("USER"); Sort TASK = ctx.mkUninterpretedSort("TASK"); FuncDecl assignUser = ctx.mkFuncDecl("assignUser", TASK, USER); FuncDecl TaskUser = ctx.mkFuncDecl("TaskUser", new Sort[] { TASK, USER }, ctx.mkBoolSort()); FuncDecl mustPrecede = ctx.mkFuncDecl("mustPrecede", new Sort[]{TASK,TASK}, ctx.mkBoolSort()); but I can't find an example to express (assert(forall((t Task)) (not (mustPrecede t t)))) (assert(forall((t1 Task)(t2 Task)(t3 Task)) (implies (and (mustPrecede t1 t2) (mustPrecede t2 t3)) (mustPrecede t1 t3)))) ;asserting that all task must have one assigned user (assert(forall((t Ta…
has answer: http://stackoverflow.com/a/25025087
tagged with: z3py
type: Question
tagged with: z3
score: 3
tagged with: java
answer count: 2
downvote count: 0
favorite count: 0
has title: Use of "for all" with Uninterpreted sorts JAVA API

http://stackoverflow.com/comment/38813022
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/24969599
has text: No. You don't show how this input is used and how the output is created.
type: Comment

http://stackoverflow.com/a/25020308
answers question: http://stackoverflow.com/q/25020205
has body: Create a class that extends AsyncTask and put your async method in doInBackground(...) like this: private classImageUpload extends AsyncTask&lt;String, Void, String&gt; { @Override protected String doInBackground(String... params) { //your upload code here return "Executed"; } @Override protected void onPostExecute(String result) {} @Override protected void onPreExecute() {} @Override protected void onProgressUpdate(Void... values) {} } Then call your asyncTask in oncreate method like this: new ImageUpload().execute();
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25020205
type: Answer
upvote count: 1
score: 1

http://stackoverflow.com/comment/38742864
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24932131
has text: Cool. Simply ignoring the two possibilities I made explicit to you is ... somewhat ... _ignorant_. Especially, when _throwing in_ an exception that still does not match the code.

robolectric
tags question: http://stackoverflow.com/q/24984406
tags question: http://stackoverflow.com/q/25042364
type: Tag
tags question: http://stackoverflow.com/q/25051580
tag name: robolectric
tags question: http://stackoverflow.com/q/24999471

http://stackoverflow.com/comment/38972549
type: QuestionComment
has text: will add some examples of where it fails now to the question
score: 0
comment on: http://stackoverflow.com/q/25054095
type: Comment

http://stackoverflow.com/comment/38774351
type: Comment
has text: I think. Basically I want to make a new node so that it can be filled by the next scan.nextInt(); call. If I take that line out will my Node n = new Node(); do that?
comment on: http://stackoverflow.com/a/24948605
score: 0
type: AnswerComment

http://stackoverflow.com/comment/38960451
comment on: http://stackoverflow.com/q/25047627
score: 0
has text: Agreeing with @Baldy, player is null, hence the null pointer exception (at least if pressing stop twice)
type: QuestionComment
type: Comment

http://stackoverflow.com/a/24976729
downvote count: 0
answers question: http://stackoverflow.com/q/24976181
score: 1
has comment: http://stackoverflow.com/comment/38830741
has body: If I have big object is there's a way to handle it so I don't have to regroup it because the limit size of tcp packet. (I cant know when the single object is fully transferred to me as client or not yet) Actually, the client can know when it has received a complete JSON object. When your client sees the } that matches the opening {, you have the complete object. Of course, this means that that your client needs to understand JSON syntax, but you can use an off-the-shelf JSON parser to do that. So the best way to do this is for the server to generate and send the JSON, and the client to parse the socket input stream using a normal JSON parser. If you do it that way, then you don't need to know whether the TCP/IP stack has broken the data stream into multiple packets. By the time the JSON parser sees them, they will have been reassembled into a stream of bytes. If this doesn't answer your question, we need to see what your code is currently doing to generate and send the JSON on the server side.
upvote count: 1
type: Answer

http://stackoverflow.com/a/24966647
type: Answer
upvote count: 1
downvote count: 1
answers question: http://stackoverflow.com/q/24962863
score: 0
has body: Since you are using Braintree's Client-side Encryption flow, according to their documentation, you cannot access the unencrypted version of the sensitive information (i.e. credit card numbers). This is done on purpose, so that you can reduce security risks and maintain PCI compliance. Braintree states in this post: Once the user presses the “Submit” button on the form containing their credit card information, you use a Braintree-provided JavaScript library to encrypt sensitive fields before the form is ever posted to your server. The sensitive non-encrypted data is not included on the form that is submitted and, therefore, will never pass through your system. However, all other fields will be available to you. This means you can perform custom validations, formatting, and logging to your heart’s content without exposing yourself to the security risk and extra PCI compliance requirements of having unencrypted credit card data passing through your environment. Also note that there is no way to decrypt the data either as you do not have access to the decryption keys. If you want to gain access to the actual sensitive credit card data then I think you'll have to take a different approach. The Server-to-Server flow looks like your best bet. Braintree states: S2S works in a similar fashion to accessing any API over HTTP. First, you create a form on your website where the user enters their credit card data, billing information, etc. When the user submits the form, the contents are sent to your server. Using the data you’ve received, you make an API call to Braintree using one of their client libraries, check the result and display necessary information to your user.

http://stackoverflow.com/a/24990386
type: AcceptedAnswer
has body: A BadPaddingException occurs when the padding (bytes to fill up a too small encryption block) doesn't match a specified format (for example PKCS1, OAEP, ...). This can have a few causes: You are using a different mode of RSA for en- and decryption. The data (the byte[]) you get from encryption is not the same as the one you pass to decryption. (You are using an incorrect KeyPair.) Since you are initializing RSA with getInstance("RSA") for encryption and getInstance("RSA/ECB/PKCS1Padding") for decryption, it could be possible that ECB/PKCS1Padding is not the default on Android (even though it should be on Desktop-Java). So try this in RSAEncrypt(): cipher.getInstance("RSA/ECB/PKCS1Padding"); If this does not work, make sure that you pass the exact same byte[] you get from cipher.doFinal() in encryption to cipher.doFinal() in decryption. (Your code does work on my Desktop Java7 btw.)
upvote count: 7
type: Answer
has comment: http://stackoverflow.com/comment/38852403
has comment: http://stackoverflow.com/comment/38852499
downvote count: 0
score: 7
accepted answer of: http://stackoverflow.com/q/24988787
has comment: http://stackoverflow.com/comment/98010579
answers question: http://stackoverflow.com/q/24988787

http://stackoverflow.com/a/25013037
accepted answer of: http://stackoverflow.com/q/25012893
answers question: http://stackoverflow.com/q/25012893
has comment: http://stackoverflow.com/comment/38897610
score: 0
type: AcceptedAnswer
has body: You have to get the TextView "time". Because the TextView "time" isn't initialized. You can use dialog.findViewById, not f.getTextView.
type: Answer

http://stackoverflow.com/comment/38987594
type: Comment
type: QuestionComment
has text: @Tim The JAR was on the webapp's class, apparently when deploying my WAR file, tomcat was referencing an older WAR file or something. After exporting my WAR file and renaming it followed by deploying it under that name, I was not getting the error anymore. Something else to think about what my messiness in the previous war file; I wasn't closing PreparedStatements, Results, and even the Connection variables correctly. Updating the war with a different name with the code posted above worked.
score: 0
comment on: http://stackoverflow.com/q/25044828

http://stackoverflow.com/q/24927980
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24933077
tagged with: java
has body: Eclipse is telling me that import android.support.v4.app.Fragment; import android.support.v7.app.ActionBar; import android.app.Activity; is never used however it is used and if I remove parse it becomes removed it is causing my app to not work. What should I do
tagged with: warnings
tagged with: eclipse
type: Question
has title: Eclipse is giving me warnings incorrectly
has comment: http://stackoverflow.com/comment/38734942
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/24933077

http://stackoverflow.com/comment/38933470
comment on: http://stackoverflow.com/q/25031417
score: 0
type: Comment
type: QuestionComment
has text: @erdal.karaca I don't think that your comment could help someone with your same problem. Can you make an anserw where you explain us like you solved your trouble

http://stackoverflow.com/q/24932105
type: UnansweredQuestion
has body: I am looking for a way to generate/create an eclipse project automatically, perhaps using the command line (without using the Eclipse wizard). I have a set of hundreds of Java projects that I need to import to the workspace (they are not Eclipse projects, but projects that I need to create from existing source code), and the manual way of creating new Java projects using the wizard takes a significant amount of time.
has answer: http://stackoverflow.com/a/24932197
has comment: http://stackoverflow.com/comment/38742762
has comment: http://stackoverflow.com/comment/38742387
has answer: http://stackoverflow.com/a/24932460
has comment: http://stackoverflow.com/comment/38743588
type: Question
has comment: http://stackoverflow.com/comment/38742263
has title: Create Eclipse project automatically from existing source code
has comment: http://stackoverflow.com/comment/38748127
has answer: http://stackoverflow.com/a/24932494
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/38742621
answer count: 3
tagged with: eclipse

http://stackoverflow.com/a/24989240
type: AcceptedAnswer
has body: The JVM is basically started using a network port for debugging. This allows the debugger to be on a different machine, which can be very useful at times. Now when you're debugging locally, the JVM has been started on your local machine - the localhost IP address just refers to that, the loopback adapter for your local machine. You can attach the Eclipse debugger to a JVM running on another machine using the "Remote Java Application" debug configuration, but most of the time you'd just debug locally. You can ignore the "localhost:" part, basically - it's just telling you which port the JVM has exposed for debugging.
type: Answer
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/24989185
answers question: http://stackoverflow.com/q/24989185
upvote count: 1

http://stackoverflow.com/comment/38877108
comment on: http://stackoverflow.com/a/25003581
score: 0
type: AnswerComment
type: Comment
has text: @Ypnypn Yeah, sorry if I didn't mention it but performance is sort of important, so do you know of any other way? I was thinking of something along the lines of this, but I'm only going to use it if everything else is not worth the effort.

http://stackoverflow.com/q/24957826
tagged with: eclipse
has comment: http://stackoverflow.com/comment/38791990
type: Question
has comment: http://stackoverflow.com/comment/38793281
tagged with: ant
has comment: http://stackoverflow.com/comment/38791991
score: 0
has comment: http://stackoverflow.com/comment/38791988
has title: Error in a build.xml when using ANT
has body: I write a java package, and I want to compile it into .class files first and then package it. Following codes are what I do in my ant script. Under the directory of "src/compressScript" are four java class I wrote. &lt;?xml version="1.0" encoding="UTF-8" standalone="no"?&gt;&lt;project basedir="."default="compileJava" name="compileJava"&gt; &lt;target name="compileJava"&gt; &lt;mkdir dir="buildTest"/&gt; &lt;javac includeantruntime="false" srcdir="src/compressScript" destdir="buildTest"/&gt; &lt;/target&gt; &lt;/project&gt; When I try to use javac task of ANT to run this scirpt, the error is like this: Buildfile: C:\Users\di_yu\workspace\AffirmedNetworks\buildTest.xml compileJava: BUILD FAILED C:\Users\di_yu\workspace\AffirmedNetworks\buildTest.xml:6:java.lang.UnsupportedClassVersionError: com/sun/tools/javac/Main : Unsupported major.minor version 52.0 Total time: 545 milliseconds I check my compiler, the installed JRE is JRE 7.0 and the compiler compliance level is 1.7. So what's the problem?
type: UnansweredQuestion
tagged with: http://stackoverflow.com/tag/xml
answer count: 0
linked to: http://stackoverflow.com/q/7073485
has comment: http://stackoverflow.com/comment/38791989
tagged with: java

http://stackoverflow.com/comment/38844616
score: 0
type: AnswerComment
has text: Obviously I am Ok to say `Character,isLowerCase` is clear and readable and it spells out our intent. But in my opinion compare numbers is coherent with the following operation that is a substraction between the **same** numbers.
comment on: http://stackoverflow.com/a/24985875
type: Comment

http://stackoverflow.com/a/24969609
score: 4
has body: Looking at new FileWriter("src/opinarium3/media/presentaciones/"+title+"/comments/...") I see that you are trying to introduce a directory from variable title. Not sure whether this creates all missing directories. So please make sure that this directory exists and create it before writing to the file two levels below.
type: Answer
answers question: http://stackoverflow.com/q/24969522
has comment: http://stackoverflow.com/comment/38813361
upvote count: 4
downvote count: 0

http://stackoverflow.com/q/25049107
tagged with: java
upvote count: 3
has comment: http://stackoverflow.com/comment/38968875
answer count: 2
possible better answer: http://stackoverflow.com/a/25053045
has answer: http://stackoverflow.com/a/25053045
has answer: http://stackoverflow.com/a/25065237
accepted answer: http://stackoverflow.com/a/25065237
favorite count: 0
has comment: http://stackoverflow.com/comment/38989505
tagged with: lambda
has title: How to build a Map that replicates a Function in Java's Lambda API
tagged with: enum-map
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38963291
downvote count: 0
tagged with: java-stream
has comment: http://stackoverflow.com/comment/38963191
tagged with: java-8
type: Question
has body: From a java.util.function.BiFunction that maps a pair of Enums into a value, I want to build a EnumMap that reflects that mapping. For instance, let E1 and E2 be enum types and T any given type: BiFunction&lt;E1,E2, T&gt; theBiFunction = //...anything EnumMap&lt;E1,EnumMap&lt;E2,T&gt;&gt; theMap = buildTheMap( // &lt;-- this is where the magic happens E1.values(), E2.values(), theBiFunction); Given any pair of values of type E1 and E2 E1 e1 = //any valid value... E2 e2 = //any valid value.... both values below should be equal: T valueFromTheMaps = theMap.get(e1).get(e2); T valueFromTheFunction = theBiFunction.apply(e1,e2); boolean alwaysTrue = valueFromTheMaps.equals(valueFromTheFunction); What's the best (more elegant, efficient, etc...) implementation for the method where the "magic" takes place?
score: 3

http://stackoverflow.com/comment/38825120
type: Comment
comment on: http://stackoverflow.com/a/24975918
has text: @d00by-Try changing `.jpeg` with `.jpg` and also I find only one JLabel in your image.Also,please post path as I mentioned in my previous comment!
score: 0
type: AnswerComment

http://stackoverflow.com/a/25028428
type: Answer
answers question: http://stackoverflow.com/q/24993736
upvote count: 2
score: 2
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24993736
has body: Copy dependency jar class files into the project jar file: Use Maven plugin maven-shade-plugin by command: mvn package All the class files under will be included in your project jar file. com.googlecode.json-simple json-simple 1.1.1 jar javax.mail mail 1.4.5 org.apache.maven.plugins maven-shade-plugin package shade Test.jar

http://stackoverflow.com/comment/38772199
has text: Oh, I missed the part about "searched for the pattern". What pattern is this, exactly? A regular expression pattern? A substring match? I think there's more to this that you're not telling us.
comment on: http://stackoverflow.com/q/24947467
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/24957920
has comment: http://stackoverflow.com/comment/38790927
upvote count: 2
has comment: http://stackoverflow.com/comment/38790914
tagged with: sql
has body: I need to save JSON data to an Oracle database. The JSON looks like this(see below). But it doesn't stay in the same format. I might add some additional nodes or modify existing ones. So is it possible to create or modify oracle tables dynamically to add more columns? I was going to do that with Java. I will create a Java class matching the JSON, convert JSON to Java object and persist it to the table. But how can I modify Java class dynamically? Or would it be better idea to do that with PL/SQL? The JSON comes from a mobile device to a REST web service. {"menu": { "id": "file", "value": "File", "popup": { "menuitem": [ {"value": "New", "onclick": "CreateNewDoc()"}, {"value": "Open", "onclick": "OpenDoc()"}, {"value": "Close", "onclick": "CloseDoc()"} ] } }}
has answer: http://stackoverflow.com/a/24958102
favorite count: 0
has answer: http://stackoverflow.com/a/24958196
has answer: http://stackoverflow.com/a/24958296
answer count: 5
has comment: http://stackoverflow.com/comment/63804623
score: 2
downvote count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/65770818
has answer: http://stackoverflow.com/a/61034689
has title: How can I convert JSON to a database table dynamically?
type: Question
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: database
has comment: http://stackoverflow.com/comment/38791544
has comment: http://stackoverflow.com/comment/38791165

http://stackoverflow.com/comment/38779637
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24950613
has text: @bean_droid , i have added the modifications as EDIT above.Still doesnt work.
score: 0

http://stackoverflow.com/comment/38814811
score: 0
has text: yes, but you are not creating any product.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24970060

http://stackoverflow.com/q/24922452
accepted answer: http://stackoverflow.com/a/24922670
type: AnsweredQuestion
upvote count: 14
score: 12
downvote count: 2
has body: What is the algorithm used in the JVM to implement java.lang.Object's implicit hashCode() method? [OpenJDK or Oracle JDK are preferred in the answers].
has comment: http://stackoverflow.com/comment/38726178
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/38725000
answer count: 1
has title: What precisely is the algorithm used by java.lang.Object's hashCode
favorite count: 0
has comment: http://stackoverflow.com/comment/38725235
has answer: http://stackoverflow.com/a/24922670
linked to: http://stackoverflow.com/q/17977495
has comment: http://stackoverflow.com/comment/38727084

http://stackoverflow.com/a/24988564
answers question: http://stackoverflow.com/q/24988424
has body: First of all i want to clear your doubt upon multiple declaration of variables, there are two types of scope first is global and second is local.As you can see that you had defined taxes variable in the first method which has a local scope only under get final price outside that method that variable has no existence and when you define taxes in the second method it get existed only for that method . when you define the variable outside any method or block then it got Global scope and hence it existed everywhere in the program. for using the taxValue in other method you can make taxValue a global variable(define outside the method) and then you can use it in other method too.
score: 0
type: Answer

http://stackoverflow.com/comment/38929402
type: QuestionComment
score: 0
has text: I wrote boolean mistakenly, actually, the method returns String only
comment on: http://stackoverflow.com/q/25030412
type: Comment

http://stackoverflow.com/q/24989022
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/70545412
has answer: http://stackoverflow.com/a/24989040
accepted answer: http://stackoverflow.com/a/24989121
tagged with: java
downvote count: 2
has answer: http://stackoverflow.com/a/24989045
type: Question
has body: I want to change android:hint depending on each model. (Android device might have different sdcard path. I want to set this value.) How can I get the element or change the attribute? Such as Preferences.java public class Preferences extends PreferenceActivity { private void setDeviceSDCardPath () { String defaultPath = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS).getAbsolutePath(); pref = getElementById(R.preferences.pref_id); // &lt;--- invalid, but I want to do like this pref.hint = "ex.) " + defaultPath; // &lt;-- also invalid } } preferences.xml &lt;PreferenceCategory android:title="@string/title"&gt; &lt;EditTextPreference android:id="@+id/pref_id" android:key="pref_key" android:title="@string/pref_title" android:summary="@string/pref_summary" android:hint="/storage/sdcard" android:defaultValue="/storage/sdcard/Download/"/&gt; &lt;/PreferenceCategory&gt;
has title: How to change android:hint dynamically?
score: -2
linked to: http://stackoverflow.com/q/9153213
has answer: http://stackoverflow.com/a/24989226
upvote count: 0
has answer: http://stackoverflow.com/a/24989121
favorite count: 0
tagged with: android
possible better answer: http://stackoverflow.com/a/24989040
answer count: 4

http://stackoverflow.com/a/25050531
has body: If I understand right, than you want to count how often digit-wise permutations of numbers (000-999) in array2 occur in array1. You could do this by mapping all permutations of numbers in array2 to "permutation groups", allocate counters for each such group, and iterate through array1 finding groups and increasing counters. This code may do what you wanted: public static void main(String[] args) { int array1[] = { 123, 132, 231, 213, 312, 321 }; int array2[] = { 12, 13, 14, 15, 16, 17, 18, 19, 123, 124, 125, 126, 127 }; count(array1, array2); } private static void count(int[] arr1, int[] arr2) { // prepare a mapping of permutations of numbers in arr2 to arr2 indexes int[] permutationGroupOfNumber = new int[1000]; Arrays.fill(permutationGroupOfNumber, -1); for (int i = 0; i &lt; arr2.length; i++) { int number = Math.abs(arr2[i]) % 1000; // just to be safe int digit1 = number % 10; int digit2 = (number / 10) % 10; int digit3 = (number / 100) % 10; permutationGroupOfNumber[digit1 + digit2 * 10 + digit3 * 100] = i; permutationGroupOfNumber[digit1 + digit3 * 10 + digit2 * 100] = i; permutationGroupOfNumber[digit2 + digit1 * 10 + digit3 * 100] = i; permutationGroupOfNumber[digit2 + digit3 * 10 + digit1 * 100] = i; permutationGroupOfNumber[digit3 + digit1 * 10 + digit2 * 100] = i; permutationGroupOfNumber[digit3 + digit2 * 10 + digit1 * 100] = i; } // count the number of occurrences of permutations in arr1 int[] occurrencesOfPermutationsInGroup = new int[arr2.length]; for (int i = 0; i &lt; arr1.length; i++) { int g = permutationGroupOfNumber[arr1[i]]; if (g &gt;= 0) occurrencesOfPermutationsInGroup[g]++; } // output number of occurrences for (int i = 0; i &lt; arr2.length; i++) { int g = permutationGroupOfNumber[arr2[i]]; if (occurrencesOfPermutationsInGroup[g] &gt; 0) System.out.println(arr2[i] + ": " + occurrencesOfPermutationsInGroup[g] + " time(s)"); } }
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25049354
answers question: http://stackoverflow.com/q/25049354
has comment: http://stackoverflow.com/comment/38966749
type: Answer
score: 0

http://stackoverflow.com/comment/67121260
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24978161
has text: @howerknea It is because in build.gradle you are using an specific Gradle Project API which has this different sintaxis method call than the constructor of the"Settings" object. The "Settings" object is used to find and execute every Project API config: It can be one or many. So, don't bother too much about it, it's just a sintaxis differentiation between Gradle Settings object and Gradle Project API interface.

http://stackoverflow.com/comment/38703869
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24911672
has text: ok, can you know when android studio stable version is going to release?

http://stackoverflow.com/a/27770046
type: Answer
has body: To make it less complicated, I find it easier to do as much as possible in PythonInterpreter local namespace then when the need arises, use the __tojava__ method to get a java representation. So with the help of the interpreter, you are able to do something like: PythonInterpreter py = new PythonInterpreter(); String dataFolder,prepFolder; py.execfile("filename.py"); py.set("df", dataFolder); py.set("pf", prepFolder); py.exec("prep = Preprocess(df, pf)"); //if the preprocess method does not return anything, you can do: py.exec("prep.preprocess()"); //To get the return value in java, you can do: SomeJavaClass retvalue = py.eval("prep.preprocess()").__tojava__(SomeJavaClass.class); //To get and store the return type in the python local namespace: py.exec("retValue = prep.preprocess()"); There are many other ways of doing the same thing because the PythonInterpreter class comes with a wide variety of methods that can evaluate both java and python code and return or set the values in either java or python. See jython-userguide as well as the PythonInterpreter javadoc
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/25065666
accepted answer of: http://stackoverflow.com/q/25065666
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/38761276
type: AnswerComment
has text: It's included in JDK since 7 (I don't remember update)
comment on: http://stackoverflow.com/a/24939500
score: 0
type: Comment

http://stackoverflow.com/comment/38913129
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25022339
has text: You still need the loop until N

http://stackoverflow.com/q/24936662
has title: extending two 2D Arrays into a larger one
tagged with: merge
has answer: http://stackoverflow.com/a/24936714
type: AnsweredQuestion
tagged with: java
has body: I have two java 2D arrays(array1 and array2), both of type Double which I would like to join together. array1 and array2 are n-by-d matrices. the n-rows for each array can vary from eachother but the d-columns are always the same. The question is: i have to concatenate array2 after the first one.(at best into the new outputMatrix) Example: array1: 2 3 6 5 4 7 array2: 1 5 3 7 Output Array (n-array1 + n-array2)-by-d: 2 3 6 5 4 7 1 5 3 7 My idea was to copy array1 into the outputMatrix, and then fill the continuation of it with array2. My Java code for merging the two arrays(that are already implemented) looks like: private static double[][] outputMatrix ; outputMatrix = new double[array1.length+array2.length][array1[0].length]; for (int column = 0; column &lt; array1[0].length; column++) { for (int row = 0; row &lt; (array1.length); row++) { outputMatrix[row][column] = array1[row][column]; } } for (int column = 0; column &lt; array1[0].length; column++) { for (int row = array1.length; row &lt; (array1.length+ array2.length); row++) { outputMatrix[row][column] = array2[row][column]; //error here as array2 starts iterating at field [4][0] which isnt defined in the example } }
accepted answer: http://stackoverflow.com/a/24936714
type: Question
answer count: 2
tagged with: concatenation
possible better answer: http://stackoverflow.com/a/24936745
tagged with: arrays
has answer: http://stackoverflow.com/a/24936745
score: 0

http://stackoverflow.com/comment/38842955
comment on: http://stackoverflow.com/a/24985481
score: 0
type: AnswerComment
has text: very good explaind but coud you give me a example on how to check if there are characters like !"#$%&$(&)/=&(\|€ in the string ? And how can i add more paramters like that together...
type: Comment

http://stackoverflow.com/comment/38952073
type: QuestionComment
score: 0
has text: @fmodos still no luck
type: Comment
comment on: http://stackoverflow.com/q/25042763

http://stackoverflow.com/q/24995159
duplicate of: http://stackoverflow.com/q/7872846
has answer: http://stackoverflow.com/a/25004648
has answer: http://stackoverflow.com/a/25003975
downvote count: 1
linked to: http://stackoverflow.com/q/7872846
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38862673
upvote count: 3
tagged with: java
has body: I would like to ask to the user if he could press a key before continuing. Then my program will wait for that during 10 seconds. If nothing is done, then, I would like to be able to exit the program. My problem is that the function scanner block my program (until the user have pressed a key) and doesn't allow the program to execute the end. Do you have any idea of what I could do/use instead of scanner? I am just a beginner in java so please, be indulgent with me. import java.util.Scanner; public class Test{ public Test(){ Scanner scan = new Scanner(System.in); boolean first = true; System.out.println("Press any key to start.\n"); for(int fr = 0; fr &lt;11; fr++){ System.out.println(fr); try{ Thread.sleep(1000); } catch (Exception e) { System.err.println("error -&gt; "+e.getMessage()); // in case of exception, error message } if(fr == 10){ Default def = new Default(); }else if(scan.hasNext() == true){ //System.out.println("Hello"); User user = new User(); // or exit, it doesn't matter } } } }
type: Question
has comment: http://stackoverflow.com/comment/38877773
answer count: 2
accepted answer: http://stackoverflow.com/a/25003975
has comment: http://stackoverflow.com/comment/38867299
has title: unblocked scanner function java
favorite count: 0
score: 2
possible better answer: http://stackoverflow.com/a/25004648

http://stackoverflow.com/a/24962397
accepted answer of: http://stackoverflow.com/q/24962265
score: 5
answers question: http://stackoverflow.com/q/24962265
has body: You should instantiate your Properties object. Also you should load the resource file with the path starting with /META-INF: properties = new Properties(); properties.load(getClass().getResourceAsStream("/META-INF/testing.properties"));
type: AcceptedAnswer
upvote count: 5
type: Answer
downvote count: 0

http://stackoverflow.com/comment/38782550
type: Comment
type: QuestionComment
has text: there is only one Map, whether it is static or not, but it can contain several elements
score: 0
comment on: http://stackoverflow.com/q/24953370

http://stackoverflow.com/comment/38971271
score: 0
type: Comment
has text: oops, i forgot..thanks, error gone..thanks user3818605,,
type: AnswerComment
comment on: http://stackoverflow.com/a/25053231

http://stackoverflow.com/q/24925524
linked to: http://stackoverflow.com/q/12253908
has comment: http://stackoverflow.com/comment/38730578
score: 0
tagged with: file-listing
has title: How to visit older files first in a directory in java
tagged with: directory
duplicate of: http://stackoverflow.com/q/12253908
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38730674
answer count: 0
tagged with: java
tagged with: directory-structure
type: Question
tagged with: recent-file-list
has body: I want to list out first ten oldest files in a directory. I was looking at JAVA 7 fileVisitor and DirectoryStream interfaces/classes. These API do not visit the files in specific order.Listing out all the files present in the directory and then sorting out them based on creation time and then finding out 10 oldest files seems unoptimized because i have thousands of files present in the directory. Is there any option that i can give to these API so that these apis will visit older files first? Is there any other way to do this in Java or shell ?

http://stackoverflow.com/comment/38946853
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25040609
score: 0
has text: @BackSlash Have not tried anything yet, hence posted this for getting some suggestions to start with. I have never asked anyone for any ready-made code, I will do it my own way...only need some suggestions to start with and thats it :)

http://stackoverflow.com/comment/38955299
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25042952
has text: Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/58387/discussion-between-xijiaopin-and-user3106978).

http://stackoverflow.com/q/24941167
type: Question
score: 3
tagged with: algorithm
tagged with: k-means
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/24941202
accepted answer: http://stackoverflow.com/a/24941202
has title: Choosing the cluster values in k means algorithm
has body: I'm working on writing a k means algorithm that takes in a double[][] that stores locations and returning two clusters of locations. I just have a really quick question: what is the best way to choose what the initial cluster values should be? I've tried randomizing the values but that doesn't always work well, and I can't find any good answers to this question online. Any help is much appreciated.
type: AnsweredQuestion
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/38760009

http://stackoverflow.com/q/25018691
score: 0
has answer: http://stackoverflow.com/a/25019282
has title: How can I get the search result (in html) for a given keyword and iterate it for all search result pages in Talend?
type: AnsweredQuestion
tagged with: java
tagged with: web-crawler
type: Question
accepted answer: http://stackoverflow.com/a/25019282
answer count: 1
has body: I have a working workflow which gets the keywords specified by a user in the keywords.csv. It then starts a search query for a page with the keywords iterated as part of the search url. This has been easy before, because I could display all results on one page with the url parameter li=100000. They changed it, so I have to get the single pages and extract it from there. The problem is, I'm new with talend and got this workflow from a colleague. Here it is in overview, doing the old li=100000 and write all results into separate text files (keyword_1.txt, keyword_2.txt,....): Here is a sample query from the job portal website absolventa: http://www.absolventa.de/stellenangebote?query%5Bcity%5D=&amp;amp;query%5Bradius%5D=100&amp;amp;query%5Btext%5D=SAP&amp;amp;utf8=%E2%9C%93 My question is now - how can I add the function in talend to grab page1, then page 2 for all specified keywords. And add it to my process. Please explain low level, since I'm new to Talend. Thank you SO much in advance!
tagged with: talend
tagged with: parsing

http://stackoverflow.com/q/24915938
has comment: http://stackoverflow.com/comment/38764207
has comment: http://stackoverflow.com/comment/38713036
tagged with: file
has answer: http://stackoverflow.com/a/24916196
downvote count: 1
type: AnsweredQuestion
has body: I'm building an application (for mac) that runs on java, and I need it to be able to edit its own contents. Because, after all, an application is just a glorified directory, I assumed that you could use it to change what is inside of it. But this application will be distributed, and I have no idea where the user will wish to place the application. Currently, all file references that I have been making have been using File("path/from/user/to/application") but of course, that assumes that you can find your application from the user home drive. Is there a way to do it not knowing where the .app file is stored? My current directory setup within the app is this: app.app Contents |Info.plist |PkgInfo |---Resources | |icon.icns | |---MacOS | |JavaAppLauncher | |---Java |---app.jar |---package |classFile.class |---Folder |FileToEdit.xml So is there a way to find and read/change FileToEdit.xml within the java code (stored in classFile.class) without knowing where app.app is?
has title: java - How can you make an application reference itself?
tagged with: java
score: -1
tagged with: .app
possible better answer: http://stackoverflow.com/a/24916190
type: Question
has answer: http://stackoverflow.com/a/24916190
answer count: 2
accepted answer: http://stackoverflow.com/a/24916196
upvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/38712766
tagged with: macos
linked to: http://stackoverflow.com/q/15526607

http://stackoverflow.com/comment/38813305
type: Comment
has text: Have you tried saving the image out in a different, color format to test it?
type: AnswerComment
comment on: http://stackoverflow.com/a/24969637
score: 0

http://stackoverflow.com/comment/38835048
has text: Ok I will try to gather information and will present to you. I will try my best what teachers told me about it is not good enough. :)
comment on: http://stackoverflow.com/q/24981139
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/24987960
tagged with: k-means
tagged with: cluster-analysis
tagged with: weka
has body: I am writing a code that uses traffic data, stores it in an OD Matrix, and displays it as a heatmap. I am trying to cluster (k-means for now) it but for some reason my instances' assignments are only zeros. This is my code: public class Clustering { Vector &lt;ODData&gt; myData = new Vector &lt;ODData&gt;(); int capacity; int ROUTES_SIZE = 324263; public Clustering( ODData [] routes, int cap ) { capacity = cap; for (ODData s : routes) { myData.add(s); } } public void Build_cluster() { Attribute x1 = new Attribute("Beginning point x"); Attribute y1 = new Attribute("Beginning point y"); Attribute x2 = new Attribute("End point x"); Attribute y2 = new Attribute("End point y"); Attribute dem = new Attribute("Demand"); ArrayList &lt;Attribute&gt; attribute_list = new ArrayList &lt;Attribute&gt;(5); attribute_list.add(x1); attribute_list.add(y1); attribute_list.add(x2); attribute_list.add(y2); attribute_list.add(dem); Instances attribute_instance = new Instances ("Cluster", attribute_list, capacity); double [] temp_array = new double[5]; for (int i = 0; i &lt; myData.size(); i++) { ODData s; s = myData.get(i); temp_array[0] = s.getOrigin().getLattitude(); temp_array[1] = s.getOrigin().getLongititude(); temp_array[2] = s.getDestination().getLattitude(); temp_array[3] = s.getDestination().getLongititude(); temp_array[4] = s.getValue(); Instance inst = new DenseInstance( 1, temp_array ); attribute_instance.add(inst); } SimpleKMeans Kmeans_clustering = new SimpleKMeans(); Kmeans_clustering.setPreserveInstancesOrder(true); try { Kmeans_clustering.buildClusterer(attribute_instance); } catch (Exception e1) { // TODO Auto-generated catch block e1.printStackTrace(); } /*Sorting by groups*/ int[] assignments = new int[ROUTES_SIZE]; try { assignments = Kmeans_clustering.getAssignments(); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } Any idea why I get only zeros?
type: Question
type: AnsweredQuestion
favorite count: 0
downvote count: 2
has answer: http://stackoverflow.com/a/24990686
score: -2
answer count: 1
tagged with: instance
tagged with: java
has title: Only zeros as assignment values in a simpleKMeans clustering
upvote count: 0
accepted answer: http://stackoverflow.com/a/24990686

http://stackoverflow.com/comment/38997278
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25066982
score: 1
has text: Simon as I said it is always on the same line no matter what is there.

http://stackoverflow.com/comment/38824440
type: Comment
comment on: http://stackoverflow.com/q/24975641
has text: The code threw an exception. View the trace logs for a relevant cause.
score: 0
type: QuestionComment

http://stackoverflow.com/q/25042962
upvote count: 2
has title: Java Enums confusion
answer count: 1
favorite count: 0
has body: I am trying to get my head around enums, some lines of code have me slightly confused. This is taken straight from the oracle docs site but having a little trouble understanding a few lines of code : public class EnumTest { public enum Day { SUNDAY, MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY } Day day; public EnumTest(Day day) { this.day = day; } The first 5 lines (class EnumTest) is quite ok, self explanatory really. What I dont understand are the last 5 lines of the above code, confusing. Could someone please explain their meaning within the context of the complete code below? Enumtest(Day day) is obviously a method , its the "this.day = day" and the preceding "Day day" I dont get ..... Complete code : public class EnumTest { public enum Day { SUNDAY, MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY } Day day; public EnumTest(Day day) { this.day = day; } public void tellItLikeItIs() { switch (day) { case MONDAY: System.out.println("Mondays are bad."); break; case FRIDAY: System.out.println("Fridays are better."); break; case SATURDAY: case SUNDAY: System.out.println("Weekends are best."); break; default: System.out.println("Midweek days are so-so."); break; } } public static void main(String[] args) { EnumTest firstDay = new EnumTest(Day.MONDAY); firstDay.tellItLikeItIs(); EnumTest thirdDay = new EnumTest(Day.WEDNESDAY); thirdDay.tellItLikeItIs(); EnumTest fifthDay = new EnumTest(Day.FRIDAY); fifthDay.tellItLikeItIs(); EnumTest sixthDay = new EnumTest(Day.SATURDAY); sixthDay.tellItLikeItIs(); EnumTest seventhDay = new EnumTest(Day.SUNDAY); seventhDay.tellItLikeItIs(); } }
has answer: http://stackoverflow.com/a/25042999
accepted answer: http://stackoverflow.com/a/25042999
has comment: http://stackoverflow.com/comment/38976228
type: AnsweredQuestion
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/38951219
type: Question
tagged with: enums
tagged with: java

http://stackoverflow.com/a/24936881
type: Answer
has comment: http://stackoverflow.com/comment/38752017
accepted answer of: http://stackoverflow.com/q/24936699
has body: Your solution with brackets is okay (if you're really getting String, not java.lang.reflect.Method), I would suggest using regexes to write the code: Pattern p = Pattern.compile("([^.]*)\\s*\\("); Matcher m = p.match(str); if (m.find()) { String methodName = m.group(1); //... } By the way, I don't understand why should you parse the String: where did you got it? The most common way to get the method in reflection is: Class&lt;?&gt; clazz = ... Method[] methods = clazz.getMethods(); // processing methods for (Method method : methods) { // processing concrete method // for example, getting the name String name = method.getName(); }
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/24936699
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/60651620
type: AnswerComment
has text: The examples on Oracle's tutorials are wrong then. They show adding the group the pane. https://docs.oracle.com/javase/tutorial/uiswing/components/button.html#radiobutton
type: Comment
comment on: http://stackoverflow.com/a/25043650
score: 0

http://stackoverflow.com/a/24914586
type: Answer
has comment: http://stackoverflow.com/comment/38713220
has body: std::list in C++ is a linked list, whereas java.util.ArrayList is an array. Try replacing std::list by std::vector. Also, be sure to compile with optimization turned on.
has comment: http://stackoverflow.com/comment/38750572
downvote count: 0
has comment: http://stackoverflow.com/comment/40723166
has comment: http://stackoverflow.com/comment/38758716
has comment: http://stackoverflow.com/comment/38721925
has comment: http://stackoverflow.com/comment/39033632
has comment: http://stackoverflow.com/comment/38713581
has comment: http://stackoverflow.com/comment/38747487
score: 93
has comment: http://stackoverflow.com/comment/38715012
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24914525
has comment: http://stackoverflow.com/comment/38726162
upvote count: 93
answers question: http://stackoverflow.com/q/24914525
has comment: http://stackoverflow.com/comment/38717194

http://stackoverflow.com/comment/38978045
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25057005
has text: I have created two tasks , one for generating code coverage file(exe file) and another for generating report . In th second task , i have provided only those classes which i want to be included in to the result.
type: AnswerComment

bitwise-operators
tags question: http://stackoverflow.com/q/25020583
tag name: bitwise-operators
type: Tag

http://stackoverflow.com/q/24994704
score: 1
tagged with: java
upvote count: 1
tagged with: jfreechart
tagged with: timeserieschart
type: Question
accepted answer: http://stackoverflow.com/a/25000309
has body: I'm made ​​a chart timeseriescollection type. I'm fetching the following values ​​to the database. However when creating the graph, the values ​​shown are not entirely accurate. Can someone tell me why this happens? Only shows the date. Hours not appear correctly. Does anyone can help me solve this little problem please? I would be eternally grateful. Thank you all very much. Values from Database. select (CONCAT(data_registo, ' ', hora_registo)) as data, temperatura from registos where idSensor like 'Thermomether001' and data_registo between '2014-07-20' and '2014-07-24' 2014-07-20 00:26:03 19.4 2014-07-20 00:55:07 18.4 2014-07-20 01:58:14 18.4 2014-07-20 03:03:02 18.4 2014-07-20 04:40:13 19.3 2014-07-20 05:10:56 18.4 2014-07-20 05:41:40 19.3 . . . 2014-07-24 21:40:04 19.3 2014-07-24 22:09:42 19.2 2014-07-24 22:39:20 18.9 2014-07-24 23:02:19 19.8 2014-07-24 23:38:37 19.7 Chart As you can see only shows the date. The time that appears is not registered in the database. Can anyone help me? Code of chart JFreeChart createChart(XYDataset dataset) { JFreeChart chart = ChartFactory.createTimeSeriesChart( "Chart", // title "Date", // x-axis label "Temperature", // y-axis label dataset, // data true, // create legend? true, // generate tooltips? false // generate URLs? ); XYPlot plot = (XYPlot) chart.getPlot(); DateAxis axis = (DateAxis) plot.getDomainAxis(); axis.setDateFormatOverride(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")); return chart; } XYDataset createDataset() throws SQLException, ParseException { Connection con = null; String databaseURL = "jdbc:sqlserver://-----;IntegratedSecurity=true"; String driverName = "com.microsoft.sqlserver.jdbc.SQLServerDriver"; try { Class.forName(driverName).newInstance(); } catch (Exception ex) { System.out.println(""); } con = (Connection) DriverManager.getConnection(databaseURL); if (!con.isClosed()) { System.out.println("Successfully connected to the DataBase Server..."); } SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd…
has title: Why is the data in a timeseriescollection chart don't appear correctly?
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/25000309
type: AnsweredQuestion
tagged with: netbeans

http://stackoverflow.com/comment/38925926
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25024876
has text: Also, the code provided by Ritesh Gune has DefaultHttpClient() - which is deprecated. Bad Code.
score: 0

http://stackoverflow.com/comment/38948614
type: Comment
type: QuestionComment
has text: I'm using Netbeans 8.0 and Glashfish 4.0. Where would I get the stacktrace? Would it be the Glassfish log which looks like this Warning: StandardWrapperValve[logListServlet]: Servlet.service() for servlet logListServlet threw exception java.lang.IllegalArgumentException at java.sql.Date.valueOf(Date.java:143) at org.mypackage.HOIS.logListServlet.doPost(logListServlet.java:57) at javax.servlet.http.HttpServlet.service(HttpServlet.java:707) at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1682)........
comment on: http://stackoverflow.com/q/25039828
score: 0

http://stackoverflow.com/a/24911893
has body: A year is a leap year if it is divisible by 4 and not divisible by 100, but it is always one if it is divisible by 400. You can translate this to code literally: int year = 2004; boolean leap = ((year % 4 == 0) &amp;&amp; (year % 100 != 0)) || (year % 400 == 0); The modulo operator (%) gives you the remainder when dividing the numbers, so it is equal to 0 if the first number is divisible by the second. As Bathsheba points out, this only works for the Gregorian Calendar (our modern system since 1582 in some countries or even later in others), if you want to handle years prior to this date, the code would be much more complicated and it would require some research for the exact rules at that time. In an exam, however, you should not need to worry about those.
has comment: http://stackoverflow.com/comment/38704765
upvote count: 9
answers question: http://stackoverflow.com/q/24911847
has comment: http://stackoverflow.com/comment/38704707
downvote count: 0
has comment: http://stackoverflow.com/comment/38704710
score: 9
type: Answer
has comment: http://stackoverflow.com/comment/38704553

http://stackoverflow.com/q/24924515
answer count: 1
has title: Javafx and repositioning an image upon window resize?
score: 0
has answer: http://stackoverflow.com/a/24927295
has comment: http://stackoverflow.com/comment/38731136
has body: Ok so I am trying to become familiar with adding listener's to objects and thought I would try and modify one of my applications to have it recenter an image after the pane was resized like it showed me in an example....which worked....only in this project when I try and perform the same thing I get this exception: Exception in Application constructor Exception in thread "main" java.lang.NoSuchMethodException: MouseEvent.MouseEventDemo.main([Ljava.lang.String;) at java.lang.Class.getMethod(Class.java:1773) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:119) The code I used is here: // Add a listener to relocate object upon pane resize pane.widthProperty().addListener(ov -&gt; { circularText.relocate(pane.getWidth() / 2, pane.getHeight() / 2); imageView2.relocate(pane.getWidth() / 2, pane.getHeight() / 2); }); pane.heightProperty().addListener(ov -&gt; { circularText.relocate(pane.getWidth() / 2, pane.getHeight() / 2); imageView2.relocate(pane.getWidth() / 2, pane.getHeight() / 2); }); If you need the entire main, part of the code you can find it below: import javafx.animation.KeyFrame; import javafx.animation.KeyValue; import javafx.animation.Timeline; import javafx.application.Application; import javafx.event.ActionEvent; import javafx.event.EventHandler; import javafx.scene.Scene; import javafx.scene.effect.BlendMode; import javafx.scene.image.Image; import javafx.scene.image.ImageView; import javafx.scene.layout.Pane; import javafx.scene.paint.Color; import javafx.scene.text.Font; import javafx.scene.text.FontWeight; import javafx.scene.transform.Rotate; import javafx.stage.Stage; import javafx.util.Duration; /** * Created by John on 7/17/2014. */ class MouseEventDemo extends Application { private double rotateImage; private final Pane pane = new Pane(); @Override // Override the start method in the Application class public void start(Stage primaryStage) { // Set pane's properties pane.setStyle("-fx-background-color: black"); // Create and add…
tagged with: listener
type: UnansweredQuestion
type: Question
tagged with: java
tagged with: javafx
has comment: http://stackoverflow.com/comment/38729660
has comment: http://stackoverflow.com/comment/38731962
has comment: http://stackoverflow.com/comment/38733672

http://stackoverflow.com/comment/38735152
comment on: http://stackoverflow.com/q/24927165
has text: Inspect that TIFF file with a hex editor. What are the first 4 bytes?
score: 3
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/38999029
type: Comment
comment on: http://stackoverflow.com/a/25066217
score: 0
type: AnswerComment
has text: I Installed your apk file in My Emulator is works fine .Its Shows a Toast Message like "SMS Sent!"

http://stackoverflow.com/q/25020765
tagged with: unbounded-wildcard
score: 1
has answer: http://stackoverflow.com/a/25020889
tagged with: java
type: Question
answer count: 2
tagged with: bounded-wildcard
has body: I'm working with Anthill (an UrbanCode/IBM product) and one of the methods requires a parameter of type java.lang.Class&lt;? extends SourceConfig&lt;?&gt;&gt; sourceConfigType. After reading the tutorial on generics I found that a class GitSourceConfig is a subclass of SourceConfig but I don't understand how the generic of SourceConfig&lt;?&gt; works in this context. Any ideas? The end goal is to get a GitSourceConfig object and call the getRepositoryUrl/setRepositoryUrl methods. The Anthill Pro API is here and I'm looking at the SourceConfig class.
downvote count: 0
tagged with: generics
has answer: http://stackoverflow.com/a/25021035
linked to: http://stackoverflow.com/q/4453349
favorite count: 0
type: UnansweredQuestion
tagged with: anthill
has title: How to use multiple wildcards in an API call
upvote count: 1

http://stackoverflow.com/a/24982735
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/24982642
score: 3
accepted answer of: http://stackoverflow.com/q/24982642
upvote count: 3
has body: Assuming your Scanner has the name myScanner: public static int checkMyInput () { try { return myScanner.nextInt(); } catch (InputMismatchException e ) { myScanner.next(); System.out.println("bacon luff"); return 0 ; } } and then you can call that method.
type: AcceptedAnswer

http://stackoverflow.com/comment/38883087
has text: This doesn't answer why not initializing final field causes a compile error.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24990852
score: 2

http://stackoverflow.com/q/24995971
has comment: http://stackoverflow.com/comment/38864092
has comment: http://stackoverflow.com/comment/38864995
tagged with: jtable
answer count: 1
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/38864507
has comment: http://stackoverflow.com/comment/38862480
favorite count: 0
has title: How to add multiple listeners for multiple components in java
has comment: http://stackoverflow.com/comment/38864555
has answer: http://stackoverflow.com/a/24998758
has body: i created a java swing application that have multiple jTables. I added multiple mouse listeners for making context menu with anonymous classes. But each time the action listeners are pointing to the first table only. Please help. Each time iam getting is the updated value for first table . i have 3 Jtables named jTableNum1, jTableNum2, jTableNum3. what i want is cut, copy, paste function for each cell in my three Jtables. so i created popumenus &amp; called like: jTableNum1.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { rowH = jTableNum1.getSelectedRow(); if (e.isPopupTrigger()) { highlightRow(e); doPopup(e); } } @Override public void mouseReleased(MouseEvent e) { if (e.isPopupTrigger()) { highlightRow(e); doPopup(e); } } protected void doPopup(MouseEvent e) { popupMenu.show(e.getComponent(), e.getX(), e.getY()); } protected void highlightRow(MouseEvent e) { JTable table = (JTable) e.getSource(); Point point = e.getPoint(); int row = table.rowAtPoint(point); int col = table.columnAtPoint(point); table.setRowSelectionInterval(row, row); table.setColumnSelectionInterval(col, col); } }); popupMenu1.add(new clearFuncs (1,rowH));// arg1= tableNumber , arg2 = the highlighted row) - -// similiarly for jTableNum2 &amp; jTableNum3 public class clearFuncs extends AbstractAction { int num; int rowH; public clearFuncs (int num,int r) { this.num = num; this.rowH = r; putValue(NAME, "Clear"); }public clearFuncs (int num) { this.num = num; putValue(NAME, "Clear"); } @Override public void actionPerformed(ActionEvent e) { int row; switch(num){ case 1: row = jTableNum1.getSelectedRow(); System.out.println("row = "+rowH); jTableNum1.setValueAt("", row, 0); break; case 2: row = jTableNum2.getSelectedRow(); System.out.println("row = "+row); jTableNum2.setValueAt("", row, 0); break; case 3: row = jTableNum3.getSelectedRow(); System.out.println("row = "+row); jTableNum3.setValueAt("", row, 0); break; } } } -
has comment: http://stackoverflow.com/comment/38864801
has comment: http://stackoverflow.com/comment/38864946
type: AnsweredQuestion
tagged with: java
upvote count: 1
tagged with: swing
has comment: http://stackoverflow.com/comment/38864578
has comment: http://stackoverflow.com/comment/38864820
accepted answer: http://stackoverflow.com/a/24998758
type: Question
has comment: http://stackoverflow.com/comment/38862504

http://stackoverflow.com/q/24979737
has answer: http://stackoverflow.com/a/24979845
favorite count: 0
accepted answer: http://stackoverflow.com/a/24979845
has comment: http://stackoverflow.com/comment/38832165
has comment: http://stackoverflow.com/comment/38832207
has answer: http://stackoverflow.com/a/24979768
possible better answer: http://stackoverflow.com/a/24979794
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38832269
has answer: http://stackoverflow.com/a/24979794
tagged with: java
downvote count: 3
upvote count: 1
has title: how can i get an object from one if condition to another if condition in java?
has body: I'm a beginner. In the below program i want to use display methods in an if condition by using the object which i created in another if condition. Is there any possible way? package emp; import java.util.*; import emp.*; public abstract class EmpMain2 { public static void main(String args[]) { Class cl=new Class(); System.out.println("1:Create"); System.out.println("2:Display"); System.out.println("3:Raisesalary"); System.out.println("4:Exit"); System.out.println("-------------------"); System.out.println("Enter choice:"); Scanner s1=new Scanner(System.in); int i=s1.nextInt(); System.out.println("-------------------"); if(i==1) { System.out.println("1:Clerk"); System.out.println("2:Programmer"); System.out.println("3:Manager"); System.out.println("4:Exit"); System.out.println("-------------------"); System.out.println("Enter Choice:"); Scanner s2=new Scanner(System.in); int j=s2.nextInt(); System.out.println("-------------------"); if(j==1) { System.out.println("Enter Name:"); Scanner s3=new Scanner(System.in); String str1=s3.next(); System.out.println("Enter age:"); Scanner s4=new Scanner(System.in); int i1=s4.nextInt(); Cleark c1=new Cleark(str1,i1); System.out.println("Do u want go to main menu again:"); System.out.println("If yes press 1:"); Scanner s10=new Scanner(System.in); int l=s10.nextInt(); if(l==1) { main(args); } else { System.exit(0); } } if(j==2) { System.out.println("Enter Name:"); Scanner s5=new Scanner(System.in); String str2=s5.next(); System.out.println("Enter age:"); Scanner s6=new Scanner(System.in); int i2=s6.nextInt(); Programer p1=new Programer(str2,i2); System.out.println("Do u want go to main menu again:"); System.out.println("If yes press 1:"); Scanner s11=new Scanner(System.in); int l=s11.nextInt(); if(l==1) { main(args); } else { System.exit(0); } } if(j==3) { System.out.println("Enter Name:"); Scanner s7=new Scanner(System.in); String str3=s7.next(); System.out.println("Enter age:"); Scanner s8=new Scanner(System.in); int i3=s8.nextInt…
type: Question
score: -2
answer count: 3

http://stackoverflow.com/q/25055375
has comment: http://stackoverflow.com/comment/38974726
favorite count: 0
linked to: http://stackoverflow.com/q/52353
answer count: 5
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25055542
has body: As I read somewhere, memory is allocated when instances are created and a space is allocated from the heap. If it is right than when and how much exactly memory is allocated during instances and objects creation?
has title: When is memory allocated during instance creating or using new keyword for object creation?
has comment: http://stackoverflow.com/comment/38974708
linked to: http://stackoverflow.com/q/229886
tagged with: memory-management
has answer: http://stackoverflow.com/a/25055562
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/25055760
upvote count: 1
linked to: http://stackoverflow.com/q/5839434
type: Question
has answer: http://stackoverflow.com/a/25055543
has answer: http://stackoverflow.com/a/34991835
has comment: http://stackoverflow.com/comment/38974751
downvote count: 0

http://stackoverflow.com/comment/38721695
has text: The app compat v7 library should have a jar file in the libs folder with the app compat v4 which is the one that has the LocalBroadcastManager, are you sure that the library project is exporting it's jars to the childs too?
score: 1
comment on: http://stackoverflow.com/q/24920404
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25001321
answer count: 1
score: 0
has answer: http://stackoverflow.com/a/25001377
type: UnansweredQuestion
tagged with: multithreading
has body: Suppose I want to run 10 threads at a time, I would accomplish that by doing something along the lines of: ExecutorService pool = Executors.newFixedThreadPool(10); Is it possible to change the amount of threads to 15 using ExecutorService? So the default will be 10, but can I redeclare it to be a fixedthreadpool of 15? Thanks!
has title: Variable Amount of Threads/ redeclaring ExcutorService
type: Question
tagged with: java
tagged with: concurrency

http://stackoverflow.com/q/24981422
has title: How to get the contains of file in jtable?
has body: I create a jtable like this : String name = temp.getName(); String enemy = namaFileUtama.toString(); DefaultTableModel models = (DefaultTableModel) Main_Menu.jTable4.getModel(); List&lt;ReportMomentOfTruth&gt; theListRMOT = new ArrayList&lt;ReportMomentOfTruth&gt;(); ReportMomentOfTruth rmot = new ReportMomentOfTruth(); rmot.setNameOfMainFile(name); rmot.setNameOfComparingFile(enemy); theListRMOT.add(rmot); for (ReportMomentOfTruth reportMomentOfTruth : theListRMOT) { models.addRow(new Object[]{ reportMomentOfTruth.getNamaFileUtama(), reportMomentOfTruth.getNamaFilePembanding(), }); } You know, I dont get an idea. How can I get the contains the file if I click one row in jtable then the contains will be show in jTextArea ? Any suggestion ? any example perhaps ? Thanks edit You know, I am using netbeans, I can get a method like this private void jTable4MouseClicked(java.awt.event.MouseEvent evt) { if (evt.getClickCount() == 1) { } } Now how to ?
linked to: http://stackoverflow.com/q/7033589
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38835050
tagged with: swing
has answer: http://stackoverflow.com/a/24981519
tagged with: java
type: Question
answer count: 1
tagged with: jtable
score: 0

http://stackoverflow.com/q/24909272
accepted answer: http://stackoverflow.com/a/24910411
has comment: http://stackoverflow.com/comment/38699322
has comment: http://stackoverflow.com/comment/38699268
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38700656
has body: Last time I asked this question but it was removed and I was asked to state it more precisely. (Plz note this algorithm has a very important task in my encryption app but to make it simpler, I have used program password example). Consider password of a program to be abc123. It is locked and we have to unlock it. Consider we don't know it. Now I have to write a program that will go through all possible character permutations until I get the password and the program unlocks. For eg it must first go through a-z then 0-9 then it will start all possible 2 character permutation - aa, ab, ac then a1, a2, a3 then ba, bb, bc etc. It will go on till z9. Then it will go through all three character possible permutation. This will continue until the program reaches abc123. Even creating lot of loops didn't work as we don't actually know how long it the password.
has title: Android - All possible character permutation to match string? [Restatement]
score: -3
type: Question
tagged with: algorithm
tagged with: java
has comment: http://stackoverflow.com/comment/38699115
downvote count: 3
has answer: http://stackoverflow.com/a/24910411
has comment: http://stackoverflow.com/comment/38699125
upvote count: 0
answer count: 1
tagged with: permutation
favorite count: 0
has comment: http://stackoverflow.com/comment/38790929
tagged with: android
has comment: http://stackoverflow.com/comment/38791115
linked to: http://stackoverflow.com/q/4764608

http://stackoverflow.com/q/24971211
has comment: http://stackoverflow.com/comment/38816044
has comment: http://stackoverflow.com/comment/38816064
has body: The documentation doesn't specify this case. It seems that nothing happens, but I am not sure. Could this method throw an exception eventually?
score: -10
tagged with: jcombobox
has answer: http://stackoverflow.com/a/24971258
type: AnsweredQuestion
downvote count: 11
has comment: http://stackoverflow.com/comment/38816005
upvote count: 1
tagged with: swing
type: Question
has title: Could the combobox.removeAllItems method throw an exception if the combobox was empty?
has comment: http://stackoverflow.com/comment/38816409
tagged with: java
accepted answer: http://stackoverflow.com/a/24971258
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/38816312

http://stackoverflow.com/comment/38770982
has text: unless you are learning about probabilistic algorithms, you will not need it. i've been programming in the industry for years and never encountered it or used it. The usefulness of the technique is for the following reason: if the element is in the array, then the binary search will find it in one step if it is in the middle and many more steps if it is say in the second position. Therefore the speed of the search depends upon the position of the element. Using the Sherwood technique makes the speed independent of the position of the element, and based on pure luck.
score: 1
comment on: http://stackoverflow.com/q/24946740
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/38756136
type: AnswerComment
has text: Unfortunally without the classloader as in the example it don't works
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24938996

http://stackoverflow.com/comment/38815710
has text: Have you read the documentation on `SimpleDateFormat`? What have you tried? Hint: create a Date object (using f.e. `new Date()` to get the current date) and format it using the `SimpleDateFormat`instance to check that it's correct.
score: 0
comment on: http://stackoverflow.com/q/24971049
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24920424
has body: Jorge is right - Ninja just uses Jackson to serialize stuff - you can use all goodies of Jackson to customize parsing and rendering of your entities. In your case the solution is simple. Just use @JsonProperty like that: @Entity public class MyPOJO { private String Name; private String Value; @JsonProperty("1") public String getName() { return Name; } public void setName(String Name) { this.Name = Name; } @JsonProperty("2") public String getValue() { return Value; } public void setValue(String Value) { this.Value = Value; } }
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/24910224
accepted answer of: http://stackoverflow.com/q/24910224
type: Answer
upvote count: 1
score: 1

http://stackoverflow.com/comment/38844328
has text: remove getMenuInflater().inflate(R.layout.activity_main); and run your code, tell me if your program is running
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/24985817
score: 0

http://stackoverflow.com/comment/38712358
type: AnswerComment
score: 0
has text: @DeepakTiwari It's probably this line: "In the same way private constructor does not let any anyone to create second object of that class" - that isn't true. Private constructors can be invoked as many times as you like, but only from within the class.
type: Comment
comment on: http://stackoverflow.com/a/24915659

http://stackoverflow.com/comment/38840261
has text: But i added it just befor and when i want to add it again it says that it alrady exsits
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24984016

http://stackoverflow.com/comment/38836483
comment on: http://stackoverflow.com/a/24981796
has text: I've tried that if there is an error appeared in line 8 (counting from below) named "Unresolved compilation problem: Unreachable code" for the variable "activePlayer". What does that mean and how to eliminate it?
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/38887835
has text: Just a minute. Try it my way before you ask more questions.
type: Comment
comment on: http://stackoverflow.com/a/25009172
score: 1
type: AnswerComment

http://stackoverflow.com/q/24963647
has title: Passing Parameters to webservices
has comment: http://stackoverflow.com/comment/38823096
type: UnansweredQuestion
tagged with: web-services
has comment: http://stackoverflow.com/comment/38819429
answer count: 0
tagged with: java
type: Question
tagged with: jsp
has body: Hi am developing a webservice whose end point the parameters being version(v1) and model(xyz)which would generate a uniqueid. Below is the response when i run this service. <ServiceResponse > 3243jj3ni3533 <Response> My issue is I have to add another parameter to this service ie sitId. when I give the three parmeters ie version,xyz and sitid it should generate the uniqueid for me. But I have a complication here, that is I have a customerID to which I have to link to the sitID and based on that If I give siteID as parameter, uniqueid will be extracted. Below is the controller. @RequestMapping(method = RequestMethod.GET, value = "/{version}/{model}/swid", produces = { "application/xml", "application/json" }) public final ModelAndView getUniqueId(@PathVariable final String version, @PathVariable final String model) { return getModelViewForSUniqueId(model); } Please provide your suggestions as to how I can map the siteID and customerID to generate the UniqueID. Let me know if you need more details. Thanks,
score: 0
tagged with: rest

http://stackoverflow.com/q/25032895
accepted answer: http://stackoverflow.com/a/25032979
has answer: http://stackoverflow.com/a/25032979
type: AnsweredQuestion
tagged with: java
has body: I have a running Android app, which sends data to a server. If the device is not connected to the internet, it should be possible to save the data temporarily on the device. If the device retrieves the connection, it should send the saved data to the server. Even if the app is closed. My question is, how to create a "listener" which listens on the internet connection? This mechanic should work like WhatsApp. In WhatsApp you can receive messages, even when the app is closed. I've looked a bit around....could this be a Widget? And if it is one, how to not display it on the Home screen? I don't need to display any information there.
type: Question
tagged with: android-widget
answer count: 1
has title: Android Widget like WhatsApp to check connectivity and send data
tagged with: whatsapp
score: 0
tagged with: android

http://stackoverflow.com/a/25008510
downvote count: 0
score: 6
type: Answer
upvote count: 6
accepted answer of: http://stackoverflow.com/q/24976711
answers question: http://stackoverflow.com/q/24976711
has body: Clojure actually embeds a forked version of ASM, which is used for generating and loading JVM bytecode. On top of this library, I built small DSL (that's incomplete and probably broken) that allows for creating arbitrary Java classes, with a Java-like syntax. Currently, it's just a GitHub gist, and only supports extending classes, implementing interfaces, adding constructors that call superclass constructors, and fields. Here's the solution to the above question, using this DSL: (def-class MyStruct :extends com.sun.jna.Structure :implements [com.sun.jna.Structure$ByValue] ; Declare all the constructors, which just forward their ; arguments to the constructors of com.sun.jna.Structure (com.sun.jna.Structure []) (com.sun.jna.Structure [com.sun.jna.TypeMapper]) (com.sun.jna.Structure [Integer]) (com.sun.jna.Structure [Integer com.sun.jna.TypeMapper]) (com.sun.jna.Structure [com.sun.jna.Pointer]) (com.sun.jna.Structure [com.sun.jna.Pointer Integer]) (com.sun.jna.Structure [com.sun.jna.Pointer Integer com.sun.jna.TypeMapper]) ; Declare the fields of the struct ^Integer foo ^Integer bar ^Double baz) Now, I can do the following: (defn createStruct [&amp; args] (let [fn- (com.sun.jna.Function/getFunction "some-lib" "createStruct")] (.invoke fn- MyStruct (to-array args)))) (defn addStruct [&amp; args] (let [fn- (com.sun.jna.Function/getFunction "some-lib" "addStruct")] (.invoke fn- Double (to-array args)))) (addStruct (createStruct)) ; =&gt; 10.14
type: AcceptedAnswer

http://stackoverflow.com/a/25053261
type: Answer
score: 0
answers question: http://stackoverflow.com/q/25052529
has body: An additional remark: The resulting URL is not correct as it contains a space between the date part and time part. Better to use new SimpleDateFormat("yyyy/MM/dd'%20'HH:mm"); to escape the space. Don't forget the single quotes around the literal text %20.

http://stackoverflow.com/a/25021871
type: Answer
has comment: http://stackoverflow.com/comment/38912279
has comment: http://stackoverflow.com/comment/38911897
accepted answer of: http://stackoverflow.com/q/25021535
upvote count: 5
answers question: http://stackoverflow.com/q/25021535
score: 5
has comment: http://stackoverflow.com/comment/38911837
type: AcceptedAnswer
has body: Will there be overhead? Yes. Will there be much overhead? Depends. If there's one thread only, then the answer is "No", even in these ancient times uncontended synchronization was quick, supposedly they made it even better since. So what happens if there is more than 1 thread? Well here's the problem: The 2 versions you posted are not functionally equivalent. Why? Because the submethods you are calling are public methods of a public class. Hence they can be called outside your setClassTwo and hence - have no synchronization. The other thing to note is that they synchronize on different monitors. The second version synchronizes on 1 monitor only, while the original - on two. TL;DR Leave the synchronized on the methods that need to be synchronized, don't just expect the caller to synchronize (unless it's embedded in the class API). If the calling methods do the synchronization right, there will be no contention and the overhead will be very small, and if they fail to do it somehow (through someone calling your method directly, for example), then you get contention and larger overhead - but you still have thread safety.
downvote count: 0

http://stackoverflow.com/comment/38927214
has text: ya i used temp to do that thank you all
comment on: http://stackoverflow.com/q/24975362
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38718339
type: Comment
has text: By the way, many years ago, in the Charlie Brown comic strip there was a character named 5 ...
type: AnswerComment
comment on: http://stackoverflow.com/a/24917128
score: 0

http://stackoverflow.com/comment/38765791
has text: It might be helpful if you specify what you've tried and specifically which other answers from SO questions you've tried. :)
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24943724

http://stackoverflow.com/comment/38819014
type: QuestionComment
score: 1
has text: At the moment it seems to be down, but hopefully this is only temporary: The site http://www.jhlabs.com/java/java2d/strokes/ contains some nice example of complex strokes. They show some nice stoke tricks that go beyond dashed lines (where the latter are actually covered by the basic tutorial at http://docs.oracle.com/javase/tutorial/2d/geometry/strokeandfill.html ...)
comment on: http://stackoverflow.com/q/24971437
type: Comment

http://stackoverflow.com/q/24911879
type: UnansweredQuestion
duplicate of: http://stackoverflow.com/q/12391043
has comment: http://stackoverflow.com/comment/38704683
type: Question
has comment: http://stackoverflow.com/comment/38704422
has comment: http://stackoverflow.com/comment/38705066
has comment: http://stackoverflow.com/comment/38704764
score: 1
tagged with: java
tagged with: jaxb
has body: am using jaxb for converting xml response to java object, i have tried but am getting null for nested class object. XML String name 12 mapping java class @XmlRootElement(name = "person") public class person { @XmlElement(name = "name") String name; @XmlElement(name = "age") int age: @XmlElement(name = "address/info/contactadress") person.Address address; @XmlRootElement(name = "contactadress") public static class Address{ @XmlElement(name = "city") String city; @XmlElement(name = " phone") String phone; } } JaxB code: public Person parseXml(String xmlResponse, Person pserson) { StringReader stringReader = new StringReader(xmlResponse); JAXBContext jaxbContext = JAXBContext.newInstance(pserson.class); XMLInputFactory xif = XMLInputFactory.newInstance(); XMLStreamReader xsr = xif.createXMLStreamReader(stringReader); Unmarshaller unmarshaller = jaxbContext.createUnmarshaller(); return unmarshaller.unmarshal(xsr); } after converstion am getting address object is null.
has answer: http://stackoverflow.com/a/24913916
has comment: http://stackoverflow.com/comment/38704623
answer count: 2
upvote count: 1
has title: How to unmarshall xml string to object using JAXB
has comment: http://stackoverflow.com/comment/38704492
favorite count: 0
has comment: http://stackoverflow.com/comment/38704365
has answer: http://stackoverflow.com/a/24912267
tagged with: http://stackoverflow.com/tag/xml
linked to: http://stackoverflow.com/q/12391043
downvote count: 0

http://stackoverflow.com/a/25048839
answers question: http://stackoverflow.com/q/25047018
type: Answer
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/25047018
has comment: http://stackoverflow.com/comment/38963169
type: AcceptedAnswer
downvote count: 0
has body: The new error is about the content of the log4j.xml file. Your root Configuration element has no namespace declaration: &lt;log4j:configuration debug="true" xmlns:log4j="http://jakarta.apache.org/log4j/"&gt; Can this help?

http://stackoverflow.com/comment/38975445
has text: Oh Thanks! I didn't find that one!
type: Comment
comment on: http://stackoverflow.com/q/25055797
type: QuestionComment
score: 0

spring-data-rest
tags question: http://stackoverflow.com/q/25060027
tag name: spring-data-rest
type: Tag
tags question: http://stackoverflow.com/q/24936636

http://stackoverflow.com/comment/77195906
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24919599
type: Comment
has text: 1st, it sounds like you used the wrong component listener - don't use one that loops forever when that is not what you require. 2nd, messages that are part of a transaction but have not been committed will be include in the 'Current Depth' count.

http://stackoverflow.com/comment/38807348
has text: "Unsupported major.minor version 52.0" mean compiled with Java 8. Recompile as Java 6 or install Java 8 and tell eclipse about it.
comment on: http://stackoverflow.com/q/24966428
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25033093
upvote count: 4
downvote count: 0
score: 4
answers question: http://stackoverflow.com/q/25032880
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25032880
type: Answer
has body: Change: frame.getContentPane().add(lblimage, BorderLayout.CENTER); JScrollPane pane = new JScrollPane(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); frame.getContentPane().add(pane, BorderLayout.EAST); To: //frame.getContentPane().add(lblimage, BorderLayout.CENTER); JScrollPane pane = new JScrollPane(lblimage, // add image to scroll-pane! JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); frame.getContentPane().add(pane, BorderLayout.CENTER);

http://stackoverflow.com/a/25118715
accepted answer of: http://stackoverflow.com/q/24952989
has comment: http://stackoverflow.com/comment/39100384
has comment: http://stackoverflow.com/comment/39099888
type: Answer
has comment: http://stackoverflow.com/comment/39099654
has body: You need to check the WEB-INF/lib directory of your WAR files to ensure that they do not contain jars that also exist in the EAR/lib directory. Web apps will always use the WEB-INF/lib classes before looking for them in the EAR file. However, classes loaded from the EAR will only see the other classes in the EAR. If you have the same (or similar) jar file in both places this will lead to class loading issues such as you describe.
score: 2
downvote count: 0
upvote count: 2
answers question: http://stackoverflow.com/q/24952989
has comment: http://stackoverflow.com/comment/39099192
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39113069

http://stackoverflow.com/a/24991349
upvote count: 4
accepted answer of: http://stackoverflow.com/q/24971026
type: AcceptedAnswer
downvote count: 0
score: 4
type: Answer
answers question: http://stackoverflow.com/q/24971026
has body: An alternative to inheritance is delegation, as mentioned by Alan Stokes. A good way to make use of this in junit is: use Rules. Some are provided, but you can rather easy create your own set of rules. The major benefit we have experienced is that you can cherry pick the common features you want to have. Sometimes you just want a tiny bit of the common abstract test class. But as you can only have the full set or nothing, you may end up setting up a database state for a rather simple unit test. In the sample below from the junit Wiki the TemporaryFolder Rule adds the ability to the test to create temporary folders and files. Those will be deleted after every test execution. public static class HasTempFolder { @Rule public TemporaryFolder folder = new TemporaryFolder(); @Test public void testUsingTempFolder() throws IOException { File createdFile = folder.newFile("myfile.txt"); File createdFolder = folder.newFolder("subfolder"); // ... } } Another good thing about it is that you can change the behaviour to class level rather easy. A situation where you might want to have this is the setup of an expensive fixture state in a database or search index. Or when you create a big sample XML for some ETL process for which you want to run an integration test. This should be used only when performing read only operations. To move it to class level, you just need to make the member static and add the @ClassRule annotation instead of @Rule public static class HasDataBaseState { @ClassRule public static DataBaseState dbState = new DataBaseState(); @Test public void testUsingDataBaseState() throws IOException { // perform tests dbState.query("select count from table where attribute = 'x'"); } } There are more features, but those are covered rather good on the junit wiki. The facts I pointed out are the ones we like most about it.

http://stackoverflow.com/comment/39166050
comment on: http://stackoverflow.com/a/24911159
type: AnswerComment
type: Comment
has text: Thanks, McDowell. I've read [this](http://www.coffee-bytes.com/2013/11/26/understanding-method-refs/) carefully, but I think I'm overchallenged with this. Looks like I'll have to stick with the setters.
score: 0

http://stackoverflow.com/q/25044836
tagged with: arraylist
linked to: http://stackoverflow.com/q/16188813
score: 0
has body: Supposed we have pushed n elements in an ArrayList in java. If we remove all elements from this list, still the elementData buffer array of ArrayList is of size of order n, it does not shrink in size as elements are removed from it. Won't it be better if the size of array shrinks as elements are removed from ArrayList?
has comment: http://stackoverflow.com/comment/38955407
has answer: http://stackoverflow.com/a/25044906
has answer: http://stackoverflow.com/a/25044871
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/25044871
type: Question
has title: Why the element buffer of ArrayList in java is not reduced in size when elements are removed from ArrayList?
answer count: 3
possible better answer: http://stackoverflow.com/a/25044876
has answer: http://stackoverflow.com/a/25044876
linked to: http://stackoverflow.com/q/2673398

http://stackoverflow.com/q/24929207
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38738431
tagged with: network-programming
has comment: http://stackoverflow.com/comment/38737640
tagged with: java
answer count: 1
has comment: http://stackoverflow.com/comment/38738198
accepted answer: http://stackoverflow.com/a/25054939
tagged with: tomcat
has comment: http://stackoverflow.com/comment/38737005
score: 0
tagged with: playframework-1.x
has title: Moving webapp from localhost to server - page cannot be found
has comment: http://stackoverflow.com/comment/38823512
has answer: http://stackoverflow.com/a/25054939
has body: I have developed a Play! 1.2.7 web application which calls an existing online payment service, eclipsified to work in Java. I send data in POST to a servlet and get a response in GET to my application. This is possible because one of the data sent to the service is the URL of my controller handling the response. I had this working perfectly in local environment but when I move the webapp to a Tomcat container on our local server with public ip I'm stuck because service response cannot find my webapp as it used to do with localhost. Locally the URL was something like http://localhost:port/myAction When I put it on tomcat I changed the URL to http://my.public.ip.address:tomcat_port/app_name/myAction I get the "page is not available" message from browser. My guess is that I miss some basics from network communication and I'd like to know how to have this working when the application is deployed on our server. Ps. sorry for bad tagging, I'm not sure what's this question's target EDIT: no logs from catalina.out. If I run the application nothing gets logged
has comment: http://stackoverflow.com/comment/38743478
tagged with: http
type: Question

http://stackoverflow.com/comment/38803418
type: QuestionComment
comment on: http://stackoverflow.com/q/24964242
has text: Correct me if I'm wrong, but it does say `-1`, which `2147483647` doesn't give any problems
score: 0
type: Comment

http://stackoverflow.com/comment/38904012
has text: Did you try stepping through in a debugger? You should be able to see where within `getSheetAt` it's getting stuck.
comment on: http://stackoverflow.com/q/25013988
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24943381
type: Answer
upvote count: 12
accepted answer of: http://stackoverflow.com/q/24939398
has body: To wrap it all together, here my answer. First of all rabbitmq, or at least the java client, has some weird default properties which are sometimes in seconds and sometimes in milliseconds. Also their default values do not seem well thought from my point of view. For example connectionTimeouts default value is 0, which means wait for ever. You should also set the networkRecoveryInterval property to some usefull value in your environment. To get a more information what caused the channel to close, implement a ShutdownListener - Even if it just prints the exception, it will help you to find out what caused the error. To test auto recovery of a connection I used an ip tables command on the client side. Then you can also see what happens on the server side in the rabbitmq.log And do not forget to adjust the requestHeartbeet property, in my setup its always above 5 seconds, the default one is in some client implementations 580 seconds which seems a bit strange also, keep that in mind. In any way, even if you run rabbitmq in a cluster, it does not work well on unreliable networks. Maybe you are interested in more regarding this than I should advise you to look in the documentation.
answers question: http://stackoverflow.com/q/24939398
score: 12
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/73601482
downvote count: 0

http://stackoverflow.com/comment/38723359
comment on: http://stackoverflow.com/q/24920916
has text: Parenthesis in the wrong place..: System.out.println(Integer.toString(255, 16).toUpperCase());
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24962250
has title: Is it bad to have many references to the same object?
tagged with: java
has comment: http://stackoverflow.com/comment/38799512
has answer: http://stackoverflow.com/a/24963516
has comment: http://stackoverflow.com/comment/38799456
has comment: http://stackoverflow.com/comment/38799392
type: Question
upvote count: 4
has body: Thinking about this question, I don't think it would be bad since object references only take up 4 bytes of memory (in a 32-bit JVM), but intuitively I feel like I'm doing something wrong when I have many (+100) references to the same object. This usually happens when I create a certain class +100 times and each need to hold the reference. I know I can re-design my code in most cases to avoid this, but sometimes its much easier to just keep the reference within each object. Anyway, is it bad to have many references to the same object?
answer count: 2
has answer: http://stackoverflow.com/a/24962532
has comment: http://stackoverflow.com/comment/38803098
tagged with: jvm
has comment: http://stackoverflow.com/comment/38799396
score: 3
has comment: http://stackoverflow.com/comment/38799589
has comment: http://stackoverflow.com/comment/38799663
has comment: http://stackoverflow.com/comment/38800567
favorite count: 0
linked to: http://stackoverflow.com/q/3733215
has comment: http://stackoverflow.com/comment/38799522
has comment: http://stackoverflow.com/comment/38800079
has comment: http://stackoverflow.com/comment/38800451
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38799597
has comment: http://stackoverflow.com/comment/38800619
downvote count: 1
has comment: http://stackoverflow.com/comment/38799485

http://stackoverflow.com/a/24958092
score: 0
accepted answer of: http://stackoverflow.com/q/24940814
type: AcceptedAnswer
type: Answer
has body: Solved it! it was missing this on build.graddle signingConfigs { debug { storeFile file("debug.jks") } } Thanks for the help
answers question: http://stackoverflow.com/q/24940814

http://stackoverflow.com/q/25047038
has comment: http://stackoverflow.com/comment/38959973
has comment: http://stackoverflow.com/comment/38959585
has comment: http://stackoverflow.com/comment/38959869
has body: I'm taking a beginners Java course over the summer. I need to make a pyramid using loops for homework. The pyramid has to be made out of asterisks; in addition, size of pyramid is determined by user. This is what I have for code now; public class Pyramid { public static void main(String[] args) { int size = 6; for (int x = 0; x &lt; size; x++) { for (int y = x; y &lt; size; y++) { } for (int z = 0; z &lt;= x; z++) { System.out.print("*"); } System.out.println(""); } } } The problem of my code is that the number of asterisks in each row is wrong by one.
answer count: 4
type: UnansweredQuestion
downvote count: 2
has answer: http://stackoverflow.com/a/25047328
has answer: http://stackoverflow.com/a/25130383
type: Question
has answer: http://stackoverflow.com/a/25047317
tagged with: java
has title: How can I print a scalable pyramid in size determined with user input?
has comment: http://stackoverflow.com/comment/38959432
upvote count: 2
score: 0
tagged with: for-loop
has comment: http://stackoverflow.com/comment/38959944
has answer: http://stackoverflow.com/a/25047553
favorite count: 0

http://stackoverflow.com/a/24930758
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/24930044
has body: One way to bypass this is to load your openssl.dll prior to loading myDLL, so myDLL will find the symbols loaded when it tries to initiate . Other ways to go around this : add the openssl.dll to PATH (you already mentioned this) copy openssl in system32 at install time put openssl in the same folder as your executable path This however will only work on Windows. In linux, you will have to change the rpath inside the .so (but I believe this is out of scope).
score: 1
upvote count: 1

http://stackoverflow.com/a/25011252
has comment: http://stackoverflow.com/comment/51816773
has comment: http://stackoverflow.com/comment/38892895
accepted answer of: http://stackoverflow.com/q/25010763
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25010763
upvote count: 30
has comment: http://stackoverflow.com/comment/45493181
type: Answer
has body: A specialized enum is nothing but a subclass with inner-class semantics. If you look at the byte code after compilation, you will notice that the compiler only inserts accessor method for reading a private field but any specialized enum is compiled as its own class. You can think about your enum as being implemented as: public abstract class MyEnum { private static class First extends MyEnum { @Override public String doIt() { return "1: " + someField; //error } } private static class Second extends MyEnum { @Override public String doIt() { return "2: " + someField; //error } } public static final MyEnum FIRST = new First(); public static final MyEnum SECOND = new Second(); private String someField; public abstract String doIt(); } As you can see, the same compiler errors occur. Effectively, your problem does not relate to enums but to their inner-class semantics. However, you found a borderline case of the compiler guessing the intend of your code and trying to warn you that what you intend is illegal. In general, the someField field is visible to any specialized enum. However, there are two ways of accessing the private field from an inner class and only one is legal: private members are not inherited. You can therefore not access a private field from this instance when it was defined in a super class. For inner classes, members of outer classes are accessible even if they are private. This is achieved by the compiler by inserting accessor methods to the outer classes which expose the private fields by accessor methods. A non-static field can only be accessed if the inner class is non-static. For enums, the inner classes are however always static. The later condition is what the compiler complains about: Cannot make a static reference to the non-static field someField You are trying to access a non-static field from a static inner class. This is not possible even though the field would be technically visible because of the inner class semantics. You could instruct …
downvote count: 1
score: 29

http://stackoverflow.com/comment/38878161
has text: because I use another method that needs the mouse pressed at least so I thought I'd save from using one method. It still didn't work either, it really seems like the JDialog I open doesn't instantiate any of the listeners... That's what I'll have to work on, unless if you can help me with this please.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25003668

http://stackoverflow.com/comment/51905915
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25001086
has text: What about a dynamic URI in "from"?
score: 0

http://stackoverflow.com/comment/38952576
score: 0
type: Comment
has text: what is the logic behind that?
type: AnswerComment
comment on: http://stackoverflow.com/a/25043383

android-layout-weight
tags question: http://stackoverflow.com/q/25004024
tag name: android-layout-weight
type: Tag

http://stackoverflow.com/q/24960045
has comment: http://stackoverflow.com/comment/38795105
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38795007
tagged with: annotations
tagged with: java
type: Question
score: 0
has title: Whether a specific function parameter annotated?
has body: How to determine whether method has an annotated parameter? Let we have Param @interface @Target(value = {ElementType.PARAMETER}) @Retention(value = RetentionPolicy.RUNTIME) @Documented public @interface Param { public String value() default ""; } and MyClass class public class MyClass{ public static void method(@Param("param") String p){ //Do something } } I need to check MyClass.method for annotated parameter programmatically.

http://stackoverflow.com/tag/xml
tags question: http://stackoverflow.com/q/24922936
tags question: http://stackoverflow.com/q/25020205
tags question: http://stackoverflow.com/q/24911879
tags question: http://stackoverflow.com/q/25043212
tags question: http://stackoverflow.com/q/24910991
tags question: http://stackoverflow.com/q/25017436
tags question: http://stackoverflow.com/q/25045688
tags question: http://stackoverflow.com/q/24964644
tags question: http://stackoverflow.com/q/25014047
tags question: http://stackoverflow.com/q/25020970
type: Tag
tags question: http://stackoverflow.com/q/24986157
tags question: http://stackoverflow.com/q/24916578
tags question: http://stackoverflow.com/q/25033285
tags question: http://stackoverflow.com/q/25023981
tags question: http://stackoverflow.com/q/25060938
tags question: http://stackoverflow.com/q/24990094
tags question: http://stackoverflow.com/q/24967809
tags question: http://stackoverflow.com/q/24924484
tags question: http://stackoverflow.com/q/25041851
tags question: http://stackoverflow.com/q/25001921
tags question: http://stackoverflow.com/q/25003891
tags question: http://stackoverflow.com/q/25024694
tags question: http://stackoverflow.com/q/25024845
tags question: http://stackoverflow.com/q/25008834
tags question: http://stackoverflow.com/q/25005654
tags question: http://stackoverflow.com/q/24948468
tags question: http://stackoverflow.com/q/25032186
tags question: http://stackoverflow.com/q/24987535
tags question: http://stackoverflow.com/q/25047751
tags question: http://stackoverflow.com/q/24998830
tags question: http://stackoverflow.com/q/25034829
tags question: http://stackoverflow.com/q/25029438
tags question: http://stackoverflow.com/q/24957826
tags question: http://stackoverflow.com/q/24913206
tags question: http://stackoverflow.com/q/24958148
tags question: http://stackoverflow.com/q/24958312
tags question: http://stackoverflow.com/q/24957170
tags question: http://stackoverflow.com/q/25031633
tags question: http://stackoverflow.com/q/25056342
tags question: http://stackoverflow.com/q/25013883
tags question: http://stackoverflow.com/q/25013776
tags question: http://stackoverflow.com/q/24964388
tags question: http://stackoverflow.com/q/24982321
tags question: http://stackoverflow.com/q/25032751
tags question: http://stackoverflow.com/q/24972006
tags question: http://stackoverflow.com/q/25012082
tags question: http://stackoverflow.com/q/25027639
tags question: http://stackoverflow.com/q/25018587
tags question: http://stackoverflow.com/q/24954418
tags question: http://stackoverflow.com/q/24921290
tags question: http://stackoverflow.com/q/24999122
tags question: http://stackoverflow.com/q/25004508
tags question: http://stackoverflow.com/q/24928743
tags question: http://stackoverflow.com/q/24965825
tags question: http://stackoverflow.com/q/25068658
tags question: http://stackoverflow.com/q/25019931
tags question: http://stackoverflow.com/q/24998592
tags question: http://stackoverflow.com/q/24956532
tags question: http://stackoverflow.com/q/25065575
tags question: http://stackoverflow.com/q/25042655
tags question: http://stackoverflow.com/q/24941750
tags question: http://stackoverflow.com/q/24967074
tag name: xml
tags question: http://stackoverflow.com/q/25057281
tags question: http://stackoverflow.com/q/24970782
tags question: http://stackoverflow.com/q/24968684
tags question: http://stackoverflow.com/q/25032814
tags question: http://stackoverflow.com/q/24990948
tags question: http://stackoverflow.com/q/25034076
tags question: http://stackoverflow.com/q/24976986
tags question: http://stackoverflow.com/q/25000446
tags question: http://stackoverflow.com/q/25048782
tags question: http://stackoverflow.com/q/25041444
tags question: http://stackoverflow.com/q/25058044
tags question: http://stackoverflow.com/q/24935437
tags question: http://stackoverflow.com/q/25028990
tags question: http://stackoverflow.com/q/25043691
tags question: http://stackoverflow.com/q/24992956
tags question: http://stackoverflow.com/q/25010620

http://stackoverflow.com/comment/38827640
type: Comment
score: 2
comment on: http://stackoverflow.com/q/24977328
has text: I think this question is better suited for [Code Review](http://codereview.stackexchange.com)
type: QuestionComment

http://stackoverflow.com/comment/38745351
has text: Should I create a class for each exception or can I create enumeration and than use it ?
type: AnswerComment
comment on: http://stackoverflow.com/a/24933615
score: 0
type: Comment

http://stackoverflow.com/q/25053506
type: UnansweredQuestion
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/38974901
type: Question
has comment: http://stackoverflow.com/comment/38971953
has body: I am trying to update a purchase order record in netsuite from my webservices request. Instead of updating the record it adds a new record with same details of previous record. For example I have added one record for an item with quantity 150, now I want to update this quantity to 200. when I done update operation observed that there is two records one with 150 and another with 200. Here is the code. Where am I doing wrong? PurchaseOrder po=new PurchaseOrder(); RecordRef rf=new RecordRef(); rf.setInternalId("1683"); po.setEntity(rf); Calendar trandate=Calendar.getInstance(); po.setTranDate(trandate); po.setCurrencyName("USA"); RecordRef rf1=new RecordRef(); rf1.setName("Primary Purchase Order"); po.setCustomForm(rf1); CustomFieldList cfl=new CustomFieldList(); CustomFieldRef[] cfr=new CustomFieldRef[3]; cfr[0]=new StringCustomFieldRef("5391","custbody23", "zy-vnd-103"); ListOrRecordRef listOrRecordRef1=new ListOrRecordRef(); listOrRecordRef1.setName("Transportation Method"); listOrRecordRef1.setInternalId("1"); ListOrRecordRef listOrRecordRef2=new ListOrRecordRef(); listOrRecordRef2.setName("Delivery Incoterm"); listOrRecordRef2.setInternalId("1"); cfr[1]=new MultiSelectCustomFieldRef("5392","custbody24",new ListOrRecordRef[]{listOrRecordRef1}); cfr[2]=new MultiSelectCustomFieldRef("5393","custbody25",new ListOrRecordRef[]{listOrRecordRef2}); cfl.setCustomField(cfr); po.setCustomFieldList(cfl); RecordRef rf2=new RecordRef(); rf2.setName("22:London"); rf2.setInternalId("10"); po.setLocation(rf2); Double exchangeRate=1.0; po.setExchangeRate(exchangeRate); PurchaseOrderItemList poil=new PurchaseOrderItemList(); PurchaseOrderItem[] item=new PurchaseOrderItem[1]; item[0]=new PurchaseOrderItem(); RecordRef rf3=new RecordRef(); rf3.setName("ACC05"); rf3.setInternalId("1070"); item[0].setItem(rf3); item[0].setRate("15.28"); double qty=50.0; item[0].setQuantity(qty); double amt=764.0; item[0].setAmount(amt); Calendar expectedReceiptDate=Calendar.getInstance(); expectedReceip…
has title: How to update Purchase order record in netsuite
upvote count: 1
tagged with: web-services
has comment: http://stackoverflow.com/comment/39008257
tagged with: java
has comment: http://stackoverflow.com/comment/113370954
answer count: 0
downvote count: 0
tagged with: netsuite

http://stackoverflow.com/comment/38734568
type: Comment
has text: Remove static from open_connection().
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24927473

http://stackoverflow.com/q/25028645
has comment: http://stackoverflow.com/comment/38924643
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38924630
has answer: http://stackoverflow.com/a/25028719
tagged with: java
has comment: http://stackoverflow.com/comment/38924581
has body: I am just writing the code after a while for servlet/jsp. When I am calling servlet it is giving me blank browser and even not an error. My Jsp : <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> Insert title here Please enter a color My Servlet : import java.io.IOException; import java.io.PrintWriter; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; /** * Servlet implementation class HelloServlet */ @WebServlet("/HelloServlet") public class HelloServlet extends HttpServlet { private static final long serialVersionUID = 1L; /** * @see HttpServlet#HttpServlet() */ public HelloServlet() { super(); // TODO Auto-generated constructor stub } /** * @see HttpServlet#service(HttpServletRequest request, HttpServletResponse * response) */ protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub } /** * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse * response) */ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub System.out.println("Servlet called..."); String color = request.getParameter("color"); PrintWriter out = response.getWriter(); /* * out.println( * * " \n" + " \n" + * " \n" * + " My first jsp \n" + " \n" + " \n" + * "" + "Hello World" + * " \n" + " \n" + " "); */ out.println("Aman............."); } /** * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse * response) */ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub doGet(request, response); } } And web.xml : <?xml version="1.0" encoding="UTF-8"?> HelloServlet Hel…
has comment: http://stackoverflow.com/comment/38924682
tagged with: servlets
type: Question
has title: Servlet not displaying anything while called
tagged with: jsp
has comment: http://stackoverflow.com/comment/38924601
score: 0
has answer: http://stackoverflow.com/a/25028852
has comment: http://stackoverflow.com/comment/38924701
answer count: 3
has answer: http://stackoverflow.com/a/25028993

http://stackoverflow.com/comment/38798688
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24943298
has text: so it does use a classloader?

http://stackoverflow.com/comment/38985632
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25060849
has text: Thanks, thing is, I need it in static contexts too, where what you've suggested won't work (I think)

http://stackoverflow.com/a/25041169
type: Answer
answers question: http://stackoverflow.com/q/25039981
score: 0
has body: Use the rolling file appended in log4j... It destroys the log file for every run. Thanks and regards, Hari

ajax
tags question: http://stackoverflow.com/q/24931226
tags question: http://stackoverflow.com/q/24972559
type: Tag
tags question: http://stackoverflow.com/q/24951360
tags question: http://stackoverflow.com/q/24921462
tags question: http://stackoverflow.com/q/24985095
tags question: http://stackoverflow.com/q/24936873
tags question: http://stackoverflow.com/q/24942844
tags question: http://stackoverflow.com/q/24939515
tags question: http://stackoverflow.com/q/25022357
tags question: http://stackoverflow.com/q/24977431
tags question: http://stackoverflow.com/q/25056207
tags question: http://stackoverflow.com/q/24974451
tags question: http://stackoverflow.com/q/25021155
tags question: http://stackoverflow.com/q/24946892
tag name: ajax

http://stackoverflow.com/comment/39017219
comment on: http://stackoverflow.com/q/25061951
type: Comment
has text: To me, this approach is ok.
type: QuestionComment
score: 0

http://stackoverflow.com/comment/38977896
type: Comment
type: QuestionComment
score: 1
has text: You should use the dataStructure like ArrayList<Integer> or something similar, that does not have index-value relation. Because you cardID is itself unique. So it will help you to directly delete the card by its ID, as @Luksprog has commented. I guess you are currently using an array as your dataStructure.
comment on: http://stackoverflow.com/q/25057117

http://stackoverflow.com/a/24996278
has comment: http://stackoverflow.com/comment/61866801
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38864136
has comment: http://stackoverflow.com/comment/62159205
upvote count: 26
type: Answer
answers question: http://stackoverflow.com/q/24996017
has body: It seems so. #include "jni_md.h" would include the file in the same directory as jni.h, but it is placed in linux folder. In previous JDK versions it seems that file and another were place in include/linux folder, but there are symlinks to both files in include. So you can just create symlinks to both files: $ sudo ln -s /opt/jdk1.8.0_11/include/linux/jni_md.h /opt/jdk1.8.0_11/include/jni_md.h $ sudo ln -s /opt/jdk1.8.0_11/include/linux/jawt_md.h /opt/jdk1.8.0_11/include/jawt_md.h Edit As stated in the comments by Absurd-Mind and Mikkel, there is also the option to add that path to the makefile compiler options: -I$(JAVA_HOME)/include/linux/
accepted answer of: http://stackoverflow.com/q/24996017
downvote count: 0
has comment: http://stackoverflow.com/comment/38864315
score: 26
has comment: http://stackoverflow.com/comment/38863444
has comment: http://stackoverflow.com/comment/38863831

http://stackoverflow.com/q/24945981
tagged with: android
upvote count: 1
tagged with: c++
has comment: http://stackoverflow.com/comment/38791967
answer count: 0
has title: Issue using TextureView with NDK
score: 1
tagged with: java
tagged with: android-ndk
type: Question
has comment: http://stackoverflow.com/comment/38805433
downvote count: 0
favorite count: 0
has body: I'm working on a small piece of code using a TextureView to display the result of a MediaPlayer. I'm facing an issue trying to mix managed code and native code using NDK. If my Activity inherit from NativeActivity instead of Activity, my app is broken. Is it a known limitation? Is it a related to the NDK glue? Here is my Activity Code: public class SurfaceActivity extends NativeActivity { private static final boolean VERBOSE = true; private static final String TAG = "native"; private static final String FILES_DIR = "/sdcard/"; private static final String INPUT_FILE = "video1.mp4"; TextureView mView = null; MediaPlayer mPlayer = new MediaPlayer(); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); try { File inputFile = new File(FILES_DIR, INPUT_FILE); mPlayer.setDataSource(inputFile.toString()); } catch(Exception e) { Log.e(TAG, "File Exception", e); } FrameLayout content = new FrameLayout(this); content.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,ViewGroup.LayoutParams.MATCH_PARENT)); mView = new TextureView(this); mView.setSurfaceTextureListener( new TextureViewListener( ) ); mView.setOpaque(false); mView.setLayoutParams(new FrameLayout.LayoutParams(200, 200)); mView.setBackgroundColor(Color.TRANSPARENT); content.addView(mView); addContentView(content, content.getLayoutParams()); } public class TextureViewListener implements TextureView.SurfaceTextureListener { public void onSurfaceTextureAvailable(SurfaceTexture surface, int width, int height) { Log.i(TAG,"onSurfaceTextureAvailable"); mPlayer.setSurface(new Surface(surface)); mPlayer.prepareAsync(); mPlayer.setOnPreparedListener(new MediaPlayer.OnPreparedListener() { public void onPrepared(MediaPlayer mp) { mp.start(); } }); } public void onSurfaceTextureSizeChanged(SurfaceTexture surface, int width, int height) { } public boolean onSurfaceTextureDestroyed(SurfaceTexture surface) { return true; } public void onSurfaceTextureUpdat…
type: UnansweredQuestion

http://stackoverflow.com/q/24961307
has answer: http://stackoverflow.com/a/24964998
type: UnansweredQuestion
tagged with: maven
has comment: http://stackoverflow.com/comment/38799196
has comment: http://stackoverflow.com/comment/38798406
has comment: http://stackoverflow.com/comment/38799804
has body: I have a library which is used via inline taglets. It's intended to be used by other libraries, for inserting example code into their JavaDoc. The library is done, and, hallelujah, as of yesterday, it's now on Maven Central. I'm now implementing this library into another project for the first time. That project compiles its code with java.version 1.5. But the taglet library requires 1.7. Not just for running javadoc.exe, but also for compiling optional "taglet customizer" classes. UPDATE: These customizer classes are created by each developer--the person using the taglet library in their library. The customizer classes (which are completely optional--they're needed only for advanced features, and you can get away with creating none) are required to be compiled before executing javadoc.exe. So it needs the following goals: Compile the main library classes (requires Java 1.5) (mvn compile) Compile the customizers (requires Java 1.7) (mvn compilecodelet?) Run javadoc.exe (Java 1.7) (`mvn docs'?) mvn install would therefore call these three goals in order. I'm new to Maven, and would appreciate some advice on how to do this. This is what I've found out so far: Here's the project's current compile goal: <java.version>1.5</java.version> maven-compiler-plugin 2.3.2 UTF-8 ${java.version} ${java.version} It seems the JDK for this project should be upgraded to 1.7, with the main classes compiled with the and flags set to 1.5, and the taglet-customizers compiled with those flags set to 1.7. Some references: maven-compiler-plugin overview Compiling Sources Using A Different JDK, but I believe the only JDK hi How can I set up this extra compilecodelet goal, and set the whole project up so it can handle both JDK versions? And so that mvn install (and whatever other "master" goals) also call this new sub-goal in the proper sequence? As I said, I'm new to Maven, and although I'm starting to understand bits and pieces, but I don't know how to put this all together yet. Thank you for…
tagged with: java
has comment: http://stackoverflow.com/comment/38798759
type: Question
has title: How to have an extra compile goal in POM, which uses a different Java version?
has comment: http://stackoverflow.com/comment/38799700
has comment: http://stackoverflow.com/comment/38799171
score: 0
has comment: http://stackoverflow.com/comment/38803163
answer count: 1
has comment: http://stackoverflow.com/comment/38798463

http://stackoverflow.com/comment/39001839
score: 0
has text: @biziclop: To your second comment, that is an important point, but you're not necessarily forcing the developer to provide these. The enum class can define, for example, how to *get* the appropriate value on the fly. It could even be using a static `Map` as a backing object to store this information.
type: AnswerComment
comment on: http://stackoverflow.com/a/25069114
type: Comment

http://stackoverflow.com/a/24981299
downvote count: 0
answers question: http://stackoverflow.com/q/24981188
score: 1
has comment: http://stackoverflow.com/comment/38834931
accepted answer of: http://stackoverflow.com/q/24981188
has comment: http://stackoverflow.com/comment/38834872
has comment: http://stackoverflow.com/comment/38834907
upvote count: 1
has comment: http://stackoverflow.com/comment/38838041
type: AcceptedAnswer
has body: Your data types do not match... You are trying to put an ArrayList&lt;Integer&gt; into a int[]. It cannot hold this type of data! please reconsider what you want to have: int[][] ArrayList&lt;int[]&gt; ArrayList&lt;ArrayList&lt;Integer&gt;&gt; ArrayList&lt;Integer&gt;[] &lt;--- thi is not well-supported due to the way generics work If you want higher performance, you should have a look at GNU Trove, and maybe use ArrayList&lt;TIntList&gt; which should use much less memory than ArrayList&lt;ArrayList&lt;Integer&gt;&gt;. If your data size is fixed, you probably are looking for int[][] bucket = new int[max+1][max/5+1];
has comment: http://stackoverflow.com/comment/38834831
type: Answer
has comment: http://stackoverflow.com/comment/38836988

http://stackoverflow.com/q/24996702
linked to: http://stackoverflow.com/q/19187468
score: 1
tagged with: java
upvote count: 1
type: Question
downvote count: 0
tagged with: tomcat
has answer: http://stackoverflow.com/a/24998533
has title: Maven tomcat plugin does not accept path
answer count: 1
has body: I am currently trying to set a path that is different from my artifactId of the maven-project. Unfortunately, my attempts do not work. I tried setting it by [...] org.apache.tomcat.maven tomcat7-maven-plugin 2.2 /AWV AWV but when calling mvn tomcat7:run-war none of them works (but the war is corretly named AWV.war). All documentation I could find (http://mojo.codehaus.org/tomcat-maven-plugin/configuration.html, http://tomcat.apache.org/maven-plugin-trunk/tomcat7-maven-plugin/run-war-mojo.html) says I could do this by setting the path this way. Alternatively, I tried running tomcat with mvn tomcat7:run-war -Dmaven.tomcat.path=/AWV which didn't work either. Additional hints, like executing clean before (Eclipse maven run configuration using 'run' goal from tomcat7 maven plugin doesn't respect default context path) did not work either. Has anyone an idea how to solve this? Edit: This also happens when using 2.3-SNAPSHOT of the tomcat-maven-plugin.
favorite count: 0
has comment: http://stackoverflow.com/comment/38876110
type: UnansweredQuestion
tagged with: maven
has comment: http://stackoverflow.com/comment/38892481

http://stackoverflow.com/comment/38730544
score: 0
type: Comment
has text: The link to the connector: [MongoDB Connector](http://community.jaspersoft.com/project/mongodb-connector/releases). For more details see the [jasper report with mongodb in aggregation framework](http://stackoverflow.com/questions/14387099/jasper-report-with-mongodb-in-aggregation-framework) post
type: QuestionComment
comment on: http://stackoverflow.com/q/24917849

http://stackoverflow.com/comment/38850387
has text: @Jr.Programmer and what does the red line says ? (compilation error due to missing/incorrect `import` ?)
comment on: http://stackoverflow.com/a/24989295
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/38907368
has text: Network folder means: "A folder which resides on a network drive. (On Windows you can add Network Drives by clicking 'Computer ---> Add Network Drive' placed in the upper band)"
comment on: http://stackoverflow.com/q/25013581
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38712216
comment on: http://stackoverflow.com/a/24915595
type: Comment
has text: @Swapnil Ah! I completely misinterpreted your comment then.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/38961990
type: Comment
has text: Why do you need such a folder structure?
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25048431

http://stackoverflow.com/q/24924937
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/24944603
has title: Read text string into 2D array
has answer: http://stackoverflow.com/a/24940191
upvote count: 1
has comment: http://stackoverflow.com/comment/38748826
type: Question
tagged with: object
has answer: http://stackoverflow.com/a/24925602
tagged with: stringbuilder
has comment: http://stackoverflow.com/comment/38729305
tagged with: arrays
has comment: http://stackoverflow.com/comment/38729355
possible better answer: http://stackoverflow.com/a/24940300
has comment: http://stackoverflow.com/comment/38739812
has answer: http://stackoverflow.com/a/24938557
has comment: http://stackoverflow.com/comment/38729352
has body: Need to read a set of text string files into a 2D array. The text string format looks like this, each line ends with "\n" with various length "dog", "runs", "fast" "birds", "flies", "high" "baby", "cries", "often", "in the evening" "He", "works" .... Would like to get the 2D array output below: { {"dog", "runs", "fast"}, {"birds", "flies", "high"}, {"baby", "cries", "often", "in the evening"}, {"He", "works"}, ... } Thinking to use StringBuilder to read each line from a file and append it to a 2D Object [][] array (but used String [][] instead). The following codes are my initial attemps - not pretty, but not working either. import java.io.*; import java.util.*; public class My2DArrayTest { public static void main(String args[]) { String[][] myString = new String[4][3]; try { FileReader file = new FileReader("MyTestFile.txt"); BufferedReader reader = new BufferedReader (file); String strLine; String EXAMPLE_TEST; for (int row = 0; row &lt; 4; row++) { for (int column = 0; column &lt; 3; column++) { while ((strLine = reader.readLine()) != null{ if (strLine.length() &gt; 0) { EXAMPLE_TEST = strLine; System.out.println ("This is EXAMPLE_TEST: " + EXAMPLE_TEST); myString[row][column]=EXAMPLE_TEST; System.out.println("Current row: " + row); System.out.println("Current column: " + column); System.out.println("This is myString Array:" + myString[row][column] + " "); } } } } file.close(); } catch( IOException ioException ) {} } }
downvote count: 0
favorite count: 0
answer count: 5
accepted answer: http://stackoverflow.com/a/24944603
has answer: http://stackoverflow.com/a/24940300
has comment: http://stackoverflow.com/comment/38760883
type: AnsweredQuestion

http://stackoverflow.com/a/33830156
has body: I just figured this out start with this to get whats scheduled. ThreadPoolTaskScheduler xScheduler = (ThreadPoolTaskScheduler)this.taskScheduler; ScheduledThreadPoolExecutor xService = (ScheduledThreadPoolExecutor)xScheduler.getScheduledExecutor(); BlockingQueue&lt;Runnable&gt; queue = xService.getQueue(); Object[] scheduledJobs = queue.toArray(); If this array look at instance in debugger to find what you need out. Then write reflection code like this to get at the hidden API's in Spring and Java. See the set Accessible this is only way to get at these private items. You might need to use different public classes to get at certain private fields, look at api docs and view source on these classes in eclipse. Method delayM = obj.getClass().getDeclaredMethod("getDelay", TimeUnit.class); delayM.setAccessible(true); // delayM = obj.getClass().getDeclaredMethod("getDelay", TimeUnit.class); Long delay = (Long)delayM.invoke(obj, new Object[] { tu } ); The trigger and root runnable is in the callable field of this object , instance of ReschedulingRunnable which is not a public class, ask Spring why they did this. You can get the delegate out of DelegatingErrorHandlingRunnable with reflection.
score: 5
answers question: http://stackoverflow.com/q/25017691
downvote count: 0
upvote count: 5
type: Answer

http://stackoverflow.com/comment/38774177
type: AnswerComment
has text: Why do I need the "Scanner" when I am using the tickbox?
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24948163

http://stackoverflow.com/comment/38758002
has text: `onCreateView` method calls `makePageRequest` method which calls `jSONToArrayList` method which populate the list via cloning. `makePageRequest` is a method provided by the facebook sdk to make an http request.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24939766

http://stackoverflow.com/comment/38748138
type: Comment
has text: If it is deadlocked, how is it going to continue to the finally block?
comment on: http://stackoverflow.com/q/24935091
score: 5
type: QuestionComment

http://stackoverflow.com/a/25042940
score: 4
type: AcceptedAnswer
has body: If you need not have to know the bean names, you can use 'autowiring by-type'. Your XML configuration will look like this: &lt;bean id="foo" class="com.example.Foo" autowire="byType" /&gt; &lt;bean id="mySvcClass" class="com.example.MySvcClass" /&gt; Note the 'autowire by type' attribute at Foo class. The class definition will look like below: package com.example; public class Foo { private MySvcClass mySvcClass; }
has comment: http://stackoverflow.com/comment/96963356
accepted answer of: http://stackoverflow.com/q/25039992
answers question: http://stackoverflow.com/q/25039992
type: Answer
upvote count: 4
downvote count: 0

http://stackoverflow.com/a/24960777
accepted answer of: http://stackoverflow.com/q/24960647
downvote count: 0
answers question: http://stackoverflow.com/q/24960647
type: AcceptedAnswer
score: 1
type: Answer
upvote count: 1
has body: Mostly right, though you have an extra click handler. This should work: $(document).ready(function(){ $("#identity").click(function(e){ e.preventDefault(); if ($(this).hasClass("active") ) { $("#fromfrancetoggle").animate({opacity: "1"}, 500 ); $("#lamiettetoggle").animate({opacity: "1"}, 500 ); $(this).removeClass("active"); } else { $("#fromfrancetoggle").animate({opacity: "0"}, 500 ); $("#lamiettetoggle").animate({opacity: "0"}, 500 ); $(this).addClass("active"); } return false; }); $("#identity").trigger("click"); // initial fade }); The trigger() call replaces the initial fade out -- remove that if it's not what you want. As noted by other answers, you can just call toggle directly on the jQuery selector.

http://stackoverflow.com/q/25017930
tagged with: encryption
has body: I am playing around with an idea I have for storing a public key for myself. For this I would need to transform the BigInteger in some sort of a variable and then recreate the BigInteger from that value. I have searched through Stackoverflow to find the best way to do this is with byte[]. This is my code in Eclipse: import java.math.BigInteger; import java.security.KeyPair; import java.security.KeyPairGenerator; import java.security.interfaces.RSAPublicKey; public class Vaja2 { public static void main(String[] args){ try { // Create RSA Keypair (to obtain a BigInteger) KeyPairGenerator kpg = KeyPairGenerator.getInstance("RSA"); kpg.initialize(1024); KeyPair keypair = kpg.generateKeyPair(); // Extract the public key RSAPublicKey publicKey = (RSAPublicKey) keypair.getPublic(); // Get the public Exponent from the public key, I have BigInteger now. BigInteger pkPublicExBI = publicKey.getPublicExponent(); //Try this: BigInteger -&gt; byte-&gt; BigInteger byte[] pkModByte = pkPublicExBI.toByteArray(); BigInteger pkPublicExBIrecreated = new BigInteger(pkModByte); // Show Results System.out.println("Original BigInteger: " + pkPublicExBI); System.out.println("Recreated BigInteger: " + pkPublicExBIrecreated); if (pkPublicExBI == pkPublicExBIrecreated) { System.out.println("\nThey are equal"); } else { System.out.println("\nThey are NOT equal"); } } catch (Exception e) { // Nothing happens } } } And this is the result in shown in the Eclipse console. Original BigInteger: 65537 Recreated BigInteger: 65537 They are NOT equal The if statement tells me, that the two BigIntegers are not equal. Yet in the console, I see them as both being equal to 65537. My questions: Why does the "if" statement fail? How would you recommend me to make the code different. Assuming the program will demand public key to be stored in notepad.exe or similar text-encoding program (ASCII will be used).
has comment: http://stackoverflow.com/comment/38904196
possible better answer: http://stackoverflow.com/a/25018039
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/25017994
tagged with: eclipse
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/38904195
score: 0
tagged with: byte
linked to: http://stackoverflow.com/q/513832
accepted answer: http://stackoverflow.com/a/25017994
has title: BigInteger -> byte[] -> Biginteger. Looks equal but if statement fails
has answer: http://stackoverflow.com/a/25018039
tagged with: biginteger

twitter
tags question: http://stackoverflow.com/q/25064391
type: Tag
tags question: http://stackoverflow.com/q/25040930
tags question: http://stackoverflow.com/q/25044052
tags question: http://stackoverflow.com/q/24997789
tag name: twitter
tags question: http://stackoverflow.com/q/24974990
tags question: http://stackoverflow.com/q/25002827

http://stackoverflow.com/comment/38868799
has text: `File.exists()` and `File.isFile()`
comment on: http://stackoverflow.com/q/24999306
type: Comment
type: QuestionComment
score: 2

init.d
tags question: http://stackoverflow.com/q/24913657
type: Tag
tag name: init.d

http://stackoverflow.com/q/24935533
has comment: http://stackoverflow.com/comment/38749283
has comment: http://stackoverflow.com/comment/38749226
has title: Does the following two code get the same result?
has comment: http://stackoverflow.com/comment/38749161
has body: below are two code snippet, one is sequential, the other is parallel: public&lt;T&gt; void sequentialRecursive(List&lt;Node&lt;T&gt;&gt; nodes, Collection&lt;T&gt; results) { for(Node&lt;T&gt; n: nodes) { results.add(n.compute()); sequentialRecursive(n.getChildren(), results); } } public&lt;T&gt; void parallelRecursive(final Executor exec, List&lt;Node&lt;T&gt;&gt; nodes, final Collection&lt;T&gt; results) { for(final Node&lt;T&gt; n : nodes){ exec.execute(new Runnable(){ public void run() { results.add(n.compute()); } }); parallelRecursive(exec, n.getChildren(), results); } } I want to know if the above two functions generate the same results? Is below results possible? results of SequentialRecursive is: [1,2,3,4,5] and the result of ParallelRecursive is:[1,3,2,5,4].
favorite count: 0
has comment: http://stackoverflow.com/comment/38748941
has comment: http://stackoverflow.com/comment/38748935
upvote count: 0
has comment: http://stackoverflow.com/comment/38749362
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38749126
tagged with: java
tagged with: concurrency
has comment: http://stackoverflow.com/comment/38749596
has answer: http://stackoverflow.com/a/24936913
type: Question
downvote count: 2
has comment: http://stackoverflow.com/comment/38749776
score: -2
has comment: http://stackoverflow.com/comment/38749900
answer count: 1

http://stackoverflow.com/comment/38817656
has text: @vaxquis I want to export the function, say to string or text file. Not as a serialized Object, but in a regular mathematical formula/representation.
score: 0
comment on: http://stackoverflow.com/q/24971616
type: Comment
type: QuestionComment

http://stackoverflow.com/a/30729004
type: Answer
answers question: http://stackoverflow.com/q/24961072
has body: Instead of writing your own plugin you can write a Groovy script that is executed by groovy-maven-plugin: org.codehaus.gmaven groovy-maven-plugin package execute import java.util.jar.* String fileName = '${project.build.directory}/${project.build.finalName}.jar' println "Editing file ${fileName}" JarFile file = new JarFile(fileName); // do your edit
score: 0

http://stackoverflow.com/q/25020119
has title: Can I use existing column as DiscriminatorColumn?
has comment: http://stackoverflow.com/comment/38987500
linked to: http://stackoverflow.com/q/22413795
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38909627
has comment: http://stackoverflow.com/comment/38929926
tagged with: java
type: Question
score: 0
tagged with: eclipselink
tagged with: jpa
has body: I'm looking at example of DiscriminatorColumn at EclipseLink page. There are two entities @Entity @Table(name="PROJECT") @Inheritance(strategy=InheritanceType.SINGLE_TABLE) @DiscriminatorColumn(name="TYPE", discriminatorType=DiscriminatorType.STRING,length=20) @DiscriminatorValue("P") public class Project { @Id protected BigInteger id; protected String description; } @Entity @DiscriminatorValue("L") public class LargeProject extends Project { protected BigInteger budget; } now lets say i have two records in my db | ID | TYPE | DESCRIPTION | BUDGET | |-----------|---------------|---------| | 1 | P | Small Project | | | 2 | L | Large Project | 10000 | Is it possible to drop TYPE table somehow, and use BUDGET table instead? For this case would be Project if BUDGET is null otherwise it will be LargeProject Can JPA or EclipseLink allow to do something like that, and if not, is it any reason for that?

http://stackoverflow.com/comment/38925257
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25028682
type: QuestionComment
has text: Turns out to be a hardware problem, I think. I found this article http://en.wikipedia.org/wiki/Keyboard_%28computing%29#Control_processor which explains some rollover effect with the wiring within a keyboard creating phantom key presses. I don't know if that was the true problem or not, but shifting to asdw instead of arrow keys fixed this problem.

http://stackoverflow.com/a/24938110
has body: You can do (staying withing the limits of Java's syntax): class SubAndImp extends Super implements Interface { } or class ImpAndImp implements InterOne, InterTwo { } All or some of the extended and implemented types can be generic: class SubAndImp&lt;X,Y&gt; extends Super&lt;X&gt; implements Interface&lt;Y&gt; { } or class ImpAndImp&lt;X,Y&gt; implements InterOne&lt;X&gt;, InterTwo&lt;Y&gt; { } Your subclass can also stay out of being generic, by instantiating a generic parameter: class SubAndImp extends Super&lt;Integer&gt; implements Interface&lt;String&gt; { }
answers question: http://stackoverflow.com/q/24937901
type: Answer
score: 1
upvote count: 1
downvote count: 0

http://stackoverflow.com/comment/38743494
type: Comment
type: QuestionComment
has text: Did you try different JRE? If I recall correctly, IcedTea/OpenJDK worked very well for me. Though currently I also use Oracle's 1.8 JRE, though on x64 architecture.
score: 0
comment on: http://stackoverflow.com/q/24932665

http://stackoverflow.com/q/25008008
downvote count: 1
has answer: http://stackoverflow.com/a/25008092
favorite count: 0
answer count: 5
has answer: http://stackoverflow.com/a/25008167
possible better answer: http://stackoverflow.com/a/25008070
has title: How to convert a number to two decimal places if it is double?
has answer: http://stackoverflow.com/a/25008070
has answer: http://stackoverflow.com/a/25008095
accepted answer: http://stackoverflow.com/a/25008062
tagged with: decimalformat
type: AnsweredQuestion
upvote count: 0
has answer: http://stackoverflow.com/a/25008062
has body: I am trying to convert a number to two decimal places using Java. Below is what I have tried and it works fine on couple of inputs - double number = 20.3794; DecimalFormat df = new DecimalFormat("#.00"); String formattedNumber = df.format(number); System.out.println(formattedNumber); //output 20.38 Below are my scenarios - But for this number 20, output I get back as 20.00. In this case, I don't need .00 at the end, it should print out as 20 only. Similarly for this number 0.019 it prints out .02 so for this I need to have 0 infront of . so 0.02 should get printed out. Is this possible to do?
type: Question
tagged with: java
score: -1
tagged with: decimal

http://stackoverflow.com/comment/38789492
comment on: http://stackoverflow.com/q/24957034
type: Comment
has text: Because the input value is not in the AutoCompleteTextView after I pressed the button add and relaunched the application. I can't retrieve the value, as if the save hasn't been done.
score: 0
type: QuestionComment

http://stackoverflow.com/q/25010143
tagged with: multithreading
possible better answer: http://stackoverflow.com/a/25010391
has comment: http://stackoverflow.com/comment/38969893
has comment: http://stackoverflow.com/comment/38962387
has answer: http://stackoverflow.com/a/25010391
downvote count: 1
linked to: http://stackoverflow.com/q/2248131
linked to: http://stackoverflow.com/q/4492273
type: Question
has answer: http://stackoverflow.com/a/28101689
has comment: http://stackoverflow.com/comment/38965701
has title: Java Exeutor framework's exception handling
has comment: http://stackoverflow.com/comment/38972305
answer count: 3
has body: I wrote an android app for killing background running processes which is performed in a background thread. And I use below class to create my own simple thread framework. public final class ThreadPool { private static final ExecutorService sES = Executors.newCachedThreadPool(); public static Future&lt;?&gt; runNow(Runnable task) { return sES.submit(task); } } However, a serious problem occured. That is the exception(unchecked exception) would be consumed by Executor framework quitely. So I don't know why the ActivityManager.killBackgroundProcesses() method does not work. After spending 2 or 3 hours and I wrote some log at almost every method invoke point, I found this method requires android.permission.KILL_BACKGROUND_PROCESSES permission, otherwise, it would throw a SecurityException that is an unchecked exception. The key is this exception is consumed by Excecutor framework, so I cannot see any exception information at logcat and the app does not crash at all and runs weird. Of course, I don't know that at first, so I spent a lot of time to find out that reason, mainly depending on two posts: Handling exceptions from Java ExecutorService tasks and Catching thread exceptions from Java ExecutorService So I changed the my ThreadPool class as: public final class ThreadPool { private static final ExecutorService sES = Executors.newCachedThreadPool(); /* * submit(Runnable) and execute(Runnable) method has * big difference. Especially in Exception handling!!! * You have to pay attention. */ public static Future&lt;?&gt; submitNow(Runnable task) { return sES.submit(task); } public static void executeNow(Runnable task) { sES.execute(task); } } But I still have below question: Why Sun/Oracle decide to consume the exception instead of transfer to users to handle if submit(Runnable command) method is used? How can I change this behavior to handle unchecked exception according to my own need if I insist using submit() method? And my doubts are: If submit(Runnable command) meth…
favorite count: 0
accepted answer: http://stackoverflow.com/a/28101689
tagged with: exception
tagged with: android
has comment: http://stackoverflow.com/comment/38889419
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25010512
upvote count: 2
score: 1
tagged with: java

pessimistic-locking
type: Tag
tag name: pessimistic-locking
tags question: http://stackoverflow.com/q/24989871

http://stackoverflow.com/comment/38725889
has text: I've updated the question. Maybe I should provide the actual onPostExecute() method. However, like I mentioned, the onPostExecute() method doesn't take long to execute.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24922893

http://stackoverflow.com/q/24977775
upvote count: 1
type: Question
downvote count: 0
has title: how to crop using the rect values? in android
has body: hi i am currently working on a project , i have the rectangle values which is top, left, bottom, right now i want to crop that portion,,, i will use this code to crop it by creating new bitmap createBitmap(Bitmap source, int x, int y, int width, int height, Matrix m, boolean filter) but the problem is, i dont know how to get the x and y coordinate of the rectangle ?, also the matrix and boolean filter? , please help me thanks java android
tagged with: android
favorite count: 0
type: UnansweredQuestion
tagged with: rect
has comment: http://stackoverflow.com/comment/38828829
answer count: 0
score: 1
tagged with: java

http://stackoverflow.com/comment/39083447
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25061459
has text: Apologies for the late response, I started my weekend earlier (work function)
score: 0

http://stackoverflow.com/q/25007427
has comment: http://stackoverflow.com/comment/38924141
has answer: http://stackoverflow.com/a/25129834
possible better answer: http://stackoverflow.com/a/25007731
has comment: http://stackoverflow.com/comment/38924209
has answer: http://stackoverflow.com/a/25007731
has body: I have this code - try { doSomething(); } catch (Exception e) { e.printStackTrace(); } How will this actually be implemented by the compiler. Where is the check for the exception actually put in the assembly code generated? Update I know that how the above code is translated to bytecode. The bytecode only translates the try-catch to corresponding try-handler blocks. I am interested in how it will be translated to assembly/and or handled by the jvm.
linked to: http://stackoverflow.com/q/307610
has comment: http://stackoverflow.com/comment/38884669
accepted answer: http://stackoverflow.com/a/25129355
downvote count: 0
has comment: http://stackoverflow.com/comment/38885707
answer count: 4
has comment: http://stackoverflow.com/comment/39114473
favorite count: 0
linked to: http://stackoverflow.com/q/7854808
tagged with: code-generation
has comment: http://stackoverflow.com/comment/38885931
linked to: http://stackoverflow.com/q/4007579
has comment: http://stackoverflow.com/comment/38884283
has comment: http://stackoverflow.com/comment/38884363
linked to: http://stackoverflow.com/q/13168798
upvote count: 23
has comment: http://stackoverflow.com/comment/38884338
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38884372
has comment: http://stackoverflow.com/comment/38884983
tagged with: java
has comment: http://stackoverflow.com/comment/39025489
has comment: http://stackoverflow.com/comment/38884317
score: 23
has comment: http://stackoverflow.com/comment/38884553
has comment: http://stackoverflow.com/comment/38886115
has comment: http://stackoverflow.com/comment/38885903
has comment: http://stackoverflow.com/comment/38884263
type: Question
has title: How are exceptions caught and dealt with at the low (assembly) level?
tagged with: jit
has comment: http://stackoverflow.com/comment/38884350
has answer: http://stackoverflow.com/a/25008611
has answer: http://stackoverflow.com/a/25129355

http://stackoverflow.com/comment/38731062
comment on: http://stackoverflow.com/a/24925443
type: AnswerComment
score: 0
type: Comment
has text: sorry which log? I was using logcat.. I dont have another log

http://stackoverflow.com/comment/38873484
has text: More important, *why* is `ConcurrentHashMap` not sufficient? If you have specific needs but don't tell us what they are, we can't help you.
type: Comment
comment on: http://stackoverflow.com/q/25001331
type: QuestionComment
score: 1

http://stackoverflow.com/comment/38929554
score: 0
type: AnswerComment
has text: Thanks man, this worked well! And thanks for the additional piece of information about passing an integer to the new JREmptyDataSource(), I didn't know you could do that.
comment on: http://stackoverflow.com/a/25012774
type: Comment

http://stackoverflow.com/q/25028511
possible better answer: http://stackoverflow.com/a/25028926
favorite count: 0
tagged with: byte
has answer: http://stackoverflow.com/a/25028931
has answer: http://stackoverflow.com/a/25028918
accepted answer: http://stackoverflow.com/a/25028918
has title: how to do with java byte right or left shift to get 9 or 8 from a byte -104?
has comment: http://stackoverflow.com/comment/38924422
type: AnsweredQuestion
tagged with: java
downvote count: 2
upvote count: 1
has answer: http://stackoverflow.com/a/25028926
has comment: http://stackoverflow.com/comment/38924738
type: Question
has body: In java byte ,-104 is 10011000. How to get the first 1001 as 9 and the last 4 bits 1000 as 8? Thanks.
has comment: http://stackoverflow.com/comment/38924325
score: -1
answer count: 3

http://stackoverflow.com/a/24923965
type: Answer
has body: You need to take the value and wrap in a GradedActivity instance and return it, for example... public GradedActivity getHighest() { double highest = grades[0].getScore(); for(int i = )...... //Code works and returns correct number (tested) GradedActivity ga = new GradedActivity(); ga.setScore(highest); return ga;
answers question: http://stackoverflow.com/q/24923910
score: 0

http://stackoverflow.com/comment/38773213
type: AnswerComment
score: 0
type: Comment
has text: This would go through the whole array, which isn't what OP is asking for.
comment on: http://stackoverflow.com/a/24948120

http://stackoverflow.com/a/28871673
answers question: http://stackoverflow.com/q/25056800
has body: as I learned from here Is there a way to get the class names in a given classes.dex file? you should use: File f = new File(Environment.getExternalStorageDirectory()+"/classes.zip"); File tmp = new File(Environment.getExternalStorageDirectory()+"/classes.odex"); DexFile dexfile = DexFile.loadDex(f.getAbsolutePath(), tmp.getAbsolutePath(), 0); instead of: DexFile dexfile = new DexFile(f);
type: Answer
upvote count: 4
downvote count: 0
has comment: http://stackoverflow.com/comment/107784443
score: 4

http://stackoverflow.com/a/24947912
answers question: http://stackoverflow.com/q/24947689
has body: I'm doing it as I have 100 cases. 30 lead to one answer, 20 to another, 5 to another etc based on that why not compare size of the int instead of using a lot of fall-through cases. No matter what you do 100 cases, will still be a lot of tedious code to write but i can't imagine any one doing 30 fall through cases or 20 fall through case. Since your comparing int not String you can go with if statements like so: if (month &gt; 0 &amp;&amp; month &lt;= 30) { monthString = "January"; } else if (month &gt; 30 &amp;&amp; month &lt;= 50) { monthString = "February"; } else if (month &gt; 50 &amp;&amp; month &lt;= 55) { monthString = "March"; } // 55 cases have been matched compared to: switch (month) { case 1: case 2: case 3: ... case 28: case 29: case 30: monthString = "January"; break; }
downvote count: 0
has comment: http://stackoverflow.com/comment/139928103
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/a/24940422
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/38758884
has body: It's because your spinner is null. I think you forgot to load the layout. Call setContentView(R.layout.----) before findViewById
answers question: http://stackoverflow.com/q/24940313

http://stackoverflow.com/comment/38847754
score: 0
type: Comment
type: QuestionComment
has text: I see. Ok, I was able to get ride of all those errors. Thanks!
comment on: http://stackoverflow.com/q/24987061

http://stackoverflow.com/comment/38891573
score: 0
type: Comment
type: QuestionComment
has text: but what if I want to get the class which used @myCustomAnnotation as annotation...?
comment on: http://stackoverflow.com/q/25010502

http://stackoverflow.com/comment/38820924
comment on: http://stackoverflow.com/a/24973573
has text: declare a boolean variable and assign it to true. this should resolve your problem. That way the compiler won't evaluate the if statement at compile time, instead it will do so on run time
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/24969994
answers question: http://stackoverflow.com/q/24969942
has body: You should write targetNumber = (int) (Math.random()*10) This is because what you are doing converts Math.random() generated number to int as zero and then mulyiplied by 10
type: Answer
score: 0

http://stackoverflow.com/q/25026780
has answer: http://stackoverflow.com/a/25026872
score: 0
has comment: http://stackoverflow.com/comment/38921228
has comment: http://stackoverflow.com/comment/38921365
type: Question
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/25026872
tagged with: switch-statement
answer count: 2
has comment: http://stackoverflow.com/comment/38921189
has comment: http://stackoverflow.com/comment/38921204
possible better answer: http://stackoverflow.com/a/25026942
has answer: http://stackoverflow.com/a/25026942
has title: A large switch statement or several small switch statements?
has body: I am wondering if there any performance different between a large switch statement and several small switch statements. Large switch statement with hundreds of cases. switch(quest){ case 1: quest1(); break; case 2: quest2(); break; . . . case 196: quest196(); break; case 197: quest197(); break; . . . } or several smaller switch statement with 30 cases each. if (quest &lt;= 30) { switch (quest) { case 1: quest1(); break; case 2: quest2(); break; case 3: quest3(); break; . . case 30: quest30(); break; default: return; } } else if (quest &lt;= 60) { switch (quest) { case 31: quest31(); break; case 32: quest32(); break; case 33: quest33(); break; . . . case 60: quest60(); break; default: return; } } . . . Also, I know reflection will be a lot easier to code, but will that cause a large overhead? something like this. try { Method method =Logic.class.getMethod("quest"+quest); method.invoke(this); } catch (NoSuchMethodException | SecurityException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IllegalAccessException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IllegalArgumentException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (InvocationTargetException e) { // TODO Auto-generated catch block e.printStackTrace(); } Thanks in advance.

http://stackoverflow.com/a/24969070
score: 0
answers question: http://stackoverflow.com/q/24968908
type: Answer
has comment: http://stackoverflow.com/comment/38813908
has comment: http://stackoverflow.com/comment/38814597
has comment: http://stackoverflow.com/comment/38812403
has body: This is the first step: an XML schema describing your XML file, call it db.xsd &lt;xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" version="2.0"&gt; &lt;xs:element name="Database" type="Database"/&gt; &lt;xs:complexType name="Database"&gt; &lt;xs:sequence&gt; &lt;xs:element name="Table" type="Table" maxOccurs="unbounded"/&gt; &lt;/xs:sequence&gt; &lt;xs:attribute name="NumTables" type="xs:int"/&gt; &lt;/xs:complexType&gt; &lt;xs:complexType name="Table"&gt; &lt;xs:sequence&gt; &lt;xs:element name="Column" type="Column" maxOccurs="unbounded"/&gt; &lt;/xs:sequence&gt; &lt;xs:attribute name="TableName" type="xs:string"/&gt; &lt;xs:attribute name="TableID" type="xs:int"/&gt; &lt;xs:attribute name="NumOriginalColumns" type="xs:int"/&gt; &lt;xs:attribute name="NumColumns" type="xs:int"/&gt; &lt;xs:attribute name="NumRows" type="xs:int"/&gt; &lt;/xs:complexType&gt; &lt;xs:complexType name="Column"&gt; &lt;xs:sequence&gt; &lt;xs:element name="Cell" type="xs:string" maxOccurs="unbounded"/&gt; &lt;/xs:sequence&gt; &lt;xs:attribute name="ColumnName" type="xs:string"/&gt; &lt;xs:attribute name="ColumnID" type="xs:int"/&gt; &lt;xs:attribute name="ColumnType" type="xs:string"/&gt; &lt;/xs:complexType&gt; &lt;/xs:schema&gt; If you run $ xjc db.xsd Several Java classes are generated in subdir generated (this name can, of course, be improved). Now, we need a simple procedure to unmarshal your XML file: public class Main { private static final String PACKAGE = "generated"; private static final String SCHEMA = "table.xsd"; private static final String XMLIN = "database.xml"; private Database db; void unmarshal() throws Exception { JAXBContext jc = JAXBContext.newInstance( PACKAGE ); Unmarshaller m = jc.createUnmarshaller(); JAXBElement&lt;Database&gt; jbe = null; try { StreamSource source = new StreamSource( new FileInputStream( XMLIN ) ); jbe = m.unmarshal( source, Database.class ); db = jbe.getValue(); } catch( Exception e ){ System.…
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38812461
accepted answer of: http://stackoverflow.com/q/24968908

http://stackoverflow.com/comment/38892808
comment on: http://stackoverflow.com/a/25011660
type: AnswerComment
type: Comment
has text: Any decent parser will parse it in O(n^3) time if it only has to return one parse tree. Returning all possible parse trees can take much, much longer.
score: 1

http://stackoverflow.com/q/24985415
upvote count: 0
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/38843889
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24985452
score: -3
has comment: http://stackoverflow.com/comment/38843282
has comment: http://stackoverflow.com/comment/38845318
tagged with: java
tagged with: static-variables
downvote count: 3
has body: ok this code was working earlier, but all of a sudden, java tells me that i can't reference the two stop objects (origin and destination) i'm trying to create in the loop from a static context, but i'm not referencing them, i'm creating a new temporary object every iteration, what am i missing here? this method is inside my public class. the error just says: nonstatic variable cannot be referenced from a static context, where it says //problem areas static void initializePassengers() throws FileNotFoundException, IOException, NullPointerException { FileReader fr = new FileReader(pathto+"passengers.csv"); BufferedReader textReader = new BufferedReader(fr); try { while(!textReader.readLine().isEmpty()) { String temp=textReader.readLine(); StringTokenizer te = new StringTokenizer(temp,",",false); String name=te.nextToken(); Stop origin = new Stop(te.nextToken()); //problem area Stop destination = new Stop(te.nextToken()); //problem area allpassengers.add(new Passenger(name, origin, destination)); } } catch(NullPointerException e){ System.out.println(e.getMessage()); } textReader.close(); }
type: Question
has comment: http://stackoverflow.com/comment/38845006
has comment: http://stackoverflow.com/comment/38842792
has title: static variables, creating new variables from classes in a static method inside my public class
tagged with: static-methods

http://stackoverflow.com/a/24909646
has comment: http://stackoverflow.com/comment/38699867
type: Answer
has comment: http://stackoverflow.com/comment/38699979
has body: Try putting current directory in class path: java -classpath .:mysql-connector-java-5.1.18-bin.jar JDBCExample
answers question: http://stackoverflow.com/q/24909476
score: 0
accepted answer of: http://stackoverflow.com/q/24909476
has comment: http://stackoverflow.com/comment/38700078
type: AcceptedAnswer

httpclient
tags question: http://stackoverflow.com/q/25025892
tags question: http://stackoverflow.com/q/24939312
type: Tag
tags question: http://stackoverflow.com/q/24985771
tags question: http://stackoverflow.com/q/25065575
tags question: http://stackoverflow.com/q/25040890
tag name: httpclient
tags question: http://stackoverflow.com/q/24954862

http://stackoverflow.com/comment/38759941
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24941074
has text: Which version of Java are you using?
score: 0

http://stackoverflow.com/q/24928447
has answer: http://stackoverflow.com/a/24928719
tagged with: date
type: Question
tagged with: jodatime
score: 0
possible better answer: http://stackoverflow.com/a/24928534
answer count: 3
has answer: http://stackoverflow.com/a/24928841
accepted answer: http://stackoverflow.com/a/24928841
has body: I downloaded joda library and extract joda time to calculate time difference, Here is my class that calculate date difference: (I'm using Java 1.7) public class TimeDiffereneceTest { static String secondDate,firstDate, dateDifference; public static void main(String[] args) { firstDate = "2014/07/20"; secondDate = getTodayDate(); // Generate 2014/07/23 DateDifference(firstDate, secondDate); } public static String getTodayDate() { Calendar todayDate = Calendar.getInstance(); SimpleDateFormat simpleFormat = new SimpleDateFormat("YYYY/MM/dd"); String strDate = simpleFormat.format(todayDate.getTime()); return strDate; } public static void DateDifference(String firstDate,String nowDate) { Date d1=null; Date d2=null; SimpleDateFormat format = new SimpleDateFormat("YYYY/MM/dd"); try{ d1 = format.parse(firstDate); d1 = format.parse(nowDate); DateTime dt1 = new DateTime(d1); DateTime dt2 = new DateTime(d2); System.out.println("Day difference is: "+Days.daysBetween(dt1, dt2).getDays()); // 206! } catch(Exception e){ e.printStackTrace(); } } } The result should be 3 because today date is 2014/07/23 and first date was "2014/07/20" , But has wrong result (206).
type: AnsweredQuestion
has title: Date difference with joda time
has answer: http://stackoverflow.com/a/24928534
tagged with: java

http://stackoverflow.com/q/24937441
has answer: http://stackoverflow.com/a/63468023
favorite count: 0
score: 51
type: UnansweredQuestion
tagged with: spring
has answer: http://stackoverflow.com/a/34354605
has title: Comparing the enum constants in thymeleaf
upvote count: 51
downvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/32719598
has comment: http://stackoverflow.com/comment/38752653
has answer: http://stackoverflow.com/a/66656681
has answer: http://stackoverflow.com/a/29604518
has answer: http://stackoverflow.com/a/42560361
type: Question
tagged with: thymeleaf
has answer: http://stackoverflow.com/a/26857874
has body: I have an enum, Constants: enum Constants { ONE,TWO,THREE; } How can I compare the enum Constants in Thymeleaf. Thanks.
has answer: http://stackoverflow.com/a/45862428
has answer: http://stackoverflow.com/a/49298039
has answer: http://stackoverflow.com/a/28559029
answer count: 10

http://stackoverflow.com/comment/38742159
type: Comment
has text: @MadProgrammer Yes, it's `JTextPane`
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/24931965

http://stackoverflow.com/q/24995207
has body: I have a class A with field "mapEntries" - it is a list, class B with "entries" - it is a wrapper class around list. I need to map class A to class B. While mapping I need to exclude the "entries" field. How can I do this? I have tried both one way and both way exclude but it's not working. The full(both side) exclude seems to work only when the fields have same name in both the src and dest classes. One Way exclude: mapEntries entries Both way exclude: mapEntries entries I have lot of other fields as well in these classes hence using wildcard is not an option. ClientClass ProductClass mapEntries entries With this mapping, fields don't get excluded. The product class has getter/setter as setMapEntries() and getMapEntries(). This seems to be the cause. The control does reach in getMapEntries(). I cannot change product code. If I rename Client field as entries, keeping both client and product field same, it works properly and the mapping gets excluded. Any help would be appreciated.
has comment: http://stackoverflow.com/comment/38861065
tagged with: dozer
tagged with: mapping
answer count: 0
has comment: http://stackoverflow.com/comment/38929076
type: UnansweredQuestion
has title: Exclude different named field in class mapping using Dozer
has comment: http://stackoverflow.com/comment/38924882
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/38861116
has comment: http://stackoverflow.com/comment/38975337
has comment: http://stackoverflow.com/comment/38861350
has comment: http://stackoverflow.com/comment/38966915
has comment: http://stackoverflow.com/comment/38973083
score: 0

http://stackoverflow.com/comment/38961949
comment on: http://stackoverflow.com/q/25048479
score: 0
has text: What Java version are you testing on? How did you time this, and what times did you get?
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24913525
type: AnsweredQuestion
upvote count: 0
score: -5
tagged with: arrays
accepted answer: http://stackoverflow.com/a/24913808
has comment: http://stackoverflow.com/comment/38707725
favorite count: 0
type: Question
has body: I am writing an inventory program for a book store that is comprised of two classes and multiple methods within these classes. The method I'm having the most trouble with is my purchase() method which is supposed to interactively process a purchase, update the array after the purchase, and display totals for items sold and total amount of money made that day. The method is supposed to follow these 10 steps: Ask the user to enter the ISBN number of the book they'd like to purchase. Search the array for the object that contains that ISBN. If the ISBN isn't found in the array, display a message stating that we don't have that book. If the ISBN is found but the number of copies is 0, display a message saying the book is out of stock. If the ISBN is found and the number of copies is greater than 0, ask the user how many copies they'd like to purchase. If the number they enter is greater than the number of copies of that book in the array, display a message stating that and ask them to enter another quantity. When they enter a 0 for the ISBN, the Scanner is supposed to close Once the purchase is complete I need to update the array by subtracting the number of copies of that particular book that was purchased. Print the updated array. Display a count of how many books were purchased, and how much money was made from the purchase. But as my code is written, after the Program prompts me to enter an ISBN, nothing happens, it just continually lets me enter numbers with no additional output. Here is the code I have for this method. I'm pretty sure it's probably an issue with my loop as I'm not very good with looping. Can anyone spot what I'm doing wrong? public static Book[] purchase(Book[] books) { int itemsSold = 0; double totalMade = 0; double price; int copies; String isbn; Scanner input = new Scanner(System.in); int desiredCopies = 0; int index; double total = 0; System.out.println("Please enter the ISBN number of the book you would like to purchase: "); String desiredIsbn…
tagged with: java
tagged with: loops
answer count: 1
has title: Program not displaying everything it's supposed to
has answer: http://stackoverflow.com/a/24913808
has comment: http://stackoverflow.com/comment/38708251
downvote count: 5

http://stackoverflow.com/a/25030228
answers question: http://stackoverflow.com/q/25028384
has comment: http://stackoverflow.com/comment/38950060
type: Answer
score: 1
upvote count: 1
has body: The WSDL will describe which service(s) exist at a given endpoint. A service is basically a method call. The input &amp; output of the service are described by the XSD files (xml schema) which allow for both a universal data representation and validation of said data. The JDK ships with a tool called wsimport, it will generate all the necessary classes based on a WSDL. I would suggest adding -keep as an option when you run it, otherwise you will only have the compiled version of the classes. Using these classes it is trivial to construct a request and call the endpoint. UPDATE Also in the WSDL is the description of the endpoint: so the actual http location that the service should be called at. This is also parsed by wsimport and unless you override it, it will be used to call the service. Note that wsimport generates classes on your local machine that you should treat as any other java dependency. The classes contain all the necessary logic to construct an input, perform the request and parse the output. It should be almost entirely transparent to you that it is actually a webservice call instead of a local method.
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25028384
type: AcceptedAnswer

http://stackoverflow.com/comment/38750391
score: 0
type: QuestionComment
type: Comment
has text: Mockito and Spring do this type of thing when creating mocks or proxies. Look at how they do it.
comment on: http://stackoverflow.com/q/24936150

http://stackoverflow.com/comment/38912279
has text: @dubdubdubdot It's difficult to imagine a situation where they would be functionally equivalent except having just these 2 classes and a single thread. As soon as you introduce someone who locks on the `classTwo` object, not even touching the variables, they are different.
type: AnswerComment
comment on: http://stackoverflow.com/a/25021871
score: 0
type: Comment

http://stackoverflow.com/comment/38876806
has text: @zgc7009 I am not a specialist in java, and I am not sure I fully comprehend your example...but as far as I know if you are dealing with enums, only the declared enums could be used, but if you are dealing with constant ints, every single number that an int can hold can be used as a reference, even numbers that represent stuff that the code doest declare or represent, which might trigger problems.....for example, you could mess up and declare the same number for 2 references....or someone could pass a number and try to trigger a bug in your code
comment on: http://stackoverflow.com/q/25003208
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/38953597
comment on: http://stackoverflow.com/q/25028314
has text: possible duplicate of [Eclipse Kepler for OS X Mavericks request Java SE 6](http://stackoverflow.com/questions/19563766/eclipse-kepler-for-os-x-mavericks-request-java-se-6)
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/a/24929081
downvote count: 0
answers question: http://stackoverflow.com/q/24928804
accepted answer of: http://stackoverflow.com/q/24928804
has comment: http://stackoverflow.com/comment/38738417
type: Answer
score: 2
upvote count: 2
has body: You can send data between portlets through IPC (Inter Portlet Communication): In CatalogListingPortlet: @ActionMapping(params = "action=showCategory") public void showCategory(ActionRequest request, ActionResponse response) { QName qname = new QName("http://liferay.com/events","ipc.messsage","x"); response.setEvent(qname, "some message"); } In ProductListingPortlet: @EventMapping(value ="{http://liferay.com/events}ipc.messsage") public void receiveEvent(EventRequest request, EventResponse response) { Event event = request.getEvent(); String messsage = (String)event.getValue(); //process the message } Configuration in portlet.xml: catalogListingPortlet ... <supported-publishing-event> x:ipc.messsage </supported-publishing-event> productListingPortlet ... <supported-processing-event> x:ipc.messsage </supported-processing-event> x:ipc.messsage java.lang.String
type: AcceptedAnswer

http://stackoverflow.com/comment/38739241
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24930337
has text: thanks for your reply but I need to compare approximately 20 values in `if` condition...... is there any simple way

http://stackoverflow.com/comment/38882244
comment on: http://stackoverflow.com/q/25006077
score: 0
type: Comment
type: QuestionComment
has text: project structure pls

http://stackoverflow.com/a/24934605
has comment: http://stackoverflow.com/comment/38755811
has body: I would strongly recommend using a set up where Console is used when possible, falling back to a Scanner or Reader when it is not. However, there is a very ugly solution to the specific wording of this question, which I found here. The solution is basically to repeatedly send the backspace (\b) character to the console to hide whatever gets written. It's may be possible for you to formulate a more resource friendly version with some kind of listener, but I'm not sure about that. Some example code that should do exactly this: public class PwdConsole { public static void main(String[] args) throws Exception { ConsoleEraser consoleEraser = new ConsoleEraser(); System.out.print("Password? "); BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in)); consoleEraser.start(); String pass = stdin.readLine(); consoleEraser.halt(); System.out.print("\b"); System.out.println("Password: '" + pass + "'"); } class ConsoleEraser extends Thread { private boolean running = true; public void run() { while (running) { System.out.print("\b "); } public synchronized void halt() { running = false; } } }
type: AcceptedAnswer
downvote count: 0
score: 1
type: Answer
accepted answer of: http://stackoverflow.com/q/24934209
answers question: http://stackoverflow.com/q/24934209
upvote count: 1

http://stackoverflow.com/comment/38976457
type: QuestionComment
has text: Well I hope you aren't DOSing them? Do you have rate limiting in place?
score: 0
comment on: http://stackoverflow.com/q/25056374
type: Comment

http://stackoverflow.com/comment/38894044
has text: So I didn't get what are you suggesting?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25012055
score: 0

http://stackoverflow.com/comment/38764862
type: Comment
comment on: http://stackoverflow.com/q/24943302
has text: The above anwer in the duplicate is less suitable than Peters answer below.
score: 0
type: QuestionComment

http://stackoverflow.com/comment/38802160
score: 0
type: QuestionComment
has text: I thought of that, but there is a resource I'm using at the time that `retrieveLineItemResultsFromPCS()` will wait on, guaranteeing a deadlock.
type: Comment
comment on: http://stackoverflow.com/q/24961677

http://stackoverflow.com/q/24937842
has body: I am testing my application that uses Elasticsearch using a test node. It's initialized like this: protected class ElasticsearchTestNode { val cluster = s"${System.nanoTime}" val dir = TempDir.create(Some(cluster)) val settings = settingsBuilder.put("path.data", dir.path) val node = nodeBuilder.clusterName(s"$cluster").settings(settings).local(true).data(true).node() val client = node.client() One use case in the application needs to call a native script written in java similar to this blog post: http://www.spacevatican.org/2012/5/12/elasticsearch-native-scripts-for-dummies/. I'm not sure how I can register the script with my test node. Is it possible?
has comment: http://stackoverflow.com/comment/38756733
has title: Elasticsearch - Testing a Native Script
tagged with: elasticsearch
favorite count: 0
answer count: 0
type: UnansweredQuestion
score: 3
has comment: http://stackoverflow.com/comment/38756902
upvote count: 3
tagged with: java
type: Question
downvote count: 0

http://stackoverflow.com/q/25016591
has answer: http://stackoverflow.com/a/25017097
accepted answer: http://stackoverflow.com/a/25017097
tagged with: java
type: Question
answer count: 2
tagged with: jar
score: 0
possible better answer: http://stackoverflow.com/a/25017120
has title: How do I create a JAR where the package is in the root folder? (and not inside a bin folder)
tagged with: unix
tagged with: command
has answer: http://stackoverflow.com/a/25017120
has body: I am trying to create a jar from the command line using the following: jar cfm EWSTerabot.jar ./MyManifest.txt ./bin/ews/ However, when I execute the JAR, I get the following error "Could not find or load main class ews.main.gateway.Main" The reason I receive this error is that when I extract the JAR and look inside, the main class is at bin/ews/main/gateway/Main.class. How do I create the JAR so that the ews folder is at the root and the Main class is located at ews/main/gateway/Main.class. I essentially want to create the JAR without this bin folder.
type: AnsweredQuestion

http://stackoverflow.com/q/24938994
tagged with: geometry
has title: Dragging rotated text inside android canvas does not work as expected
has answer: http://stackoverflow.com/a/25026716
tagged with: android
type: AnsweredQuestion
score: 7
tagged with: java
upvote count: 7
type: Question
accepted answer: http://stackoverflow.com/a/25026716
has answer: http://stackoverflow.com/a/24974060
tagged with: android-canvas
possible better answer: http://stackoverflow.com/a/24974060
answer count: 2
tagged with: trigonometry
has body: There is something I am missing inhere so I hope you can share some light on me. I am drawing some text inside canvas. For this I have a class Word public class Word { private int x; private int y; private String text; } The app allows the user to rotate the text, and I handle the rotation withing onDraw protected void onDraw(Canvas canvas) { canvas.save(Canvas.MATRIX_SAVE_FLAG); canvas.rotate(angle, centerX, centerY) ... canvas.drawText(word.getText(), word.getX(), word.getY()) .... canvas.restore(); } The problem I get is when the user drags the canvas and there is a rotation set. When angle=0 the movement is going as expected. @Override public boolean onTouchEvent(MotionEvent event) { case MotionEvent.ACTION_DOWN: initialX = (int) event.getX(); initialY = (int) event.getY(); break; case MotionEvent.ACTION_MOVE: int currentX = (int) event.getX(); int currentY = (int) event.getY(); int xMovement = currentX - initialX; int yMovement = currentY - initialY; dragWords(xMovement, yMovement); ..... and on dragWords for each word I do: private void dragText(int xMovement, int yMovement){ for (Word word : words) { word.setX(word.getX() + xMovement); word.setY(word.getY() + yMovement); } invalidate(); } When rotation angle is 0, moving up/down/left/right makes the words move by the same distance. As angle gets bigger, the words start to move in different dirrections, for instance at 60, it is starting to go diagonally up, when 180 it only moves up/down and not left/right. I think I need to calculate some sort of a difference based on angle and add it to xMovement/yMovement... but how should I do this ? LE: Here is an image on how it behaves: The blue lines is how the text is moving on drag while the orange is the finger dragging on the screen. When angle is 0 it works quite well, when angle increases, it starts to move diagonally on left/right, while when angle is even bigger, it only moves up and down and does not respond to left/right
downvote count: 0
favorite count: 0

http://stackoverflow.com/q/24991284
type: Question
has answer: http://stackoverflow.com/a/24991557
has comment: http://stackoverflow.com/comment/38854291
has body: Consider you got a class with a constructor like the follwing public class Clazz { protected BigDecimal bigDecimal; public Clazz(BigDecimal bigDecimal) { this.bigDecimal= bigDecimal; } public BigDecimal getBigDecimal() { return bigDecimal; } } Clazz takes only BigDecimals which are at least zero, that is new Clazz(BigDecimalUtils.minZero(someBigDecimal)); Who is responsible to ensure that the class only gets instantiated with BigDecimals greater than zero? Is it the class itself (e.g. in the constructor)?
answer count: 1
downvote count: 0
tagged with: default-value
has title: Should an object know which 'arguments' it takes
score: 1
accepted answer: http://stackoverflow.com/a/24991557
has comment: http://stackoverflow.com/comment/38854218
favorite count: 0
tagged with: constructor
upvote count: 1
type: AnsweredQuestion
tagged with: java
tagged with: bigdecimal

http://stackoverflow.com/comment/38975034
has text: agreed, but he already has users as a variable, I'm not even sure why he wants to put it into a map and get it out of it like that. Or store it as an object. I'm confused about the purpose, really, but this should work.
comment on: http://stackoverflow.com/a/25055599
type: AnswerComment
score: 0
type: Comment

intellij-13
tag name: intellij-13
tags question: http://stackoverflow.com/q/25045621
type: Tag

http://stackoverflow.com/a/24977517
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/38827996
has body: As the comments before me have recommended, there are some OO principles you should understand beforehand. I'll try to outline some of them that could put you on the right track though. Interfaces: interface Character { // define methods that must be defined across all character types public void getLevel(); public void getAgility(); ... } Implementing this interface: public class Bob implements Character { private String primaryAtribute; private double strength; private double agility; private double inteligence; private double armor; private double damageMultiplyer; private int health; private int mana; private int range; private int movement; private int level; private int damageMin; private int damageMax; // default constructor public Bob() {} // override as many times as you'd like public Bob(int level) { this.level = level; } // getters and setters - required to implement ALL from interface public void getLevel() { return this.level; } public void getAgility() { return this.agility; } public void setAgility(double agility) { this.agility = agility; } } From hereon we can use Bob where-ever we like, as a new instance: new Bob(...);. Most member variables are always private, for encapsulation. This all depends on your use-case and how you'd like to structure the program though. For instance you could have change health to public int health, and you'd be able to access this without a getHealth() function, you'd be able to directly call [instance of Bob].health. The topics I covered, briefly, were class variables, interfaces, scope, overloading, probably something else. You'd need to pick up a book, or even read through the Java docs. They have some good examples and are quite verbose.
has comment: http://stackoverflow.com/comment/38828434
has comment: http://stackoverflow.com/comment/38828836
has comment: http://stackoverflow.com/comment/38828344
has comment: http://stackoverflow.com/comment/38841241
has comment: http://stackoverflow.com/comment/38835884
has comment: http://stackoverflow.com/comment/38828332
answers question: http://stackoverflow.com/q/24977328
has comment: http://stackoverflow.com/comment/38827959
downvote count: 0
has comment: http://stackoverflow.com/comment/38827999
has comment: http://stackoverflow.com/comment/38828141
upvote count: 2

http://stackoverflow.com/a/42260008
downvote count: 0
score: 4
type: Answer
has body: I had the same 415 http error time ago. I simply forgot the default no-parameters constructor in my DTO classes. Adding that constructor, in a similar way as for JPA entities, solved my issue and de-serialization JSON-&gt;Object works now. I'm not sure this is your case, looking at your code, but it could be useful to other guys falling here looking at the 415+JSON issue. Regards
answers question: http://stackoverflow.com/q/24932080
has comment: http://stackoverflow.com/comment/85032099
upvote count: 4

http://stackoverflow.com/q/24985479
linked to: http://stackoverflow.com/q/4284700
type: UnansweredQuestion
has title: JSP compiled but now has several errors?
has comment: http://stackoverflow.com/comment/38843008
linked to: http://stackoverflow.com/q/3542051
has answer: http://stackoverflow.com/a/24985680
tagged with: java
type: Question
tagged with: jakarta-ee
answer count: 1
tagged with: jsp
score: 0
has body: I have a JSP and Servlet project on github at - https://github.com/double-whammy/affablebean.git . This code at least compiled properly on my old computer. When I imported it into my new computer, it shows me a lot of strange compile errors. I will show you some of the code and the errors. Please help me to correct this. <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> <%@taglib prefix="sql" uri="http://java.sun.com/jsp/jstl/sql"%> <%@ page language="java" pageEncoding="ISO-8859-1"%> The Affable Bean <sql:query var="categories" dataSource="jdbc/affablebean"> SELECT * FROM category </sql:query> <sql:query var="selectedCategory" dataSource="jdbc/affablebean"> SELECT name FROM category WHERE id = ? <sql:param value="${pageContext.request.queryString}" /> </sql:query> <sql:query var="categoryProducts" dataSource="jdbc/affablebean"> SELECT * FROM product WHERE category_id = ? <sql:param value="${pageContext.request.queryString}" /> </sql:query> <c:forEach var="category" items="${categories.rows}"> <c:choose> <c:when test="${category.id == pageContext.request.queryString}"> ${category.name} </c:when> <c:otherwise> ${category.name} </c:otherwise> </c:choose> </c:forEach> The errors are: Line <sql:param value="${pageContext.request.queryString}" /> : Multiple annotations found at this line: - java.io.IOException cannot be resolved to a type - No exception of type ServletException can be thrown; an exception type must be a subclass of Throwable - The method getQueryString() from the type HttpServletRequest refers to the missing type String - String cannot be resolved to a type Line <sql:query var="categoryProducts" dataSource="jdbc/affablebean"> No exception of type JspException can be thrown; an exception type must be a subclass of Throwable Line <c:forEach var="category" items="${categories.rows}"> Multiple annotations found at this line: - java.util.Map cannot be resolved to a type

file
tags question: http://stackoverflow.com/q/25039156
type: Tag
tags question: http://stackoverflow.com/q/24969217
tags question: http://stackoverflow.com/q/25040564
tags question: http://stackoverflow.com/q/24916255
tags question: http://stackoverflow.com/q/24957691
tags question: http://stackoverflow.com/q/25061456
tags question: http://stackoverflow.com/q/25022924
tag name: file
tags question: http://stackoverflow.com/q/25048691
tags question: http://stackoverflow.com/q/24948194
tags question: http://stackoverflow.com/q/25059725
tags question: http://stackoverflow.com/q/24977062
tags question: http://stackoverflow.com/q/25026601
tags question: http://stackoverflow.com/q/25048674
tags question: http://stackoverflow.com/q/25022006
tags question: http://stackoverflow.com/q/25064273
tags question: http://stackoverflow.com/q/25053496
tags question: http://stackoverflow.com/q/24948132
tags question: http://stackoverflow.com/q/25032361
tags question: http://stackoverflow.com/q/25027249
tags question: http://stackoverflow.com/q/24915938
tags question: http://stackoverflow.com/q/24990778
tags question: http://stackoverflow.com/q/25042514
tags question: http://stackoverflow.com/q/25012082
tags question: http://stackoverflow.com/q/24913541
tags question: http://stackoverflow.com/q/24976250
tags question: http://stackoverflow.com/q/25047289
tags question: http://stackoverflow.com/q/24995617
tags question: http://stackoverflow.com/q/24999306
tags question: http://stackoverflow.com/q/25035211
tags question: http://stackoverflow.com/q/24980307
tags question: http://stackoverflow.com/q/24936309
tags question: http://stackoverflow.com/q/24986775
tags question: http://stackoverflow.com/q/25024039
tags question: http://stackoverflow.com/q/25054644
tags question: http://stackoverflow.com/q/25012865
tags question: http://stackoverflow.com/q/25058715
tags question: http://stackoverflow.com/q/24949505

http://stackoverflow.com/q/24926927
has title: Hadoop 2.4.0 + HCatalog + Mapreduce
has answer: http://stackoverflow.com/a/33722179
type: UnansweredQuestion
type: Question
tagged with: java
tagged with: hcatalog
tagged with: mapreduce
tagged with: hadoop
has body: in Hadoop 2.4.0, I get the following error while executing below code sample. I think, there is mismatch hadoop version. Are you review the code? and How can I fix this codes? I am trying to write map-reduce job that copying Hcatalog table. thank you. Exception in thread "main" java.lang.IncompatibleClassChangeError: Found interface org.apache.hadoop.mapreduce.JobContext, but class was expected at org.apache.hcatalog.mapreduce.HCatBaseOutputFormat.getJobInfo(HCatBaseOutputFormat.java:94) at org.apache.hcatalog.mapreduce.HCatBaseOutputFormat.getOutputFormat(HCatBaseOutputFormat.java:82) at org.apache.hcatalog.mapreduce.HCatBaseOutputFormat.checkOutputSpecs(HCatBaseOutputFormat.java:72) at org.apache.hadoop.mapreduce.JobSubmitter.checkSpecs(JobSubmitter.java:458) at org.apache.hadoop.mapreduce.JobSubmitter.submitJobInternal(JobSubmitter.java:343) at org.apache.hadoop.mapreduce.Job$10.run(Job.java:1285) at org.apache.hadoop.mapreduce.Job$10.run(Job.java:1282) 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:1548) at org.apache.hadoop.mapreduce.Job.submit(Job.java:1282) at org.apache.hadoop.mapreduce.Job.waitForCompletion(Job.java:1303) at org.deneme.hadoop.UseHCat.run(UseHCat.java:102) at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:70) at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:84) at org.deneme.hadoop.UseHCat.main(UseHCat.java:107) Code Sample public class UseHCat extends Configured implements Tool{ public static class Map extends Mapper&lt;WritableComparable, HCatRecord,Text,IntWritable&gt; { String groupname; @Override protected void map( WritableComparable key, HCatRecord value, org.apache.hadoop.mapreduce.Mapper&lt;WritableComparable, HCatRecord, Text, IntWritable&gt;.Context context) throws IOException, InterruptedException { // The group table from /etc/group has name, 'x', id groupname = (St…
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/38735364
has comment: http://stackoverflow.com/comment/38735566

http://stackoverflow.com/q/25052628
possible better answer: http://stackoverflow.com/a/25052668
accepted answer: http://stackoverflow.com/a/25055244
has title: Custom Regex Replacement in Java
answer count: 3
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/38969547
tagged with: regex
type: AnsweredQuestion
has body: I want to find all patterns in a string that match the regex: no="(\d+)" then replace the digits in the group with something else. In the method below I can find and replace the entire match, but that is not what I want. Is there a way to replace just a portion in that match? private String replaceStringFromPatternSearch(String stringToSearch, String patternString, String replacementString) { String replacedString = null; Pattern stringPattern = Pattern.compile(patternString); Matcher stringMatcher = stringPattern.matcher(stringToSearch); replacedString = stringMatcher.replaceAll(replacementString); if (replacedString != null) { return replacedString; } else { return stringToSearch; } }
tagged with: java
has comment: http://stackoverflow.com/comment/38969539
type: Question
linked to: http://stackoverflow.com/q/25047301
score: 5
has answer: http://stackoverflow.com/a/25052668
has answer: http://stackoverflow.com/a/25055244
upvote count: 5
has comment: http://stackoverflow.com/comment/38969535
has comment: http://stackoverflow.com/comment/38976145
has answer: http://stackoverflow.com/a/25053142

http://stackoverflow.com/comment/38729902
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24925295
has text: ageCalculator() is not a static method. Either use new CodeClass().ageCalculateor(...) or make ageCalculator() a static method (i.e. public static int ageCalculator(<args>).
score: 0

http://stackoverflow.com/comment/38862502
comment on: http://stackoverflow.com/a/24995964
has text: In general you can't update UI components from threads other than the main one. Modifications to the UI are serialized by posting messages to the message loop which kick off events that modify the UI on the main thread.
type: AnswerComment
type: Comment
score: 2

http://stackoverflow.com/a/55994174
downvote count: 0
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/109242744
score: 2
has body: It did not work for me on my Samsung S8, Android 9, instead I used: to set: $adb shell settings put global low_power 1 to get: $adb shell settings get global low_power ...and it worked! Translating it into java it goes something like this: final String result = Settings.Global.getString(getContentResolver(),"low_power");
answers question: http://stackoverflow.com/q/25065635

http://stackoverflow.com/comment/38921667
comment on: http://stackoverflow.com/q/25025956
type: QuestionComment
has text: Why? Doe you somehow believe that this will obfuscate your code in a way that can't be broken? It won't.
score: 0
type: Comment

http://stackoverflow.com/a/25054598
has comment: http://stackoverflow.com/comment/38973692
score: 0
has comment: http://stackoverflow.com/comment/38973547
has body: If your using spring you can use a simple trigger bean which can call a method that deals with reading the porperties file. As an idea you can use the org.apache.commons.configuration.PropertiesConfiguration in your java if you choose to, to manage loading the properties file for you. Now your java code public class PropertyFileReader { private PropertiesConfiguration configuration; public PropertyFileReader() { configuration = new PropertiesConfiguration("my property file location"); configuration.addConfigurationListener(new ConfigurationListener() { @Override public void configurationChanged(ConfigurationEvent event) { // Do what needs to be done here } }); } /** * Method called by quartz timer for reloading properties file */ public void runLoadPropertiesFileg() { // Check if properties have changed. // In this example I am using apache PropertiesConfiguration. // Performs a reload operation if necessary. Events will be passed to //configuration listeners. configuration.reload(); } }
type: Answer
answers question: http://stackoverflow.com/q/25052818

http://stackoverflow.com/q/24982321
downvote count: 0
accepted answer: http://stackoverflow.com/a/24982496
favorite count: 0
has title: JAXB Unmarshalling issues with XML attributes
tagged with: http://stackoverflow.com/tag/xml
has answer: http://stackoverflow.com/a/24982496
upvote count: 7
tagged with: servicenow
type: AnsweredQuestion
score: 7
tagged with: java
has body: I am having an issue unmarshalling with JAXB for an XML file. There is an attribute on some of the xml elements called "display_value" which I need to obtain. Here is a small example of the XML file: <change_request> true not requested <assigned_to display_value=""/> <alt_poc display_value="Tom Ford">056468745677484657</alt_poc> 56465148754878 </change_request> I assume that in my ChangeRequest class I would simply annotate @XmlAttribute(name="display_value) on the fields that have the display_value that attribute, such as alt_poc but that doesn't seem to work. Here is an example of my ChangeRequest class. @XmlAccessorType(XmlAccessType.FIELD) public class ChangeRequest{ String active; String approval; String assigned_to; String alt_poc; String poc; } I do have a class that contains a list of ChangeRequest objects, called ChangeRequests. This class is simple and looks like: @XmlRootElement(name="unload") public class ChangeRequests{ ArrayList<ChangeRequest> changeRequestList; @XmlElement(name="change_request") public ArrayList<ChangeRequest> getRecords(){ return changeRequestList; } Finally I will show you the JAXB code where I do all of this URL url = new URL("wwww.somethingInteresting.com/syz.xml"); try { JAXBConext jc = JAXBContext.newInstance(ChangeRequest.class, ChangeRequests.class); Unmarshaller un = jc.createUnmarshaller(); return (ChangeRequests) un.unmarshal(url); } catch(JAXBException e){ thow new RunTimeException(e); } Currently, all the code works, however I cannot get the display_value when I need it. Instead of the display_value I am getting the long number like 65484435487. Any help anyone can provide would be great. Thank you!
tagged with: jaxb
type: Question
answer count: 1

http://stackoverflow.com/q/24962864
tagged with: bukkit
accepted answer: http://stackoverflow.com/a/24963268
type: Question
type: AnsweredQuestion
has body: I need an Event which is called, when the PlayerInventory is opened or the content is changed. The InventoryOpenEvent works only with chests, furnances etc, but not with the PlayerInventory. I'm using the Java 1.6 SDK with the craftbukkit 1.7 API. I have the plugin ProWalls installed on my Minecraft TheWalls Server. Now I'm coding a own plugin, which should extend this plulgin. My plugin simply should let the user to select a kit before the game starts and when the game started and all players are teleported to their start locations, my plugin should add the kit items of the kit selected before. My problem is now, that I need the moment, when the player is teleported to the spawnpoint. I first tried it with PlayerTeleportEvent, but this is too early. The items will be added, before ProWalls clear the inventory and adds his own Item. Now I want to try it with an Event called, when a item was added in the inventory of the player. Then I can check if the added item is the item which is added by ProWalls at begin of the game and if this is true, I will add my own items. ProWalls calls the method initGameSettings() at start to save the inventory, clear it and add his own item. So another possible solution would be, to make an event called when the plugin ProWalls calls his own method initGameSettings(). But I don't know, if this is possible. With my current code, I see the items added from my kit a few moments in my inventory but milliseconds later, the items will be removed. If there is no other solution I maybe had to to it with a timer, who waits a few milliseconds and adds the items than. But this is, as I find, no good solution... For better understanding here the order again: Player joins TheWalls Game, ProWalls plugin calls initGameSettings(), plugin clears player inventory and adds own item, Now my plugin should add the items of the kit.
tagged with: inventory
tagged with: minecraft
has answer: http://stackoverflow.com/a/24963268
score: 0
answer count: 2
has title: Minecraft Bukkit API Event for opening PlayerInventory
tagged with: events
possible better answer: http://stackoverflow.com/a/40938462
tagged with: java
has answer: http://stackoverflow.com/a/40938462

http://stackoverflow.com/comment/38785814
type: Comment
comment on: http://stackoverflow.com/a/24955215
score: 1
has text: +1 you can copy the existing class, and change it in about 5 minutes.
type: AnswerComment

http://stackoverflow.com/a/69602198
type: Answer
upvote count: 3
answers question: http://stackoverflow.com/q/25054203
score: 3
downvote count: 0
has body: The solution is to load by name the variant of the font, for example: Font font = new Font("Segoe UI Semibold", Font.PLAIN, 12);

http://stackoverflow.com/q/24948553
upvote count: 1
has comment: http://stackoverflow.com/comment/38774199
has body: Here is my code. It is supposed to put integers into a linked list until the user enters -1. It does that fine, but at the end it prints nothing. I don't see why the integers aren't being properly stored in the list. public static Node read(Scanner scan) { int i = scan.nextInt(); Node n = new Node(); if (i == -1) { return n; } else { n.data = i; n = n.next; read(scan); return n; } } private static void printlist(Node head) { if(head == null) {} else { System.out.print(head.data + " "); printlist(head.next); ... } } public static void main(String[] args) { Scanner scan = new Scanner(System.in); Node head = read(scan); printlist(head); } I added the main and print methods as requested. I also noticed that I am creating a new Node in my recursive read method. How do I declare the node in the read method while also not making an extra node?
tagged with: recursion
tagged with: linked-list
has title: Why is this linked list returning null? Java
tagged with: java
has answer: http://stackoverflow.com/a/24948614
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/38774201
has answer: http://stackoverflow.com/a/24948605
score: -1
favorite count: 0
type: UnansweredQuestion
downvote count: 2
has comment: http://stackoverflow.com/comment/38774191

http://stackoverflow.com/q/24946708
possible better answer: http://stackoverflow.com/a/24946787
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24946787
upvote count: 3
type: Question
has comment: http://stackoverflow.com/comment/38770564
has title: Java Regex validation for list of numbers
score: 3
tagged with: java
has comment: http://stackoverflow.com/comment/38770578
has answer: http://stackoverflow.com/a/24946994
has comment: http://stackoverflow.com/comment/38770966
answer count: 2
downvote count: 0
has body: I'm a newbie in java regex. i am seeking for advise for this series of number checking : Number, must be >= 10 digits, user is not allowed to input as follows: "0000000000","1111111111","2222222222","3333333333","4444444444", "5555555555","6666666666","7777777777","8888888888","9999999999", "1234567890","00000000000","11111111111","22222222222","33333333333", "44444444444","55555555555","66666666666","77777777777","88888888888", "99999999999" currently my regex pattern is something like this ^(?=\\d{8,11}$)(?:(.)\\1*)$ this validates all numbers in the series except the 1234567890. any advise is appreciated. Thank you.
favorite count: 0
accepted answer: http://stackoverflow.com/a/24946994
tagged with: regex
has comment: http://stackoverflow.com/comment/38772028

http://stackoverflow.com/a/25065660
upvote count: 2
type: Answer
score: 2
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25065419
has body: You don’t need to use switch statements with enums. You can use the clean concept of inheritance with them as well: public class Action { private int m; private Stage stage; public Action() { stage = Stage.FIRST; } public void proceed() { if (stage != null) { stage = stage.proceed(this); } } enum Stage { FIRST { @Override Stage proceed(Action a) { a.m = 100; return SECOND; } }, SECOND { @Override Stage proceed(Action a) { //do something return null; // last stage } } ; /** * Executes current stage and returns next stage. */ abstract Stage proceed(Action a); } } The problem with your attempt of nesting classes is unsolvable: when declaring all sub-classes of the abstract class Stage as non-static inner classes, these classes require an outer instance of Stage at construction time. However, there is no instance for using as outer instance, as Stage is abstract and all sub-classes are inner classes requiring an already existing instance, thus creating a chicken-and-egg problem. As you already found out you cannot declare the inner class static as Stage is non-static and Java doesn’t allow static members in non-static inner classes but it wouldn’t help anyway as if the inner classes were static they had no outer Action instance as well which is what your attempt is all about. Otherwise you could simply use my solution above which already deals with the fact that inner enums are always static by introducing a parameter. So the intended name-space-like nesting only works with static inner classes which does not fit well into the idea of using the implicit outer instance: public class ActionB { private int m; private Stage stage; public ActionB() { stage = new Implementations.First(this); } public void proceed() { if (stage != null) { stage = stage.proceed(); } } public abstract class Stage { public abstract Stage proceed(); ActionB outer() { return ActionB.this; } } static class Implementations { public static class First extends Stage { First(ActionB outer) { outer.super…
has comment: http://stackoverflow.com/comment/39017435
answers question: http://stackoverflow.com/q/25065419
has comment: http://stackoverflow.com/comment/39052147
has comment: http://stackoverflow.com/comment/39018900

http://stackoverflow.com/comment/38757594
score: 0
type: Comment
has text: http://pastebin.com/Z4m4bD2p ^ From Catalina.out and localhost.log in /var/log/tomcat7 It should be noted this does not happen when launching from eclipse, which is the most perplexing part of this for me.
type: AnswerComment
comment on: http://stackoverflow.com/a/24938014

http://stackoverflow.com/q/25049274
has answer: http://stackoverflow.com/a/25049348
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/25049319
has answer: http://stackoverflow.com/a/25049319
has title: Log4J: Parse errors in log4j.xml
has body: I am starting to work log4j in my projects, and I have right now this configuration file: &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;log4j:configuration debug="true" xmlns:log4j="http://jakarta.apache.org/log4j/"&gt; &lt;appenders&gt; &lt;console name="Console" target="SYSTEM_OUT"&gt; &lt;patternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/&gt; &lt;/console&gt; &lt;/appenders&gt; &lt;loggers&gt; &lt;root level="error"&gt; &lt;appenderRef ref="Console"/&gt; &lt;/root&gt; &lt;/loggers&gt; &lt;/log4j:configuration&gt; but when I deploy the application, I get this error: log4j:WARN Continuable parsing error 2 and column 82 log4j:WARN O elemento-raiz do documento "log4j:configuration" deve corresponder à raiz de DOCTYPE "null". log4j:WARN Continuable parsing error 2 and column 82 log4j:WARN O documento é inválido: nenhuma gramática encontrada. log4j:WARN Unrecognized element appenders log4j:WARN Unrecognized element loggers while this two messages are displayed too: log4j: reset attribute= "". log4j: Threshold ="". anyone knows what's wrong with this configuration?
score: 0
accepted answer: http://stackoverflow.com/a/25049348
tagged with: log4j
tagged with: spring
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/a/26975476
has body: I don't believe so, I think you would have to code it yourself. I think its the same for JodaTime too. I'm sure you already figured this out, but here is some simple code for anyone else! final DateField x = new DateField(); final InlineDateField y = new InlineDateField(); HorizontalLayout layout = new HorizontalLayout(); layout.setSpacing(true); layout.addComponent(x); layout.addComponent(y); Button button = new Button("Today"); layout.addComponent(button); button.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { Date date = new Date(); x.setValue( date ); y.setValue( date ); } }); this.setContent(layout);
type: AcceptedAnswer
score: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/25027022
answers question: http://stackoverflow.com/q/25027022

http://stackoverflow.com/comment/38966598
comment on: http://stackoverflow.com/q/25050627
score: 0
type: QuestionComment
has text: @RJadhav: yes test cases will be like.Let HA be home country of a and HB be the home country of B. CA be the current country of A and CB be the current country of B.Now Cases are 1. HA=HB =CA=CB 2. HA=HB!=(CA=CB). 3. HA=HB,HA!=CA,CA!=CB.... like wise...
type: Comment

http://stackoverflow.com/comment/112861819
score: 0
type: Comment
has text: how to config that in a yaml config file?
comment on: http://stackoverflow.com/a/24941593
type: AnswerComment

http://stackoverflow.com/q/25013629
tagged with: jxl
favorite count: 0
has comment: http://stackoverflow.com/comment/38896121
has comment: http://stackoverflow.com/comment/38896047
has comment: http://stackoverflow.com/comment/38895986
has comment: http://stackoverflow.com/comment/38896135
has comment: http://stackoverflow.com/comment/38896051
type: AnsweredQuestion
tagged with: apache-poi
has comment: http://stackoverflow.com/comment/38895996
downvote count: 1
tagged with: excel
type: Question
has body: java.text.ParseException: Unparseable date: "" I am getting the above error as I am inputting some empty values from the excel file, I am copying to another excel workbook. For empty fields, I don't want any output. So, how to go ahead. Any help would be highly appreciated. public class excel_read { public static void main(String[] args) throws IOException, ParseException, RowsExceededException, WriteException { File fExcel = new File("C:\\Users\\Master\\Desktop\\fwdautomationforsmb\\new.xls"); WritableWorkbook writableBook = Workbook.createWorkbook(fExcel); writableBook.createSheet("Data", 0); WritableSheet writableSheet = writableBook.getSheet(0); Xls_Reader datatable = new Xls_Reader("C:\\Users\\Master\\Desktop\\fwdautomationforsmb\\Workbook1.xlsx"); int rows_count = datatable.getRowCount("Sheet1"); System.out.println("Total number of rows = " + rows_count); for(int i=2; i&lt;rows_count;i++) { String date_list = datatable.getCellData("Sheet1", "Past/Nearing Expiration Date", i); DateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy"); Calendar c = Calendar.getInstance(); c.setTime(new Date()); c.add(Calendar.DATE, 30); String output = dateFormat.format(c.getTime()); String dateInString1 = date_list; Date date1 = dateFormat.parse(dateInString1); String dateInString2 = output; Date date2 = dateFormat.parse(dateInString2); if(date1.compareTo(date2)&gt;0){ // System.out.println("Date1 is after Date2"); } else if(date1.compareTo(date2)&lt;0){ System.out.println(date_list); Label data1 = new Label(0, i, date_list); writableSheet.addCell(data1); } else if(date1.compareTo(date2)==0){ System.out.println(date_list); Label data1 = new Label(0, i, date_list); writableSheet.addCell(data1); } } writableBook.write(); writableBook.close(); } }
has answer: http://stackoverflow.com/a/25013707
tagged with: java
score: -1
accepted answer: http://stackoverflow.com/a/25013707
answer count: 2
possible better answer: http://stackoverflow.com/a/25013954
upvote count: 0
has title: java.text.ParseException: Unparseable date: " "
has answer: http://stackoverflow.com/a/25013954
tagged with: apache
has comment: http://stackoverflow.com/comment/38896178

http://stackoverflow.com/comment/38847724
score: 0
type: AnswerComment
type: Comment
has text: yeah I noticed that part of the scroll while I was editing post too... but the part on the parents is interesting... and now I see how you use the `@Override` part too I was doing it in a wrong way (inside the constructor instead of as a method). Let me analize it a bit.
comment on: http://stackoverflow.com/a/24987880

http://stackoverflow.com/comment/38918170
type: Comment
type: QuestionComment
score: 1
has text: You will have to work out the cause of the problem rather than working around it.
comment on: http://stackoverflow.com/q/25024923

http://stackoverflow.com/comment/38932359
type: Comment
has text: @r2b Yes. Suppose you have a method `test()` in class A and , If you ovveride that method of A in class C, then if you write `A.test()` then implementation of `test()` in Class C executes.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25032750

http://stackoverflow.com/comment/38946075
comment on: http://stackoverflow.com/q/25040118
score: 0
type: QuestionComment
has text: What happens if your class path contains all jars when you start the program?
type: Comment

http://stackoverflow.com/comment/38823331
type: AnswerComment
has text: Just a site note: it might not be relevant anyway. And even if you have a scenario where it IS relevant then the context is important: what happens before and after to the JIT can inline it or optimize it. If you use a good benchmarking framework (JMH) it might be better to synthetically test the performance of the single condition, but it might not be the same in your actual code (and not relevant to its performance).
type: Comment
comment on: http://stackoverflow.com/a/24975022
score: 0

http://stackoverflow.com/a/54719678
type: Answer
has body: Here's an option using find protoc --js_out=js \ -Iproto/ \ $(find proto/google -iname "*.proto")
answers question: http://stackoverflow.com/q/24949801
downvote count: 0
score: 39
has comment: http://stackoverflow.com/comment/97573895
upvote count: 39

http://stackoverflow.com/comment/38817662
comment on: http://stackoverflow.com/a/24964712
score: 1
type: AnswerComment
has text: @user3878500 make sure if that helped you that you mark it as accepted answer :) it will give the one who created this answer more reputation points. you also can up vote it using the arrows on the left side of the answer :)
type: Comment

http://stackoverflow.com/comment/38965535
comment on: http://stackoverflow.com/q/25050433
has text: I think you mean "node" with a "node"
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38744485
type: Comment
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/24931256
has text: The _client library_ should only contain the interface. In this case `HelloWorldInterface`. The project containing the bean and the client then both have a dependency on that interface project, but are independent on each other.

http://stackoverflow.com/comment/76306016
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25019909
has text: Possible duplicate of [Where are classpath, path and pathelement documented in Ant version 1.8.0?](https://stackoverflow.com/questions/2526826/where-are-classpath-path-and-pathelement-documented-in-ant-version-1-8-0)
score: 0

http://stackoverflow.com/comment/38917857
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25024923
has text: Do you know that renameTo is actually a problem, ie. is it worse than copy and delete as delete is system dependant too.

http://stackoverflow.com/comment/38876634
type: QuestionComment
comment on: http://stackoverflow.com/q/25002078
has text: Matching them using logic. I placed two cubes close enough together so they just touched. The green square draw function below my World.render function also draws a square that is 10x10 and the cube does not line up with it.
score: 0
type: Comment

http://stackoverflow.com/q/25026894
tagged with: scala
upvote count: 7
has answer: http://stackoverflow.com/a/25034488
type: AnsweredQuestion
score: 7
tagged with: java
has answer: http://stackoverflow.com/a/31329684
type: Question
possible better answer: http://stackoverflow.com/a/33287142
has comment: http://stackoverflow.com/comment/40724256
has answer: http://stackoverflow.com/a/33287142
tagged with: intellij-idea
accepted answer: http://stackoverflow.com/a/25034488
has body: I have a project that uses both Java and Scala code. When I am trying to run a main function from Scala on Intellij 13.1.4 with Scala Plugin 0.38.441 installed I get the following error Error:scalac: Error: Scala instance doesn't exist or is invalid: version unknown, library jar: /home/arpit/.m2/repository/org/scala-lang/scala-library/2.11/scala-library-2.11.jar, compiler jar: /home/arpit/.m2/repository/org/scala-lang/scala-compiler/2.11/scala-compiler-2.11.jar sbt.InvalidScalaInstance: Scala instance doesn't exist or is invalid: version unknown, library jar: /home/arpit/.m2/repository/org/scala-lang/scala-library/2.11/scala-library-2.11.jar, compiler jar: /home/arpit/.m2/repository/org/scala-lang/scala-compiler/2.11/scala-compiler-2.11.jar at sbt.ScalaInstance$.slowActualVersion(ScalaInstance.scala:122) at sbt.ScalaInstance$.sbt$ScalaInstance$$actualVersion(ScalaInstance.scala:119) at sbt.ScalaInstance$$anonfun$actualVersion$1.apply(ScalaInstance.scala:32) at sbt.ScalaInstance$$anonfun$actualVersion$1.apply(ScalaInstance.scala:32) at scala.Option.getOrElse(Option.scala:120) at sbt.ScalaInstance.actualVersion$lzycompute(ScalaInstance.scala:32) at sbt.ScalaInstance.actualVersion(ScalaInstance.scala:32) at org.jetbrains.jps.incremental.scala.local.CompilerFactoryImpl$.org$jetbrains$jps$incremental$scala$local$CompilerFactoryImpl$$getOrCompileInterfaceJar(CompilerFactoryImpl.scala:79) at org.jetbrains.jps.incremental.scala.local.CompilerFactoryImpl$$anonfun$getScalac$1.apply(CompilerFactoryImpl.scala:43) at org.jetbrains.jps.incremental.scala.local.CompilerFactoryImpl$$anonfun$getScalac$1.apply(CompilerFactoryImpl.scala:42) at scala.Option.map(Option.scala:145) at org.jetbrains.jps.incremental.scala.local.CompilerFactoryImpl.getScalac(CompilerFactoryImpl.scala:42) at org.jetbrains.jps.incremental.scala.local.CompilerFactoryImpl.createCompiler(CompilerFactoryImpl.scala:21) at org.jetbrains.jps.incremental.scala.local.CachingFactory$$anonfun$createCompiler$1.apply(Cachin…
has answer: http://stackoverflow.com/a/35868840
downvote count: 0
has title: Intellij not able to run Scala Code
answer count: 4
favorite count: 0

http://stackoverflow.com/comment/38909795
type: Comment
has text: Thanks. I tried this and I get this error: Only void methods can doNothing()!... the method is private void though...
comment on: http://stackoverflow.com/a/25020531
type: AnswerComment
score: 0

http://stackoverflow.com/comment/39020056
comment on: http://stackoverflow.com/a/25053586
type: AnswerComment
score: 0
type: Comment
has text: Thanks Konstantin V. Salikhov and Mohsin Husen for your answers…. ElasticSearch-1.1.0 and compile 'org.springframework.data:spring-data-elasticsearch:1.0.0.RC1' Solved my problem...:)

http://stackoverflow.com/a/24967466
upvote count: 5
type: Answer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24967459
answers question: http://stackoverflow.com/q/24967459
has body: if (economySeats &gt; 0 || economySeats &lt; 9) This condition is always true (since any number is either positive or less than 9), so of course you don't reach the else clause. You probably want the &amp;&amp; (and) operator : if (economySeats &gt; 0 &amp;&amp; economySeats &lt; 9) And your other conditions have the same error.
score: 5
type: AcceptedAnswer

http://stackoverflow.com/comment/38966661
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25049698
has text: how you can detect a file has header and another one not?
score: 0

http://stackoverflow.com/q/24955808
has title: How to avoid actionMessages/actionError generating ul li tags?
tagged with: ognl
score: 6
tagged with: struts2
has answer: http://stackoverflow.com/a/24956121
answer count: 2
accepted answer: http://stackoverflow.com/a/24956118
downvote count: 0
tagged with: jsp
possible better answer: http://stackoverflow.com/a/24956121
favorite count: 0
has body: In my Struts 2 application following tags generating ul li span tags, I have to avoid it. How it could possible? I am also used theme="simple", it doesn't work. &lt;s:actionmessage /&gt; &lt;s:actionerror /&gt;
upvote count: 6
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24956118
tagged with: java
tagged with: struts-tags
type: Question

http://stackoverflow.com/q/24926093
has answer: http://stackoverflow.com/a/24926135
tagged with: jframe
tagged with: swing
has body: I will launch Window2 after I click a button. It's not launched immediately but after 3 seconds. What I want is to show it on the top of the screen. It works if the Window1 is still on the screen but fails if I minimize Window1. The code is here: import java.awt.BorderLayout; import java.awt.Dimension; import java.awt.Font; import java.awt.Frame; import java.awt.Graphics; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JPanel; public class TopTest { public static void main(String[] args) { TopTest test = new TopTest(); test.createUI(); } public void createUI(){ JFrame frame = new JFrame("Window1"); JPanel panel = new JPanel(); JButton button = new JButton("show"); button.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { // TODO Auto-generated method stub Window window = new Window(); try { Thread.sleep(3000); } catch (InterruptedException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } window.createUI(); } }); panel.add(button); frame.add(panel,BorderLayout.CENTER); frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true); } class Window { public void createUI(){ JFrame frame = new JFrame("Window2"); frame.setExtendedState(Frame.MAXIMIZED_BOTH); frame.add(new MainPanel()); frame.setLocationRelativeTo(null); frame.setVisible(true); } @SuppressWarnings("serial") class MainPanel extends JPanel{ @Override public Dimension getPreferredSize() { // TODO Auto-generated method stub return new Dimension(800,600); } protected void paintComponent(Graphics g){ g.setFont(new Font("Arial", Font.BOLD, 50)); g.drawString("I am Window2", 200, 200); } } } } Thanks for your help in advance.
type: AnsweredQuestion
tagged with: java
type: Question
score: 0
linked to: http://stackoverflow.com/q/24904006
answer count: 1
tagged with: awt
accepted answer: http://stackoverflow.com/a/24926135
has title: How to make my JFrame on the top op the screen?

coordinates
tags question: http://stackoverflow.com/q/24924707
tag name: coordinates
type: Tag
tags question: http://stackoverflow.com/q/24932014
tags question: http://stackoverflow.com/q/25032784
tags question: http://stackoverflow.com/q/24952514

http://stackoverflow.com/q/24977871
tagged with: swing
has comment: http://stackoverflow.com/comment/38828705
has comment: http://stackoverflow.com/comment/38828830
answer count: 1
downvote count: 1
linked to: http://stackoverflow.com/q/14544013
has answer: http://stackoverflow.com/a/24978159
has comment: http://stackoverflow.com/comment/38828921
tagged with: printing
type: AnsweredQuestion
upvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/24978159
type: Question
has comment: http://stackoverflow.com/comment/38828661
has title: Printing selected Component of JFrame to Printer
linked to: http://stackoverflow.com/q/12584548
has body: I have this Application Developed in Java. I want to print only some Components, for example "Customer Name", "The Table" and the "Date". I have gone through this example but I am not able to print properly.
score: -1
tagged with: java

http://stackoverflow.com/comment/38975780
comment on: http://stackoverflow.com/q/25055756
score: 0
type: Comment
type: QuestionComment
has text: Good choice! Check out these questions http://stackoverflow.com/questions/23172643/how-to-set-up-datasource-with-spring-for-hikaricp, http://stackoverflow.com/questions/23630123/how-to-configure-datasource-with-hikaricp-in-spring-configuration-class

http://stackoverflow.com/q/24985095
upvote count: 3
tagged with: java
has title: GMap ajax "pointSelect" event doesn't work after validation
tagged with: google-maps
answer count: 0
type: UnansweredQuestion
tagged with: ajax
score: 3
downvote count: 0
favorite count: 0
has body: I have awkward problem. Primefaces' GMap component works as I expected until... I return a message to component after validating data on backing bean. After that map does not react on ajax's "pointSelect" event. It can be moved, zoomed-in, etc, but I cannot go into my code that's responsible for adding markers. Here's my code: Primefaces &lt;p:outputLabel for="add_marker" value="Punkt:" /&gt; &lt;p:outputPanel id="add_marker" style="text-align:center;"&gt; &lt;p:gmap id="add_gmap" widgetVar="addMap" center="#{addSpotController.sampleSpot.latitude}, #{addSpotController.sampleSpot.longitude}" zoom="15" model="#{addSpotController.model}" type="HYBRID" style="width:600px;height:400px" streetView="true"&gt; &lt;p:ajax event="pointSelect" listener="#{addSpotController.addMarker}" update=":#{p:component('add_gmap')}, :#{p:component('add_msgs')}, :#{p:component('basicDT')},:#{p:component('mfDT')}" /&gt; &lt;/p:gmap&gt; &lt;/p:outputPanel&gt; &lt;p:commandButton id="add_confirm" value="Dodaj" actionListener="#{addSpotController.addSpot}" update=":#{p:component('add_msgs')}, :#{p:component('addForm')}, :#{p:component('addInfoTitle')}, :#{p:component('add_gmap')}" oncomplete="PF('addInfo').show()"&gt; &lt;/p:commandButton&gt; BackingBean public void addMarker(PointSelectEvent pse) { FacesMessage message; if (title == null || title.isEmpty()) { message = new FacesMessage("Brak tytułu", "Najpierw wprowadź tytuł."); } else { if (!model.getMarkers().isEmpty()) { model.getMarkers().clear(); } Marker marker = new Marker(pse.getLatLng(), title); model.addOverlay(marker); LatLng latLng = marker.getLatlng(); sampleSpot.setLatitude(latLng.getLat()); sampleSpot.setLongitude(latLng.getLng()); message = new FacesMessage("Dodano punkt:", title); } FacesContext.getCurrentInstance().addMessage(null, message); } public void addSpot() { if (isDataValid()) { Marker marker = model.getMarkers().get(0); savedID = spotService.addSpot(new UserBean(), marker, newSpotReceiverType, receiversList); sampl…
type: Question
tagged with: jsf
tagged with: primefaces

http://stackoverflow.com/comment/38865118
score: 3
type: AnswerComment
comment on: http://stackoverflow.com/a/24992570
has text: I would suggest to not use clojure directly, just use leinigen's repl task
type: Comment

http://stackoverflow.com/comment/38992335
score: 2
type: Comment
has text: What does your compiler say?
type: QuestionComment
comment on: http://stackoverflow.com/q/25064732

http://stackoverflow.com/q/25014768
downvote count: 3
upvote count: 1
has body: making a small chat app... but since im coming from a VB back ground i was wondering is there a way to do this in Java. when a Client(node) writes a message to me, i read the inputStream via a loop. but, isnt there a way to raise an event the moment some message has come into my system rather than being running the loop through out? isnt that an efficient method? Like how in VB,the moment a stream is being received an event is raised, so in Java- is there something like a key/action listener for a stream that is coming in? pls see my code... ServerSocket ss = new ServerSocket(5000); Socket s = ss.accept(); BufferedReader br = new BufferedReader(new InputStreamReader(s.getInputStream())); String str,str1; while((str=br.readLine())!=null) { System.out.println(str); } Basically when idle the loop shouldnt keep excecuting cause i feel that is inefficient? advise? or do i start it in a new thread? how would a messaging software handle this efficiently.. any ideas? thanx in advance guys. im like a bigenner UPDATE: I later on realised that my concepts in Java were totally wrong, I totally understand my confusion, and this actually was a NOT required question. Thanks guys
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25014835
has comment: http://stackoverflow.com/comment/38899282
favorite count: 0
has comment: http://stackoverflow.com/comment/38899399
has title: Event being Raised
type: Question
score: -2
answer count: 1
has comment: http://stackoverflow.com/comment/38898091
tagged with: java

http://stackoverflow.com/comment/38970145
type: AnswerComment
score: 0
has text: Is there another suggestive way your knowledge and help can be implement into my code as the requirement is a spinner with two locations cape Marie and Star Island; cape marie equals $20 per ticket and Star Island $30 per ticket. User enters number of tickets, selects from spinner the location and when button is pressed it calculates the total cost?
type: Comment
comment on: http://stackoverflow.com/a/25029717

http://stackoverflow.com/q/24980364
has body: trying to make some spring example program - constantly getting the error - it happens that my controller cannot handle /hello request. Here is debug info from log4j. 13:50:58,502 {TRACE} DispatcherServlet.initContextHolders:1018 - Bound request context to thread: org.apache.catalina.connector.RequestFacade@636f2067 13:50:58,503 {DEBUG} DispatcherServlet.doService:823 - DispatcherServlet with name 'springtest' processing GET request for [/springtest_2/hello] 13:50:58,504 {TRACE} DispatcherServlet.getHandler:1088 - Testing handler map [org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping@7bab2c3] in DispatcherServlet with name 'springtest' 13:50:58,504 {DEBUG} RequestMappingHandlerMapping.getHandlerInternal:220 - Looking up handler method for path /hello 13:50:58,504 {DEBUG} RequestMappingHandlerMapping.getHandlerInternal:230 - Did not find handler method for [/hello] 13:50:58,504 {TRACE} DispatcherServlet.getHandler:1088 - Testing handler map [org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping@722e242b] in DispatcherServlet with name 'springtest' 13:50:58,505 {TRACE} BeanNameUrlHandlerMapping.getHandlerInternal:127 - No handler mapping found for [/hello] 13:50:58,505 {WARN} PageNotFound.noHandlerFound:1108 - No mapping found for HTTP request with URI [/springtest_2/hello] in DispatcherServlet with name 'springtest' 13:50:58,505 {TRACE} DispatcherServlet.resetContextHolders:1028 - Cleared thread-bound request context: org.apache.catalina.connector.RequestFacade@636f2067 13:50:58,505 {DEBUG} DispatcherServlet.processRequest:966 - Successfully completed request 13:50:58,506 {TRACE} XmlWebApplicationContext.publishEvent:332 - Publishing event in WebApplicationContext for namespace 'springtest-servlet': ServletRequestHandledEvent: url=[/springtest_2/hello]; client=[0:0:0:0:0:0:0:1]; method=[GET]; servlet=[springtest]; session=[null]; user=[null]; time=[9ms]; status=[OK] web.xml from my project. <?xml version="1.0" encoding="UT…
has answer: http://stackoverflow.com/a/24980808
score: 6
tagged with: spring
upvote count: 6
answer count: 4
has answer: http://stackoverflow.com/a/43858995
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/38834970
has comment: http://stackoverflow.com/comment/38834967
has answer: http://stackoverflow.com/a/30316508
has title: RequestMappingHandlerMapping.getHandlerInternal:230 - Did not find handler method for
tagged with: controller
tagged with: dispatcher
downvote count: 0
has comment: http://stackoverflow.com/comment/38833207
favorite count: 0
has answer: http://stackoverflow.com/a/40782943
linked to: http://stackoverflow.com/q/11861609
has comment: http://stackoverflow.com/comment/38833154
tagged with: web.xml
has comment: http://stackoverflow.com/comment/38833273
type: UnansweredQuestion

http://stackoverflow.com/comment/38933976
has text: Yes I did, the encoding type is Multipart!
comment on: http://stackoverflow.com/q/25032644
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/a/24980705
has comment: http://stackoverflow.com/comment/38833918
has comment: http://stackoverflow.com/comment/38838772
accepted answer of: http://stackoverflow.com/q/24980651
downvote count: 0
has comment: http://stackoverflow.com/comment/38841571
has comment: http://stackoverflow.com/comment/38833885
answers question: http://stackoverflow.com/q/24980651
score: 20
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38838176
type: Answer
has body: The iterator returned from ArrayList.iterator() in the implementation we're apparently both using only checks for structural modification in calls to next(), not in calls to hasNext(). The latter just looks like this (under Java 8): public boolean hasNext() { return cursor != size; } So in your second case, the iterator "knows" that it's returned two elements, and that the list only has two elements... so hasNext() just returns false, and we never end up calling next() the third time. I would view this as an implementation detail - basically the checking not being as strict as it could be. It would be entirely reasonable for hasNext() to perform a check and throw an exception in this case too.
has comment: http://stackoverflow.com/comment/38839013
upvote count: 20
has comment: http://stackoverflow.com/comment/38841197
has comment: http://stackoverflow.com/comment/38841944
has comment: http://stackoverflow.com/comment/38841256

http://stackoverflow.com/a/24962071
score: 3
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/38799182
has comment: http://stackoverflow.com/comment/38801520
has comment: http://stackoverflow.com/comment/38815883
has comment: http://stackoverflow.com/comment/38836477
accepted answer of: http://stackoverflow.com/q/24961971
type: Answer
has comment: http://stackoverflow.com/comment/38799318
answers question: http://stackoverflow.com/q/24961971
upvote count: 3
has body: I would normalize the database properly. This is one of the most common ways to abuse database design. If we were to convert this to 3rd normal form, Brand would have its own table, Band(?) would probably have its own table and the price would be in the table where other item data is included (or if that table doesn't exist, then create it). I don't see how this would cause "table explosion", unless you've simplified your example enormously. ItemTable Id | Itemname | ItemBrand | ItemBand 1 | Foobar | 2 | 3 CategoryTable Id | CategoryName 1 | Foo 2 | Bar 3 | Baz etc.
has comment: http://stackoverflow.com/comment/38799497

http://stackoverflow.com/comment/38900801
has text: The problem is you're instantiating `TestController` yourself (according to your description), which means you are assuming responsibility for its dependencies. If you let Spring manage an instance of `TestController` as a bean, then it will instantiate it and inject the dependencies for you.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25015868

http://stackoverflow.com/comment/38787143
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24953588
type: Comment
has text: `you cannot use both attributes method and action in the s:submit tag` > I've used them with no problems. The action was the same of the form, though, explicited for clarity, but no errors occurred.

http://stackoverflow.com/a/25065972
has comment: http://stackoverflow.com/comment/38997715
answers question: http://stackoverflow.com/q/25063894
has body: Try this one: #!/bin/bash while [ 1 = 1 ] do rcode="`tail -n 1000 catalina.out 2&gt;&amp;1 | grep -o Exception`" if [ "$rcode" = "Exception" ] then echo "Something went wrong." \ | mail -s "your subject" mail@mailaddress.com fi sleep 180 done There are certainly some improvements to be done. E.g. the "-n 1000" or sleeping for 180 seconds. But it should do for a start.
upvote count: 1
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/38996619
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/38997475
accepted answer of: http://stackoverflow.com/q/25063894

http://stackoverflow.com/q/25021807
possible better answer: http://stackoverflow.com/a/25045398
tagged with: java
has answer: http://stackoverflow.com/a/25045398
upvote count: 4
answer count: 4
tagged with: iterator
type: AnsweredQuestion
downvote count: 0
has comment: http://stackoverflow.com/comment/38912350
has answer: http://stackoverflow.com/a/25022542
tagged with: iterable
favorite count: 0
has answer: http://stackoverflow.com/a/25021950
type: Question
score: 4
tagged with: timer
has title: What is the best way to break out of iteration after a specific time?
accepted answer: http://stackoverflow.com/a/25022542
tagged with: multithreading
has answer: http://stackoverflow.com/a/25022734
has body: I am iterating over an Iterator, where hasNext() will never return false. However, after a specified time (let's say 20 seconds), I want to stop iterating. The problem is that the next() method of the Iterator is blocking, but even so, after a specified time, I just need the iteration to stop. Here is my example Iterable and Iterator to simulate my problem. public class EndlessIterable implements Iterable&lt;String&gt; { static class EndlessIterator implements Iterator&lt;String&gt; { public boolean hasNext() { return true; } public String next() { return "" + System.currentTimeMillis(); //in reality, this code does some long running task, so it's blocking } } public Iterator&lt;String&gt; iterator() { return new EndlessIterator(); } } Here is my code to test. EndlessIterable iterable = new EndlessIterable(); for(String s : iterable) { System.out.println(s); } I wanted to put code/logic into the Iterable class to create a Timer, so after the specified time is up, an exception will be thrown so as to stop the iteration. public class EndlessIterable implements Iterable&lt;String&gt; { static class EndlessIterator implements Iterator&lt;String&gt; { public boolean hasNext() { return true; } public String next() { try { Thread.sleep(2000); } catch(Exception) { } //just sleep for a while return "" + System.currentTimeMillis(); //in reality, this code does some long running task, so it's blocking } } static class ThrowableTimerTask extends TimerTask { private Timer timer; public ThrowableTimerTask(Timer timer) { this.timer = timer; } public void run() { this.timer.cancel(); throw new RuntimeException("out of time!"); } } private Timer timer; private long maxTime = 20000; //20 seconds public EndlessIterable(long maxTime) { this.maxTime = maxTime; this.timer = new Timer(true); } public Iterator&lt;String&gt; iterator() { this.timer.schedule(new ThrowableTimerTask(this.timer), maxTime, maxTime); return new EndlessIterator(); } } I then try to test this code as follows. Endle…

webview
tags question: http://stackoverflow.com/q/25020718
tag name: webview
tags question: http://stackoverflow.com/q/24943561
type: Tag
tags question: http://stackoverflow.com/q/24960478
tags question: http://stackoverflow.com/q/24988897
tags question: http://stackoverflow.com/q/24966440
tags question: http://stackoverflow.com/q/25017973
tags question: http://stackoverflow.com/q/24977781

http://stackoverflow.com/q/24919282
upvote count: 1
type: Question
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25726576
has title: Change multiline EditText cursor position without opening keyboard
score: 1
tagged with: java
linked to: http://stackoverflow.com/q/13811080
downvote count: 0
answer count: 1
favorite count: 0
has body: I am creating a dialog that has a EditText in it. The dialog takes more than half the screen and the logic of the dialog doesn't allow to use a keyboard. I was using this solution Android 4.0 EditText without soft keyboard and with cursor positioning but I found out that when you have a multi line EditText, it doesn't work since you can only select the first line. Is there a solution available for multi-line EditText? For single-line, this works: if(v.getId() == R.id.emo_text_field){ Layout layout = ((EditText) v).getLayout(); float x = event.getX() + v.getScrollX(); int offset = layout.getOffsetForHorizontal(0, x); if(offset&gt;0){ if(x&gt;layout.getLineMax(0)){ ((EditText) v).setSelection(offset); // touch was at end of text } else{ ((EditText) v).setSelection(offset - 1); } } return true; }
tagged with: android
has comment: http://stackoverflow.com/comment/40220012
has comment: http://stackoverflow.com/comment/40165392
has answer: http://stackoverflow.com/a/25726576

http://stackoverflow.com/a/24958388
has comment: http://stackoverflow.com/comment/38791821
score: 3
has comment: http://stackoverflow.com/comment/38797154
has comment: http://stackoverflow.com/comment/38799791
has comment: http://stackoverflow.com/comment/38839136
downvote count: 0
has comment: http://stackoverflow.com/comment/38792073
has body: If you're running the app as a web app then you should be looking for either: an absolute path a resource (e.g., on the classpath) a context-relative path Absolute paths are easy and can be defined using init parameters, system properties, config files, etc. Classpath resources must live on the app's classpath. Relative resources are off the ServletContext. The functionality that uses the file should be usable regardless of where the file comes from, e.g., it should take a stream or something. That way the functionality can be used from both your web app, standalone classes like a static main thing, or a unit test.
has comment: http://stackoverflow.com/comment/38797071
type: Answer
answers question: http://stackoverflow.com/q/24958199
has comment: http://stackoverflow.com/comment/38796419
upvote count: 3

http://stackoverflow.com/q/24917097
has body: I have a problem. I have form in play framework and when I want open new, I use this link: link/projeto/novo There are some fields that I need to save and I do one validation and If there some field blank, I send one "badrequest", like this: public static Result grava() throws IOException{ Long id; Http.Request request = request(); Form&lt;Projeto&gt; projetoFormRequest = projetoForm.bindFromRequest(); listaDeErros = new ArrayList&lt;String&gt;(); Projeto projeto = projetoFormRequest.get(); if(StringUtils.isEmpty(projeto.getNomeProjeto())){ listaDeErros.add(Messages.get("projeto.form.validacao.nomeProjetoObrigatorio")); } if(projeto.getTipoProjeto().getIdTipoProjeto()==null){ listaDeErros.add(Messages.get("projeto.form.validacao.tipoDeProjetoObrigatorio")); } ... if(listaDeErros.size()&gt;0){ return badRequest(cadastro.render(projetoForm, listaDeErros)); } ... My routes: GET /projeto/novo controllers.ProjetoController.cadastroProjeto() POST /projeto/grava controllers.ProjetoController.grava() but my link in browser change to link/projeto/grava I'd like to maintain the same link link/projeto/novo How could I do this ? thanks
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24921062
tagged with: playframework-2.1
score: 1
has comment: http://stackoverflow.com/comment/38720461
tagged with: java
has comment: http://stackoverflow.com/comment/38721221
tagged with: forms
upvote count: 1
type: Question
has title: Redirect in badrequest
downvote count: 0
answer count: 1

http://stackoverflow.com/q/25000695
tagged with: exception
tagged with: io
possible better answer: http://stackoverflow.com/a/25000767
has title: rudimentary java related issue
has comment: http://stackoverflow.com/comment/38871486
has answer: http://stackoverflow.com/a/25000767
tagged with: stack-trace
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38871462
has body: i've started experiencing this exceptional, unprecedented problem as of today my program stops accepting input after a certain point and unusually terminates here's the excerpt: public static void main(String[] args) { try { Scanner sc=new Scanner(System.in); String a=sc.nextLine(); String b=sc.nextLine(); String c=sc.nextLine(); String d=sc.nextLine(); String e=sc.nextLine(); int f=sc.nextInt(); for(int i=0;i&lt;3;i++) { System.out.printf("%s,%s,%s%n3",a,b,c); } // TODO, add your application code System.out.println("Hello World!"); }catch (Exception cause) { StackTraceElement elements[] = cause.getStackTrace(); for (int i = 0, n = elements.length; i &lt; n; i++) { System.err.println(elements[i].getFileName() + ":" + elements[i].getLineNumber() + "&gt;&gt; " + elements[i].getMethodName() + "()"); } } i have tried to access Stack Trace information above to figure out what has gone wrong with my jdk or some other software that might be causing this problem this is the output that the afore-mentioned code generates Scanner.java:864>> throwFor() Scanner.java:1485>> next() Scanner.java:2117>> nextInt() Scanner.java:2076>> nextInt() pester.java:21>> main() any help would be appreciated
tagged with: java
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/25000743
accepted answer: http://stackoverflow.com/a/25000743
score: 0

http://stackoverflow.com/a/25069237
type: Answer
answers question: http://stackoverflow.com/q/25069047
has body: I think you are getting your indents and brackets mixed up. For example lets look at your while loop ONLY while (!ageGroup [4].equals(authorDemographics) &amp;&amp; demoLoop == 0) { System.out.println ("Would you like to enter more demographics?"); System.out.println ("Type 1 for Yes. Type 2 for No."); question = input.nextInt (); } You never change ageGroup[4] or demoloop, so once your loop hits the end, it checks the condition again, and the condition will always be true. (A loop in motion remains in motion unless acted upon) It also looks like your if is indented. This does not mean that it is in your loop. Your loop end where the matching bracket is regardless of indentation. Did you want the if and else INSIDE of the loop?
score: 0

http://stackoverflow.com/comment/38812811
type: AnswerComment
has text: You need to call super.paint(g) because it is responsible for painting other aspects of the applet, like the background and may other components...normally I wouldn't recommend overriding paint at all, especially of a top level container, but for this example, I can live with it ;)
type: Comment
comment on: http://stackoverflow.com/a/24969267
score: 0

http://stackoverflow.com/comment/38840715
has text: http://pastebin.com/RzcxMH1u Okay, I got rid of the error, but how would I get the number value from the accounts.txt? (Not the bank number, the account balance)
type: AnswerComment
comment on: http://stackoverflow.com/a/24978339
score: 0
type: Comment

http://stackoverflow.com/a/58645985
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/25010365
has comment: http://stackoverflow.com/comment/103724940
has comment: http://stackoverflow.com/comment/103615627
has body: Kind Mr. Narendra, I came up with a solution based on regular expressions. The idea is to use pattern restriction with a regular expression capable of accepting any case combination. I created an example with an enumeration of three colors: green, red and blue. The following regular exception would accept both "GrEEn" and "gReeN" literals as valid values: g|Gr|Re|Ee|En|N Here under the example files: Example XML-Schema <xs:simpleType name="ColorType" final="restriction" > <xs:restriction base="xs:string"> <xs:pattern value="g|Gr|Re|Ee|En|N" /> <xs:pattern value="r|Re|Ed|D" /> <xs:pattern value="b|Bl|Lu|Ue|E" /> </xs:restriction> </xs:simpleType> <xs:element name="SomeElement"> <xs:complexType> <xs:sequence> <xs:element name="Color" type="ColorType" /> </xs:sequence> </xs:complexType> </xs:element> XML Case 1 GreEN XML Case 2 gREen JUnit public class TestJaxb { private static final String GREEN = "GREEN"; @Test public void shouldParseCase1() throws JAXBException, MalformedURLException { URL xmlUrl = // Load XML file 1 SomeElement someElement = parse(xmlUrl, SomeElement.class); assertEquals(GREEN, someElement.getColor().toUpperCase()); } @Test public void shouldParseCase2() throws JAXBException, MalformedURLException { URL xmlUrl = // Load XML file 2 SomeElement someElement = parse(xmlUrl, SomeElement.class); assertEquals(GREEN, someElement.getColor().toUpperCase()); } private <T> T parse(URL url, Class<T> clazz) throws JAXBException { Unmarshaller unmarshaller = JAXBContext.newInstance(clazz).createUnmarshaller(); return clazz.cast(unmarshaller.unmarshal(url)); } } I realize that this makes it more difficult for the user of your XSD specification to understand which values are allowed in the enumeration, but maybe a comment would be enough for you. The fact is that there is no other way that I've found to achieve this without actually altering JAXB code. Hope this helps. Best regards
has comment: http://stackoverflow.com/comment/103712287
downvote count: 0
has comment: http://stackoverflow.com/comment/103725293
type: Answer

http://stackoverflow.com/q/24933378
tagged with: java
has answer: http://stackoverflow.com/a/24935059
has title: Not able to map db entries to java enum
answer count: 1
downvote count: 0
tagged with: mybatis
favorite count: 0
has comment: http://stackoverflow.com/comment/38746483
has comment: http://stackoverflow.com/comment/38745815
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38746363
upvote count: 1
accepted answer: http://stackoverflow.com/a/24935059
has body: I'm getting following error while fetching entries from DB using mybatis (v3.1.1) in a Spring app. It's related to mapping of string(used to save value in db) to enum (used for mapping). Stack trace is as follow: List com.expertly.service.TransactionLogServiceImpl.getTransactionLogs(ActionType) threw org.apache.ibatis.exceptions.PersistenceException: ### Error querying database. Cause: java.lang.IllegalArgumentException: No enum const class com.expertly.common.model.reports.TransactionState.COMMITTED ### The error may exist in com/expertly/data/mapper/TransactionLogMapper.java (best guess) ### The error may involve com.expertly.data.mapper.TransactionLogMapper.getTransactionLogs-Inline ### The error occurred while setting parameters ### SQL: SELECT id, transactionstate AS "transactionState", sessionid AS "userSession.sessionId" FROM transactionlog WHERE actioncode = 'VIEW_USER' Caused by: java.lang.IllegalArgumentException: No enum const class com.expertly.common.model.reports.TransactionState.COMMITTED at java.lang.Enum.valueOf(Enum.java:196) ~[na:1.6.0_38] at org.apache.ibatis.type.EnumTypeHandler.getNullableResult(EnumTypeHandler.java:43) ~[mybatis-3.1.1.jar:3.1.1] at org.apache.ibatis.type.EnumTypeHandler.getNullableResult(EnumTypeHandler.java:23) ~[mybatis-3.1.1.jar:3.1.1] My mapper's function: @Select("SELECT id, transactionstate AS \"transactionState\", sessionid AS \"userSession.sessionId\" "+ "FROM transactionlog WHERE actioncode = #{actionType} ") List&lt;TransactionLog&gt; getTransactionLogs(@Param("actionType") ActionType actionType) throws TransactionLogMapperException; TrsnacationLog class has following members: private int id; private UserSession userSession; private ActionType actionType; private TransactionState transactionState; private String paramValue; private Timestamp startTime; private Timestamp endTime; The ActionType enum is as follow: package com.expertly.common.model.reports; import java.io.Serializable; import com.google.gwt.user.client.…
type: Question
tagged with: spring-mvc
tagged with: enums
score: 1

android-actionbar
type: Tag
tags question: http://stackoverflow.com/q/25020970
tags question: http://stackoverflow.com/q/24926998
tags question: http://stackoverflow.com/q/25005227
tag name: android-actionbar

http://stackoverflow.com/a/25048610
type: Answer
answers question: http://stackoverflow.com/q/25048182
downvote count: 0
score: 1
has body: It looks like your error is: public void show(Player p) { p.openInventory(inv); } Player p; //&lt;&lt;&lt;&lt;&lt; HERE PlayerInventory pi = p.getInventory(); The Player p is never initialized, so it defaults to null. You get a NullPointerException when you try to call a method on a null Object, so, you get a NullPointerException when you try to run p.getInventory(), which is effectively null.getInventory(), which throws a NullPointerException. To fix this, you should initialize p: Player p; public void show(Player pl){ p = pl; //p is no longer null, unless the method show(null) is called, otherwise, you're good to go! pl.openInventory(inv); } PlayerInventory pi = p.getInventory();
upvote count: 1

http://stackoverflow.com/a/24963899
has body: One way is to sort the array once it is built and check if it has duplicate value. Of course you can brute force it and loop the entire array every time you add an item, but this is terribly inefficient. The solution below is also equally inefficient to start with, but has opportunities for optimization. I am deliberately avoiding to give code because I assume you want to learn and not just copy-paste. Once you have the array values populated (so, after your while loop), sort the array. You probably already know how to sort an array from previous exercises, but if you don't, bubble sort is the easiest to learn (and the worst in performance). See this answer for a simple bubble sort implementation. function bubbleSort: //values is your array //length is the length of values loop i from 0 to length - 1 loop j from i+1 to length - 1 if values[i] &gt; values[j] swap values[i] and values[j] end if end loop end loop end function Once you have a sorted array, loop through it and check if the current element is the same as the previous element. If it is, then it is a duplicate. function removeDuplicates: //values is your array //non_duplicate_array is another array with only non duplicate values loop from 1 to size-1 //and not from 0, because we are comparing //an element with the previous and //the element at 0 does not have a previous element if values[i] == values[i-1] //duplicate! else add element to non_duplicate_array. end if end loop So we have: populate array (code that you already have) sort search and remove duplicates One optimization that you can build is to ensure that the sorting itself has duplicate elimination: This is the innermost loop in the bubble sort above: loop j from i+1 to length - 1 if values[i] &gt; values[j] swap values[i] and values[j] end if end loop Here instead of swapping the values, you can add the values to another array, and while doing so, do only the non duplicates: function bubbleSort: //values is your array //length is the length of v…
answers question: http://stackoverflow.com/q/24963352
score: 0
type: Answer

http://stackoverflow.com/comment/38952438
score: 0
type: QuestionComment
type: Comment
has text: It depends what client-side technology you are using. You've only mentioned Javascript so far. Are you using plain Javascript, or something like AngularJS, JQuery, Knockout, ...?
comment on: http://stackoverflow.com/q/25041700

http://stackoverflow.com/comment/38756153
score: 0
type: Comment
type: QuestionComment
has text: It doesnt close after taking a picture
comment on: http://stackoverflow.com/q/24938148

http://stackoverflow.com/comment/38962582
type: Comment
has text: Thanks for this detailed answer. For my given description this solution would be perfect, however, I forgot to mention (or thought it'd be irrelevant) that I also want to use other shapes (especially rounded rectangles and circles) instead of plain rectangles. Is this achievable by styling the stackpane or the label itself as proposed in your answer?
comment on: http://stackoverflow.com/a/25044498
score: 0
type: AnswerComment

http://stackoverflow.com/a/25057362
has comment: http://stackoverflow.com/comment/38978021
answers question: http://stackoverflow.com/q/25057271
score: -1
has body: When this is executed, b is always 0. arr[i]=b%10;
downvote count: 1
has comment: http://stackoverflow.com/comment/38978631
upvote count: 0
type: Answer

http://stackoverflow.com/comment/38756129
comment on: http://stackoverflow.com/q/24939213
has text: What is sUtilities. If its an class make a field object of it. If you are trying to invoke static methods then make sure its in same package or else import it.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38771596
type: Comment
type: QuestionComment
has text: @EJP Thanks, so it means a file is not actually deleted until all opening handles close? But why the directory being locked?
comment on: http://stackoverflow.com/q/24911259
score: 0

http://stackoverflow.com/q/24931543
accepted answer: http://stackoverflow.com/a/24935407
has comment: http://stackoverflow.com/comment/38745490
answer count: 1
has answer: http://stackoverflow.com/a/24935407
tagged with: pdf-generation
type: AnsweredQuestion
tagged with: playframework-2.0
tagged with: java
has comment: http://stackoverflow.com/comment/38742500
has title: Java Drawing shapes to file of 2D object
type: Question
score: 0
has body: I have a play framework application which I want to be able to produce a product label from. I have the label design in illustrator. It consists of a black circle, white writing with a QR code in the middle, also has curved text. I want to create a high resolution PDF and/or image file of this design on the fly. All most all of the drawing stuff I find for java relates to swing. Anyone done this?

http://stackoverflow.com/q/24959324
has answer: http://stackoverflow.com/a/24959414
answer count: 2
has comment: http://stackoverflow.com/comment/38798634
has answer: http://stackoverflow.com/a/24959447
has comment: http://stackoverflow.com/comment/38794020
upvote count: 1
has title: How do I manage multiple verbose string constants?
has comment: http://stackoverflow.com/comment/38797527
tagged with: string
has comment: http://stackoverflow.com/comment/38793636
favorite count: 0
type: UnansweredQuestion
tagged with: enums
linked to: http://stackoverflow.com/q/8285595
downvote count: 0
has body: I have 24 Strings that are pretty verbose, like this i.e. "Enter a gene symbol or common name..." Now, typically with shorter string constants and lesser properties, I declare inner enums within the class. However, since there are 24 of these strings, I'm not sure if there is a more efficient or cleaner way of organizing my code. Additional info: I'm only using these strings once Need to put them into a String array for it to be used for a specific purpose This class containing these Strings, is the only class using them Here is my current code: private static String[] getTemplateDefaults() { String[] defaults = new String[] { "Enter Gene symbol or common name", "Enter blah blah blah", "Enter blah blah blah", "Enter blah blah blah", "Enter blah blah blah", // continued for 19 more times... }; return defaults; } Really just looking for some thoughts to organize this without it looking so cumbersome. Thanks!
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/38794146
type: Question

http://stackoverflow.com/comment/38802569
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24963450
has text: Yes I did. My MANIFEST.MF looks like this: Manifest-Version: 1.0 Dependencies: org.apache.log4j
score: 0

http://stackoverflow.com/q/25048691
has title: How to close file in Java and/or know where in my code some file is locked?
type: Question
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/25048931
accepted answer: http://stackoverflow.com/a/25048931
has comment: http://stackoverflow.com/comment/38962517
has comment: http://stackoverflow.com/comment/38962613
favorite count: 0
has comment: http://stackoverflow.com/comment/38962458
upvote count: 2
has comment: http://stackoverflow.com/comment/38962746
tagged with: file-locking
has comment: http://stackoverflow.com/comment/38963613
has comment: http://stackoverflow.com/comment/38962641
has body: Apparently I am always calling FileReader#close() and FileWriter#close(), but some of my files remained locked by my own code. How to 1) close file fully? 2) check, where in the code it was opened and not closed?
has comment: http://stackoverflow.com/comment/38962751
has comment: http://stackoverflow.com/comment/38962547
type: AnsweredQuestion
score: 2
has comment: http://stackoverflow.com/comment/38962635
tagged with: java
tagged with: file

http://stackoverflow.com/comment/38776179
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24939706
has text: You'll probably have to resort to JNI to maintain permissions in a java app. It's quite irritating that it's not supported on Linux. This would round out the functionality quite well.
type: AnswerComment

http://stackoverflow.com/comment/38845220
type: Comment
comment on: http://stackoverflow.com/a/24986278
score: 0
type: AnswerComment
has text: @HovercraftFullOfEels can you get me any piece of code to help me understand, cause I don't quite get it.

http://stackoverflow.com/a/62305688
upvote count: 7
downvote count: 0
score: 7
has body: To pretty print in expected yaml format (without the braces, like in accepted answer): public static void saveYamlToFile(final Object object) throws IOException { final DumperOptions options = new DumperOptions(); options.setDefaultFlowStyle(DumperOptions.FlowStyle.BLOCK); options.setPrettyFlow(true); final Yaml yaml = new Yaml(options); final FileWriter writer = new FileWriter("/path/to/file.yaml"); yaml.dump(object, writer); }
type: Answer
answers question: http://stackoverflow.com/q/24949505

http://stackoverflow.com/a/25140322
has comment: http://stackoverflow.com/comment/39179271
has body: As strictfp has been eliminated, I'll offer an idea. Some versions of Repast had / have bugs with certain random numbers being generated incorrectly*. Even with the random seed set to the same value, as your ArrayList is created and used at a different point in your code, it is possible that you are acting on the agents in it in a different order. This is particularly true if you have any scheduled method with random priority. It is also the case if you use getAgentList() or similar to populate your subAgents list. In effect you can generate a random number(/order) that is outside the RNG for which you set the seed. If there is a slight difference in order of execution, this could explain correspondence at one step only to see this small difference at other steps. I have had this happen and had similar headaches to your report when debugging. Happy to go into more detail if you can provide them. *It will help a lot to know which version you are using (I know I shouldn't ask for clarification in an answer, but haven't got the rep to comment). From the API you link, I think you are using the old Repast 3 - I use Simphony, but the answer may still apply.
has comment: http://stackoverflow.com/comment/39165671
answers question: http://stackoverflow.com/q/25047290
has comment: http://stackoverflow.com/comment/39165048
has comment: http://stackoverflow.com/comment/39144470
has comment: http://stackoverflow.com/comment/39204055
type: Answer
has comment: http://stackoverflow.com/comment/39144657
score: 0
has comment: http://stackoverflow.com/comment/39144739
has comment: http://stackoverflow.com/comment/39218132

http://stackoverflow.com/comment/38814365
score: 0
comment on: http://stackoverflow.com/q/24970176
type: Comment
type: QuestionComment
has text: so you mean pop-up until any positive value is entered no matter where ok, cancel and x button is clicked?

http://stackoverflow.com/comment/38836166
score: 0
comment on: http://stackoverflow.com/q/24980130
type: Comment
type: QuestionComment
has text: Also.. that is ***not an applet*** and therefore it cannot be deployed as one. And.. why use AWT components rather than Swing? See [this answer](http://stackoverflow.com/a/6255978/418556) for many good reasons to abandon AWT.

http://stackoverflow.com/comment/38886611
type: AnswerComment
has text: Are you trying to read some url and getting the data in gzip?
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25001113

http://stackoverflow.com/a/24954298
answers question: http://stackoverflow.com/q/24951311
score: 0
type: Answer
has body: Okay so I found the solution. You create a drawable array called layers like this: Drawable[] layers = {new ColorDrawable(0xff000044), new ClipDrawable(seekbardraw, Gravity.LEFT, ClipDrawable.HORIZONTAL)}; And then instead of customseekbar.setProgressDrawable(drawable); you use this: customseekbar.setProgressDrawable(new LayerDrawable(layers));
accepted answer of: http://stackoverflow.com/q/24951311
type: AcceptedAnswer

http://stackoverflow.com/q/24976250
has body: I am trying to make the program access a file name "highscore.txt", then: Write a new number in the file Get the lowest value of a list of numbers in the file. I am new to Java so I barely know how to even access the file. I got code that I believe should work, but when I run the program it says Exception in thread "main" java.util.InputMismatchException at java.util.Scanner.throwFor(Scanner.java:864) at java.util.Scanner.next(Scanner.java:1485) at java.util.Scanner.nextDouble(Scanner.java:2413) at game.game.main(game.java:91) Java Result: 1 Here is line 84 - 94, and the code I got. 84: Writer wr = new FileWriter("highscore.txt"); 85: wr.write(tries); 86: wr.close(); 87: lowest = tries; 88: File file = new File("highscore.txt"); 89: Scanner inputFile = new Scanner(file); 90: while (inputFile.hasNext()) { 91: numb = inputFile.nextDouble(); 92: if (numb &lt; lowest) lowest = number; 93: } 94: inputFile.close();
has comment: http://stackoverflow.com/comment/38825553
tagged with: inputmismatchexception
answer count: 1
has title: Program to get the lowest number in a file
favorite count: 0
downvote count: 5
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38825575
has comment: http://stackoverflow.com/comment/38825687
has comment: http://stackoverflow.com/comment/38826390
has comment: http://stackoverflow.com/comment/38825538
upvote count: 0
score: -5
has comment: http://stackoverflow.com/comment/38825567
tagged with: java
tagged with: file
has answer: http://stackoverflow.com/a/24976291
has comment: http://stackoverflow.com/comment/38825587
type: Question

http://stackoverflow.com/comment/38740416
has text: in your place i would consider what is not equal. If >0.00001 is fine for you then just copy/paste and change Less `<` to more `>` then make `Math.abs(a-StoreDatabasevalues.get("a"))>0.00001` this `Math.abs` is to make it always possitive in that case when `a<StoreDatabasevalues.get("a")`
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24930337
score: 0

http://stackoverflow.com/q/24989710
answer count: 2
tagged with: sql
tagged with: jpa
downvote count: 0
possible better answer: http://stackoverflow.com/a/48540497
favorite count: 0
upvote count: 28
has answer: http://stackoverflow.com/a/24989843
type: AnsweredQuestion
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/24989843
score: 28
tagged with: enums
has title: JPA enum comparison not equal fails
tagged with: comparison
has answer: http://stackoverflow.com/a/48540497
has body: I am using JPA 2.1.2. I want to execute a select query with a where clause. The where statement should compare (not equal) enums stored in database (string). @Entity @Table(name = "MY_ENTITY") public class MyEntity implements Serializable { @Column(name = "REMINDER_STATE") @Enumerated(EnumType.STRING) private ReminderStage reminderStage; ... } class DaoImpl{ .... @Override public List&lt;MyEntity&gt; findAll(ReminderStage stage) { return em.createQuery("SELECT c FROM MyEntity c WHERE c.reminderStage != :reminderStage", MyEntity.class) .setParameter("reminderStage", stage).getResultList(); } } But when I execute the query I get the following exception: ... [28.07.14 08:27:07:910 CEST] 0000004e SystemErr R Caused by: &lt;openjpa-2.1.2-SNAPSHOT-r422266:1530146 nonfatal user error&gt; org.apache.openjpa.persistence.ArgumentException: An error occurred while parsing the query filter 'SELECT c FROM CertInfo c WHERE c.reminderStage != :reminderStage'. Error message: org.apache.openjpa.kernel.jpql.TokenMgrError: Lexical error at line 1, column 50. Encountered: "!" (33), after : "" [28.07.14 08:27:07:910 CEST] 0000004e SystemErr R at org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder$ParsedJPQL.parse(JPQLExpressionBuilder.java:2449) [28.07.14 08:27:07:910 CEST] 0000004e SystemErr R at org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder$ParsedJPQL.&lt;init&gt;(JPQLExpressionBuilder.java:2432) [28.07.14 08:27:07:910 CEST] 0000004e SystemErr R at org.apache.openjpa.kernel.jpql.JPQLParser.parse(JPQLParser.java:49) [28.07.14 08:27:07:910 CEST] 0000004e SystemErr R at org.apache.openjpa.kernel.ExpressionStoreQuery.newCompilation(ExpressionStoreQuery.java:154) [28.07.14 08:27:07:910 CEST] 0000004e SystemErr R at org.apache.openjpa.kernel.QueryImpl.newCompilation(QueryImpl.java:672) [28.07.14 08:27:07:911 CEST] 0000004e SystemErr R at org.apache.openjpa.kernel.QueryImpl.compilationFromCache(QueryImpl.java:654) [28.07.14 08:27:07:911 CEST] 0000004e SystemErr R at org.apache.openjp…

http://stackoverflow.com/comment/38979294
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25039361
has text: Setsuna ammoQ already answered to your question. Trying to mix the two protocols is very easy, but it's a not a simulation as you call it.
score: 0

http://stackoverflow.com/q/25051431
has comment: http://stackoverflow.com/comment/38969560
has comment: http://stackoverflow.com/comment/38967562
answer count: 2
tagged with: maven
upvote count: 1
tagged with: java
tagged with: bukkit
has answer: http://stackoverflow.com/a/76991724
downvote count: 0
type: UnansweredQuestion
favorite count: 0
has title: NoClassDefFoundError during Maven Build
type: Question
has answer: http://stackoverflow.com/a/25609123
score: 1
has body: I'm attempting to make a Bukkit plugin with this tutorial: http://wiki.bukkit.org/Plugin_Tutorial Everything's great, except when I try to build the project with Maven in any way (Clean, Build, Test), it gives me this error: java.lang.NoClassDefFoundError: org/eclipse/osgi/internal/baseadaptor/DevClassPathHelper at org.eclipse.m2e.core.internal.embedder.MavenEmbeddedRuntime.addBundleClasspathEntries(MavenEmbeddedRuntime.java:193) at org.eclipse.m2e.core.internal.embedder.MavenEmbeddedRuntime.initClasspath(MavenEmbeddedRuntime.java:127) at org.eclipse.m2e.core.internal.embedder.MavenEmbeddedRuntime.createLauncherConfiguration(MavenEmbeddedRuntime.java:107) at org.eclipse.m2e.internal.launch.MavenRuntimeLaunchSupport.create(MavenRuntimeLaunchSupport.java:119) at org.eclipse.m2e.internal.launch.MavenLaunchDelegate.launch(MavenLaunchDelegate.java:70) at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:883) at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:739) at org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(DebugUIPlugin.java:1039) at org.eclipse.debug.internal.ui.DebugUIPlugin$8.run(DebugUIPlugin.java:1256) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54) Caused by: java.lang.ClassNotFoundException: org.eclipse.osgi.internal.baseadaptor.DevClassPathHelper cannot be found by org.eclipse.m2e.core_1.4.0.20130601-0317 at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:423) at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:336) at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:328) at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:160) at java.lang.ClassLoader.loadClass(Unknown Source) ... 10 more My pom.xml is as follows: 4.0.0 io.github.learning25 TestPlugin 0.0.1-SNAPSHOT org.apache.maven.plugins maven-compiler-plugin 1.7 1.7 bukkit-repo http://repo.bu…

http://stackoverflow.com/q/25060064
tagged with: android
has answer: http://stackoverflow.com/a/38433617
upvote count: 1
has answer: http://stackoverflow.com/a/25060403
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/38433617
tagged with: java
downvote count: 1
type: Question
has title: Trying to access the LauncherProvider
tagged with: android-contentprovider
has body: I am trying to access the LauncherProvider. You can find its source code here I tried to query this ContentProvider like this: Uri uri = new Uri.Builder().scheme("content").authority("com.android.launcher.settings").appendPath("favorites").build(); String[] projection = new String[]{ "_id", "title", "intent", "container", "screen", "cellX", "cellY", "spanX", "spanY", "itemType", "appWidgetId", "isShortcut", "iconType", "iconPackage", "iconResource", "icon", "uri", "displayMode" }; String selection = null; String[] selectionArgs = null; String sortOrder = ContactsContract.Contacts.DISPLAY_NAME + " COLLATE LOCALIZED ASC"; Cursor query = getActivity().getContentResolver().query(uri, projection, selection, selectionArgs, sortOrder); if (query != null) { while (query.moveToNext()) { Log.d(TAG, query.getString(2)); } } if (query != null) { query.close(); } However the Cursor I get is always null! This is the error I get in the logcat: 07-31 15:55:14.703 24773-24773/x.y.z.testE/ActivityThread﹕ Failed to find provider info for com.android.launcher.settings Can anybody tell me what I'm doing wrong?
accepted answer: http://stackoverflow.com/a/25060403
score: 0
answer count: 2
favorite count: 0

http://stackoverflow.com/a/24927546
has body: This is because you are creating new rows on a row index which already has values. You need to shift the existing rows 1 row down, so the index you want to insert a row is "free". In other words, "createRow()" will always create a new row and index x, no matter if there is already one. Use sheet.shiftRows(..) See: https://poi.apache.org/apidocs/org/apache/poi/hssf/usermodel/HSSFSheet.html#shiftRows(int, int, int) The first argument should be the index of the row where you want to insert something, the second one the number of your last row and the third one should be 1. So all rows beginning from x will be shifted one row down and you can insert your row at x. Example: every line is a row with content. 1 ---------------------- 2 ---------------------- 3 ---------------------- &lt; you want to insert a new row at index 3 4 ---------------------- 5 ---------------------- 6 ---------------------- 7 ---------------------- shiftRows(3,7,1) will do this: 1 ---------------------- 2 ---------------------- 3 empty row 4 ---------------------- &lt; your "old" row #3 5 ---------------------- 6 ---------------------- 7 ---------------------- 8 ---------------------- createRow(3), set cell values: 1 ---------------------- 2 ---------------------- 3 ////////////////////// &lt; your new row #3 witht he new content 4 ---------------------- &lt; your "old" row #3 5 ---------------------- 6 ---------------------- 7 ---------------------- 8 ----------------------
has comment: http://stackoverflow.com/comment/38734951
downvote count: 0
has comment: http://stackoverflow.com/comment/38735241
has comment: http://stackoverflow.com/comment/38735187
type: Answer
has comment: http://stackoverflow.com/comment/38734790
score: 6
has comment: http://stackoverflow.com/comment/38735108
has comment: http://stackoverflow.com/comment/38931484
answers question: http://stackoverflow.com/q/24927438
has comment: http://stackoverflow.com/comment/38734835
upvote count: 6

http://stackoverflow.com/q/25029290
has comment: http://stackoverflow.com/comment/38925652
has body: Hello i am stuck in my below mentioned code, the problem is, from buffer i am not able to get the url. My agenda is to get URL form a mail (user received a mail for registration and one URL is present in the mail to activate the account). import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.InputStreamReader; import java.util.Properties; import javax.mail.Flags; import javax.mail.Folder; import javax.mail.Message; import javax.mail.Session; import javax.mail.Store; import javax.mail.search.SubjectTerm; public class javamailtest { public static void main(String[] args) { javamailtest gmail = new javamailtest(); gmail.read(); } public void read() { Properties props = new Properties(); try { props.load(new FileInputStream(new File("D:\\smtp.properties"))); Session session = Session.getDefaultInstance(props, null); Store store = session.getStore("imaps"); store.connect("smtp.gmail.com", "dummy@dummy.com","dummy_password"); Folder inbox = store.getFolder("inbox"); inbox.open(Folder.READ_ONLY); int messageCount = inbox.getMessageCount(); System.out.println("Total Messages:- " + messageCount); /* * Message[] messages = inbox.getMessages(); * System.out.println("------------------------------"); for (int i * = 0; i &lt; 10; i++) { System.out.println("Mail Subject:- " + * messages[i].getSubject()); } */ Message[] messages2; messages2 = inbox.search(new SubjectTerm("hello avinash test"),inbox.getMessages()); System.out.println(messages2.length); for (int k = 0; k &lt; messages2.length; k++) { System.out.println(messages2[k].getSubject()); System.out.println(messages2[k].getContent().toString()); } for (Message mail : messages2) { if (!mail.isSet(Flags.Flag.SEEN)) { // it's Working here String line; StringBuffer buffer = new StringBuffer(); System.out.println("Buffer value:- "+buffer); BufferedReader reader = new BufferedReader( new InputStreamReader(mail.getInputStream())); // this function is also working and returning 12 lines w…
type: UnansweredQuestion
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/38925968
has title: java mail API, how to split buffer to get URL
has comment: http://stackoverflow.com/comment/38926121
answer count: 1
has comment: http://stackoverflow.com/comment/38926562
score: 0
has comment: http://stackoverflow.com/comment/38929428
has answer: http://stackoverflow.com/a/25029973

http://stackoverflow.com/comment/38983065
score: 0
type: AnswerComment
type: Comment
has text: @DavutÖzcan lets suppose that we have `short shortVal = 255; byte byteVal = shortVal;`, then the value of `byteVal` would be -1. If I do `byteVal & 0xFF` then the JVM do this: internally "converts" byteVal to int (of value -1) then it does the `&` bit op with 0xFF returning an integer value (255). In summary: not the same thing (byteVal = -1 and byteVal & 0xFF = 255)
comment on: http://stackoverflow.com/a/25059055

http://stackoverflow.com/q/24937901
has comment: http://stackoverflow.com/comment/38754515
has comment: http://stackoverflow.com/comment/38753618
tagged with: generics
has comment: http://stackoverflow.com/comment/38753537
favorite count: 0
has comment: http://stackoverflow.com/comment/38753679
has title: How to extend generic classes?
type: UnansweredQuestion
downvote count: 2
has answer: http://stackoverflow.com/a/24938110
upvote count: 1
has comment: http://stackoverflow.com/comment/38753886
tagged with: java
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/24938143
has comment: http://stackoverflow.com/comment/38753553
has comment: http://stackoverflow.com/comment/38754003
linked to: http://stackoverflow.com/q/6587621
has comment: http://stackoverflow.com/comment/38753774
score: -1
has comment: http://stackoverflow.com/comment/38754636
has body: I would like to make a class extend another class among several like this: class Special extends &lt; Class1&lt;type1&gt; , Class2&lt;Type2&gt;&gt; { // ToDo } I tried something like: class Special&lt;T1, T2, T3, T4&gt; extends &lt; T1&lt;T2&gt; , T3&lt;T4&gt;&gt; { // ToDo } Of course that syntax does not compile. How can I do that? EDIT 1 Let's be clear here: I do NOT want multiple inheritance. I would like my class to extend EITHER one super class, EITHER another one. For that I am asking if there is a possibility doing so using generics. The same way one can use generics for this special map of array: class MapArray&lt;T_KEY, T_VALUE&gt; extends LinkedHashMap&lt;T_KEY, ArrayList&lt;T_VALUE&gt;&gt; { } This code works an allows the user to put any type for T_KEY and T_VALUE. I would like to know whether is would be possible to use generics with classes. To put it more simply I would like to do that: class Special extends &lt; Either_this_class, Either_this_one &gt; { }
has comment: http://stackoverflow.com/comment/38754055

http://stackoverflow.com/q/24997381
score: 8
tagged with: apache
downvote count: 0
has comment: http://stackoverflow.com/comment/38865327
has body: I am trying to send a file to a server using HttpEntity HttpEntity mpEntity = MultipartEntityBuilder.create().addBinaryBody("file", file, ContentType.create("image/jpeg"), file.getName()).build(); However in order to use this I need to import the mime libraries to my project. When in my gradle.build I add: compile 'org.apache.httpcomponents:httpmime:4.3.4' I am getting the following errors warnings which result in the libraries not imported: WARNING: Dependency org.apache.httpcomponents:httpclient:4.3.4 is ignored for debug as it may be conflicting with the internal version provided by Android. In case of problem, please repackage it with jarjar to change the class packages Any ideas what I need to do so I can successfully import those libraries?
has comment: http://stackoverflow.com/comment/38865394
answer count: 1
has title: Android - Apache Mime & httpClient
linked to: http://stackoverflow.com/q/20673625
favorite count: 0
has answer: http://stackoverflow.com/a/25624647
upvote count: 8
tagged with: android
type: AnsweredQuestion
tagged with: java
tagged with: http
accepted answer: http://stackoverflow.com/a/25624647
type: Question

http://stackoverflow.com/q/25012265
tagged with: ant
tagged with: java
type: Question
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/25055258
favorite count: 0
has comment: http://stackoverflow.com/comment/38894990
tagged with: android
has comment: http://stackoverflow.com/comment/38895043
linked to: http://stackoverflow.com/q/17506525
has comment: http://stackoverflow.com/comment/39005412
score: 1
accepted answer: http://stackoverflow.com/a/25055258
upvote count: 1
has comment: http://stackoverflow.com/comment/38894740
has comment: http://stackoverflow.com/comment/38893903
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38895885
has body: My Android project has two external libraries: A and B. Using Ant command line to compile the Android project, I encountered the error below. Library A's path is D:\Workspace\library. I marked Project A as a library in project.properties file, which is the instruction from the post. However, it still doesn't work out. Clearly the compiling treats Project A not as a library and requires the file of classes.dex. Any more suggestions? Error: [dex] Converting compiled files and external libraries into d:\apk\compile\classes.dex... [dx] [dx] UNEXPECTED TOP-LEVEL EXCEPTION: [dx] java.io.FileNotFoundException: D:\Workspace\library\bin\classes.jar (系统找不到指定的文件。) [dx] at java.util.zip.ZipFile.open(Native Method) [dx] at java.util.zip.ZipFile.&lt;init&gt;(Unknown Source) [dx] at java.util.zip.ZipFile.&lt;init&gt;(Unknown Source) [dx] at java.util.zip.ZipFile.&lt;init&gt;(Unknown Source) [dx] at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:244) [dx] at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:166) [dx] at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:144) [dx] at com.android.dx.command.dexer.Main.processOne(Main.java:596) [dx] at com.android.dx.command.dexer.Main.processAllFiles(Main.java:498) [dx] at com.android.dx.command.dexer.Main.runMonoDex(Main.java:264) [dx] at com.android.dx.command.dexer.Main.run(Main.java:230) [dx] at com.android.dx.command.dexer.Main.main(Main.java:199) [dx] at com.android.dx.command.Main.main(Main.java:103) [dx] [dx] UNEXPECTED TOP-LEVEL EXCEPTION: [dx] java.io.FileNotFoundException: D:\Workspace\YimianBaseLib\bin\classes.jar (系统找不到指定的文件。) [dx] at java.util.zip.ZipFile.open(Native Method) [dx] at java.util.zip.ZipFile.&lt;init&gt;(Unknown Source) [dx] at java.util.zip.ZipFile.&lt;init&gt;(Unknown Source) [dx] at java.util.zip.ZipFile.&lt;init&gt;(Unknown Source) [dx] at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:244) [dx] at com.…
has comment: http://stackoverflow.com/comment/38894694
has title: Compiling error during using ant to release android package

http://stackoverflow.com/comment/38833167
comment on: http://stackoverflow.com/a/24979080
type: Comment
has text: I understand you.. But it seems like hibernate stoped read props in persistence.xml after i removed lines from your answer. And my mysql dtbase was cleared after i redeploy project without that lines. It seems to me what i need to move my hbmddl.auto and import props somewhere in my spring config xml. Sorry if I going wrong.
type: AnswerComment
score: 0

http://stackoverflow.com/q/24981186
has comment: http://stackoverflow.com/comment/39059367
tagged with: drag-and-drop
has comment: http://stackoverflow.com/comment/39050149
has answer: http://stackoverflow.com/a/25098158
tagged with: swing
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39061419
has body: I'm working with drag-and-drop. The user has to drag something from a list to somewhere else. However, the list will move when receiving a ListSelectionEvent, so when the user changes selection, he may unexpectedly perform a drag-and-drop. My code: import java.awt.*; import javax.swing.*; class Main { public static void createGUI() { JFrame f = new JFrame(); JList&lt;String&gt; list = new JList&lt;&gt;(new String[] { "Text A", "Text B" }); list.setFont(list.getFont().deriveFont(24f)); list.setDragEnabled(true); // list.setTransferHandler(new TransferHandler() { /* ... */ }); list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); list.addListSelectionListener(e -&gt; f.setLocation(f.getX(), f.getY() + f.getHeight())); list.setSelectedIndex(0); f.add(list, BorderLayout.CENTER); f.pack(); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.setLocationByPlatform(true); f.setVisible(true); } public static void main(String[] args) { SwingUtilities.invokeLater(Main::createGUI); } } To reproduce, launch this application, put it above some application that accepts a drop (e.g. Eclipse, Notepad++) and toggle the selection several times. I'm using Windows 7 and JDK 1.8.0_5. I tried but I couldn't find a work-around. How can I fix this issue? [Not really related] This is my real application: (including the green cross icon)
tagged with: java
has comment: http://stackoverflow.com/comment/38980765
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/25098158
has comment: http://stackoverflow.com/comment/38984253
has answer: http://stackoverflow.com/a/25101772
accepted answer: http://stackoverflow.com/a/25101772
has title: Handling drag-and-drop with a moving list
score: 0
has comment: http://stackoverflow.com/comment/39061187

http://stackoverflow.com/q/24930925
has comment: http://stackoverflow.com/comment/38740462
has comment: http://stackoverflow.com/comment/38740197
has body: I've created a java code to load OpenOffice document and want to prevent the user to close the document from the menu file / close. According to the document, it seems CloseVetoException would do the job. However, as I test the code, it seems not working at all. XCloseable xCloseable = (XCloseable)UnoRuntime.queryInterface(XCloseable.class, xTextDocument); //xTextDocument is an instance of com.sun.star.text.XTextDocument xCloseable.addCloseListener(new XCloseListener() { @Override public void disposing(EventObject event) { System.out.println("firing XCloseListener.disposing " + event.toString()); } @Override public void queryClosing(EventObject event, boolean arg1) throws CloseVetoException { System.out.println("firing MyCloseListener.queryClosing " + event.toString()); throw new CloseVetoException(); } @Override public void notifyClosing(EventObject event) { System.out.println("firing MyCloseListener.notifyClosing " + event.toString()); } }); While I'm trying to close the document from menu file / close, it seems the document window has been closed also, but notifyClosing and disposing did not fired.
tagged with: openoffice.org
answer count: 0
has comment: http://stackoverflow.com/comment/38771361
type: UnansweredQuestion
tagged with: java
type: Question
score: 0
has title: How to programmatically prevent closing OpenOffice from the menu File / Close?

cachedrowset
type: Tag
tag name: cachedrowset
tags question: http://stackoverflow.com/q/24927066

http://stackoverflow.com/comment/38827196
has text: Wrote stack traces to '/data/anr/traces.txt' That line only occurs when a C component has caused a signal to the linux kernel that is unrecoverable. In short, a crash.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24976683

http://stackoverflow.com/comment/39709924
has text: Usually the reason for this is a key problem (all elements having the same key, and hence only the first one is selected). But then it shouldn't work outside the Grid, either. You should post your EnumModelKeyProvider and EnumLabelProvider implementations, and also the code where you add your ComboBox to the Grid(Editing).
comment on: http://stackoverflow.com/q/24910863
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24994213
type: Answer
has body: How about instead of just DestinationQueueName String place to the headers the com.ibm.mq.jms.MQQueue Object and with those options, of course?
answers question: http://stackoverflow.com/q/24993973
score: 0

http://stackoverflow.com/a/25051776
has body: try @AttributeOverride( name="name", column = @Column(name="new_name", unique=true) on your subclass. And then you have to change your column 'name' to 'new_name' in db for the table on which subclass is mapped
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/56081202
accepted answer of: http://stackoverflow.com/q/25051190
answers question: http://stackoverflow.com/q/25051190
upvote count: 2
has comment: http://stackoverflow.com/comment/38968201
has comment: http://stackoverflow.com/comment/38968645
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/25004103
downvote count: 1
has body: public class Agent{ public static void main(String...args){ String input = "1 23 35 5d 8 0 f"; List&lt;Integer&gt; intList = new ArrayList&lt;Integer&gt;(); Arrays.asList(input.split(" ")).stream().forEach( i -&gt; { try{ intList.add(Integer.parseInt(i)); }catch(Exception ex){ } }); intList.forEach( i -&gt; System.out.print(" " + i)); } } Output: 1 23 35 8 0
has comment: http://stackoverflow.com/comment/38926755
has comment: http://stackoverflow.com/comment/38879399
type: Answer
has comment: http://stackoverflow.com/comment/38880353
has comment: http://stackoverflow.com/comment/38925908
has comment: http://stackoverflow.com/comment/38878417
answers question: http://stackoverflow.com/q/25003550
score: 0
upvote count: 1

http://stackoverflow.com/comment/38808376
comment on: http://stackoverflow.com/a/24966903
score: 0
type: AnswerComment
has text: So basically this problem is related to the API key for android application?
type: Comment

http://stackoverflow.com/comment/38992997
has text: Assuming your question is about pasting, where's your code for pasting? It doesn't make any sense to post code for something that's working when your problem is with code that *isn't* working.
comment on: http://stackoverflow.com/q/25064999
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24969904
has body: Is Person @Table(name="testdb") correct? Why it isn't @Table(name="names")? Beside that looking at your code Query query = session.createQuery("from testdb"); should be Query query = session.createQuery("from Person"); because HQL query works using @Entity, not raw tables (and this is the reason for testdb is not mapped [from testdb] because testdb is not an @Entity)
has comment: http://stackoverflow.com/comment/38813687
upvote count: 1
type: AcceptedAnswer
type: Answer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24969326
score: 1
answers question: http://stackoverflow.com/q/24969326

http://stackoverflow.com/q/24969518
has answer: http://stackoverflow.com/a/24979451
answer count: 1
tagged with: time
has comment: http://stackoverflow.com/comment/38813374
type: UnansweredQuestion
tagged with: android
tagged with: java
has comment: http://stackoverflow.com/comment/38819546
has comment: http://stackoverflow.com/comment/38815430
has title: How to display updating custom time in textview
type: Question
linked to: http://stackoverflow.com/q/10207612
has comment: http://stackoverflow.com/comment/38815059
tagged with: updating
score: 0
has body: Currently i am listening for android.intent.action.TIME_TICK to show the current system time in a TextView, thats working perfectly. Now i need to do something different. Once when my app is starting it gets a string with a time in it (for example: "15:30". I need to display this time in a TextView also and it must update itself like it is the real local time. To make it more clear, it's like you manually set androids system time to something you specify, like your own timezone. I don't know how to achieve this with the Date/Time object and how to increase it every 1 minute. Anybody has some tips on how to achieve this? Maybe i miss something really easy to create my own custom clock

http://stackoverflow.com/comment/38872941
has text: This is dealing with AWT / Swing images, the question is asking about SWT Images which are not the same thing.
type: Comment
score: 2
type: AnswerComment
comment on: http://stackoverflow.com/a/25000860

http://stackoverflow.com/comment/41119562
comment on: http://stackoverflow.com/q/24954242
has text: Sounds like you are getting exactly this problem: http://stackoverflow.com/questions/5278707/videoview-getdrawingcache-is-returning-black
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38739581
type: Comment
has text: You need full permissions to access the file system. Does your program have that? Even so, I do not think java webstart use certificates in the same way as stand alone programs.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/24927623

http://stackoverflow.com/q/25049909
has body: So basically I have a simple remove function that takes students out of my list if the IDs are matching. When writing this method I use == since s.getId() returns a primitive type. But I wrote a .equals method that should override it but now I can't call the .equals on s.getId(). equals method in class Student: public boolean equals(StudentIF other) { if (other == null) { return false; } if (this.id == other.getId()) { return true; } return false; } and then my remove method which is in class LL: public boolean remove(StudentIF s) { // TODO Auto-generated method stub StudentLLNode current = head; if (s == null) { return false; } if (s.getId() == (head.getStd().getId())) { // StudentLLNode top = head; head = head.getNext(); size--; return true; } else { StudentLLNode previous, next; previous = current; next = current.getNext(); while (current != null) { next = current.getNext(); if (s.getId() == (current.getStd().getId())) { previous.setNext(next); size--; return true; } previous = current; current = next; } } return false; }
type: Question
answer count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/38964616
favorite count: 0
has title: Overriding a .equals() method
tagged with: equals
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25049992
upvote count: 1
has answer: http://stackoverflow.com/a/25049998
has comment: http://stackoverflow.com/comment/38964558
tagged with: linked-list
score: 1
tagged with: java

http://stackoverflow.com/comment/38715937
type: QuestionComment
has text: @Jonathon Done, I thought it might be useful to provide some context into how im using the offset
score: 0
comment on: http://stackoverflow.com/q/24916103
type: Comment

http://stackoverflow.com/q/24933903
upvote count: 6
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24938116
has title: libgdx with displaying Cyrillic
type: Question
has body: I have the following problem with libgdx displaying Cyrillic. I give an example: this works: System.out.println("абцдеф"); but it shows nothing: field = new TextField("абцдеф", style); And tried without success. try { mmm = new String(t.getBytes(), "UTF-8"); } catch (UnsupportedEncodingException e) { // Will it ever be thrown? } field = new TextField(mmm, style); I'll be glad if someone has a solution, many, many will be grateful.
tagged with: libgdx
linked to: http://stackoverflow.com/q/9486446
tagged with: java
score: 6
tagged with: encoding
downvote count: 0
answer count: 1
linked to: http://stackoverflow.com/q/17057787
has answer: http://stackoverflow.com/a/24938116
favorite count: 0

http://stackoverflow.com/q/24923901
has answer: http://stackoverflow.com/a/24923944
accepted answer: http://stackoverflow.com/a/24923935
has title: How to make sure that points drawn on JFrame at random location does not overlap already drawn shapes?
tagged with: swing
type: AnsweredQuestion
tagged with: java
type: Question
has body: I am creating 100 particles at random location all over my JPanel using random function to calculate x and y. But I have two rectangles also drawn on the panel and I do not want my points to overlap on that area. Is there any way, by which I can create the particles all over the JPanel except those areas covered by rectangle? int x,y=0; super.paintComponent(g); for(int i=0;i&lt;list.size();i++) { x=randomInteger(11,670); // bounds of x between which the particles should be generated (reduced by 1 each) y=randomInteger(11,440); // bounds of y between which the particles should be generated (reduced by 1 each) int radius = 4; g.fillOval(x, y, radius, radius); } x=randomInteger(11,670); y=randomInteger(11,440); drawRobot(g,x,y,50); createObstacles(g,150,225,100,40); createObstacles(g,500,300,40,100); int xpoints[] = {50, 40, 60, 120}; int ypoints[] = {50, 75, 100, 130}; int npoints = 4; createPolygonObstacle(g,xpoints,ypoints,npoints); } private void createPolygonObstacle(Graphics g, int xpoints[], int ypoints[], int npoints) { g.fillPolygon(xpoints, ypoints, npoints); } private void createObstacles(Graphics g, int x, int y, int width, int height) { g.setColor(Color.BLACK); g.fillRect(x, y, width, height); } private void drawRobot(Graphics g, int x, int y, int radius) { g.setColor(Color.GREEN); g.fillOval(x, y, radius, radius); } private static int randomInteger(int min, int max) { Random rand = new Random(); int randomNum = rand.nextInt((max - min) + 1) + min; return randomNum; }
has answer: http://stackoverflow.com/a/24923935
score: 0
answer count: 2
possible better answer: http://stackoverflow.com/a/24923944

http://stackoverflow.com/q/24934291
tagged with: android-intent
downvote count: 1
accepted answer: http://stackoverflow.com/a/24934352
type: AnsweredQuestion
tagged with: android-arrayadapter
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: Question
has title: Getting java.lang.NullPointerException running android app
has body: I don't know what is going on, I can't run my app. What it does is take some information data from the API and list it in a listview, I think something is wrong with my ClienteActivity, but I don't know what. java.lang.RuntimeException: Unable to start activity ComponentInfo{com.android/com.android.MainActivity}: java.lang.NullPointerException at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2198) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2257) at android.app.ActivityThread.access$800(ActivityThread.java:139) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1210) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:136) at android.app.ActivityThread.main(ActivityThread.java:5086) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:515) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601) at dalvik.system.NativeStart.main(Native Method) **Caused by: java.lang.NullPointerException at com.android.MainActivity.onCreate(MainActivity.java:40)** at android.app.Activity.performCreate(Activity.java:5248) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1110) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2162) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2257) at android.app.ActivityThread.access$800(ActivityThread.java:139) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1210) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:136) at android.app.ActivityThread.main(ActivityThread.java:5086) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:515) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785) at com.andr…
has comment: http://stackoverflow.com/comment/38746687
possible better answer: http://stackoverflow.com/a/24934419
has answer: http://stackoverflow.com/a/24934420
has answer: http://stackoverflow.com/a/24934419
favorite count: 0
answer count: 3
tagged with: android
has answer: http://stackoverflow.com/a/24934352
score: 0
upvote count: 1

http://stackoverflow.com/q/24995208
answer count: 0
has comment: http://stackoverflow.com/comment/38861828
tagged with: java
has comment: http://stackoverflow.com/comment/38862992
type: Question
tagged with: tiles-3
tagged with: jsp
tagged with: struts2
has body: for now I want to use tiles3 in struts2, I use this listener: org.apache.tiles.extras.complete.CompleteAutoloadTilesListener which lead me to download a lot of jar files: velocity, mustache etc. those lib/jar I don't need in my project. for performance and easy to use, is there a simple way to use tiles3 in struts2 ?
score: 0
tagged with: tiles
has comment: http://stackoverflow.com/comment/38872465
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38991525
has comment: http://stackoverflow.com/comment/38872661
has comment: http://stackoverflow.com/comment/38861217
has title: I have to download volecity/mustache etc, Is there a simple way to start/use tile3?
has comment: http://stackoverflow.com/comment/38867270

http://stackoverflow.com/comment/38907652
has text: So i can download all the apache jars i need,put them under one folder and add that folder to the `;` delimited list of paths?
type: AnswerComment
comment on: http://stackoverflow.com/a/25019633
type: Comment
score: 0

http://stackoverflow.com/a/24917955
has comment: http://stackoverflow.com/comment/38717993
score: 2
has comment: http://stackoverflow.com/comment/38720059
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24917787
has comment: http://stackoverflow.com/comment/38718855
answers question: http://stackoverflow.com/q/24917787
has comment: http://stackoverflow.com/comment/38717762
upvote count: 2
has comment: http://stackoverflow.com/comment/38724368
type: AcceptedAnswer
has body: I tried this program below and got an eror Type mismatch: T cannot be converted to Object: public class DispatchTest { private void bar( HashMap&lt;String, Object&gt; map ) { } public static void main( String[] args ) { test(); } private static &lt;T&gt; void test() { DispatchTest dt = new DispatchTest(); HashMap&lt;String,T&gt; map = new HashMap&lt;&gt;(); dt.bar( map ); } } So I guess it's the generics that are messing you up. Change the type of the parameter from Object to ?, that worked for me. private void bar( HashMap&lt;String, ?&gt; map ) { } Edit: Just to elaborate on this a bit, I put the code back to the original, and added a method like in your example bar(Object...). Here's the Java byte codes that are produced: private static &lt;T extends java/lang/Object&gt; void test(); Code: 0: new #3 // class quicktest/DispatchTest 3: dup 4: invokespecial #4 // Method "&lt;init&gt;":()V 7: astore_0 8: new #5 // class java/util/HashMap 11: dup 12: invokespecial #6 // Method java/util/HashMap."&lt;init&gt;":()V 15: astore_1 16: aload_0 17: iconst_1 18: anewarray #7 // class java/lang/Object 21: dup 22: iconst_0 23: aload_1 24: aastore 25: invokevirtual #8 // Method bar:([Ljava/lang/Object;)V 28: return You can see in this case the decision has already been made that the Map parameter is not appropriate and the invokevirtual byte code on line 25 wants the Object... version of the call. That's done at compile time, not runtime. If I change the code back to my suggestion (using Map&lt;String,?&gt;), then the invokevirual byte code asks for the Map parameter. Your version works too because the cast forces the compiler to emit the invokevirtual for the Map, not the Object... it would normally resolve to.
has comment: http://stackoverflow.com/comment/38719317
has comment: http://stackoverflow.com/comment/38724269
type: Answer

list
type: Tag
tags question: http://stackoverflow.com/q/24961701
tags question: http://stackoverflow.com/q/25002458
tags question: http://stackoverflow.com/q/25057117
tags question: http://stackoverflow.com/q/25021611
tags question: http://stackoverflow.com/q/24949018
tags question: http://stackoverflow.com/q/24962521
tag name: list
tags question: http://stackoverflow.com/q/25038889
tags question: http://stackoverflow.com/q/25051305
tags question: http://stackoverflow.com/q/24917053
tags question: http://stackoverflow.com/q/25033405
tags question: http://stackoverflow.com/q/24978336
tags question: http://stackoverflow.com/q/24978382
tags question: http://stackoverflow.com/q/24956379
tags question: http://stackoverflow.com/q/24976350
tags question: http://stackoverflow.com/q/24944454
tags question: http://stackoverflow.com/q/25066508
tags question: http://stackoverflow.com/q/25018294
tags question: http://stackoverflow.com/q/25010850
tags question: http://stackoverflow.com/q/25069049
tags question: http://stackoverflow.com/q/24953353

hibernate
tags question: http://stackoverflow.com/q/24967074
tags question: http://stackoverflow.com/q/25015689
tags question: http://stackoverflow.com/q/25048199
tags question: http://stackoverflow.com/q/25057510
tags question: http://stackoverflow.com/q/24990836
tags question: http://stackoverflow.com/q/25053931
tags question: http://stackoverflow.com/q/25058559
tags question: http://stackoverflow.com/q/25067844
tags question: http://stackoverflow.com/q/25046843
tags question: http://stackoverflow.com/q/24981066
tags question: http://stackoverflow.com/q/24926401
tags question: http://stackoverflow.com/q/24986352
tags question: http://stackoverflow.com/q/25006764
tags question: http://stackoverflow.com/q/25041715
tags question: http://stackoverflow.com/q/25067538
tags question: http://stackoverflow.com/q/24913111
tags question: http://stackoverflow.com/q/25048852
tags question: http://stackoverflow.com/q/24934187
tags question: http://stackoverflow.com/q/25051831
tags question: http://stackoverflow.com/q/24956830
tags question: http://stackoverflow.com/q/24921269
tags question: http://stackoverflow.com/q/25005315
tags question: http://stackoverflow.com/q/24917093
tags question: http://stackoverflow.com/q/24960817
tags question: http://stackoverflow.com/q/25050792
tags question: http://stackoverflow.com/q/25033896
tags question: http://stackoverflow.com/q/24986850
tags question: http://stackoverflow.com/q/24995881
tags question: http://stackoverflow.com/q/25032280
tags question: http://stackoverflow.com/q/24929108
tags question: http://stackoverflow.com/q/25025458
tags question: http://stackoverflow.com/q/24950909
tags question: http://stackoverflow.com/q/24926661
tags question: http://stackoverflow.com/q/24926438
tags question: http://stackoverflow.com/q/24922294
tags question: http://stackoverflow.com/q/24976701
tags question: http://stackoverflow.com/q/24914370
tags question: http://stackoverflow.com/q/25039632
tags question: http://stackoverflow.com/q/24923882
tags question: http://stackoverflow.com/q/25028875
tags question: http://stackoverflow.com/q/25037380
tags question: http://stackoverflow.com/q/24958897
tags question: http://stackoverflow.com/q/24920846
tags question: http://stackoverflow.com/q/24957513
tags question: http://stackoverflow.com/q/25020393
tags question: http://stackoverflow.com/q/25067428
tags question: http://stackoverflow.com/q/24910042
tags question: http://stackoverflow.com/q/24938385
tags question: http://stackoverflow.com/q/25038411
tags question: http://stackoverflow.com/q/24999652
tags question: http://stackoverflow.com/q/24944783
tags question: http://stackoverflow.com/q/24947534
tags question: http://stackoverflow.com/q/25007457
tags question: http://stackoverflow.com/q/24909533
tags question: http://stackoverflow.com/q/25047226
tags question: http://stackoverflow.com/q/24933832
tags question: http://stackoverflow.com/q/25054977
tags question: http://stackoverflow.com/q/25016272
tag name: hibernate
tags question: http://stackoverflow.com/q/24991957
tags question: http://stackoverflow.com/q/24975813
tags question: http://stackoverflow.com/q/24982217
tags question: http://stackoverflow.com/q/25033898
tags question: http://stackoverflow.com/q/24951425
tags question: http://stackoverflow.com/q/25003365
tags question: http://stackoverflow.com/q/25053792
tags question: http://stackoverflow.com/q/25048744
tags question: http://stackoverflow.com/q/24914788
tags question: http://stackoverflow.com/q/24958214
tags question: http://stackoverflow.com/q/25063995
tags question: http://stackoverflow.com/q/25054652
tags question: http://stackoverflow.com/q/25052457
tags question: http://stackoverflow.com/q/25008359
tags question: http://stackoverflow.com/q/24918237
tags question: http://stackoverflow.com/q/24916266
tags question: http://stackoverflow.com/q/25033556
tags question: http://stackoverflow.com/q/25044983
tags question: http://stackoverflow.com/q/25062806
tags question: http://stackoverflow.com/q/24916104
tags question: http://stackoverflow.com/q/24924112

http://stackoverflow.com/a/24933536
has comment: http://stackoverflow.com/comment/123937874
has comment: http://stackoverflow.com/comment/38747203
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24933368
has comment: http://stackoverflow.com/comment/38746806
answers question: http://stackoverflow.com/q/24933368
has comment: http://stackoverflow.com/comment/38747092
type: Answer
score: 13
downvote count: 0
has body: Java provides a generic collection called IdentityHashMap&lt;K,V&gt;, which breaks Liskov substitution principle - the "L" in SOLID by intentionally violating Map&lt;K,V&gt;'s contract. Here is a note from the documentation of the IdentityHashMap&lt;K,V&gt; class: This class is not a general-purpose Map implementation! While this class implements the Map interface, it intentionally violates Map's general contract, which mandates the use of the equals method when comparing objects. This class is designed for use only in the rare cases wherein reference-equality semantics are required.
upvote count: 13

http://stackoverflow.com/q/24995723
tagged with: timer
has title: How to set swing timer to execute at start
linked to: http://stackoverflow.com/q/1432766
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24995788
duplicate of: http://stackoverflow.com/q/1432766
score: 0
tagged with: java
tagged with: listeners
tagged with: swing
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/24995782
has body: I have the following code to display current time in swing application. private void startClock(StateBar stateBar) { ActionListener listener = new ActionListener() { public void actionPerformed(ActionEvent event) { stateBar.setTime(Clock.currentDateStr()); } }; timer = new Timer(1000,listener); timer.start(); } But it seems to execute listener code not at timer start but after one second from start. I mean when I open the panel with my clock the date appears with 1 second delay. Is it possible to fire execution on my code immediately at start of the timer?

http://stackoverflow.com/comment/38815939
score: 0
comment on: http://stackoverflow.com/a/24970966
type: AnswerComment
type: Comment
has text: Ok, I'm going to see! Thank you! :)

http://stackoverflow.com/a/24980619
answers question: http://stackoverflow.com/q/24980333
downvote count: 0
type: Answer
has body: In order to call wait on obj that method/code block should synchronised on obj void waitForSignal() { Object obj = new Object(); synchronized (obj) { obj.wait(); obj.notify(); } }
score: 2
upvote count: 2

http://stackoverflow.com/q/24980097
has comment: http://stackoverflow.com/comment/62695814
answer count: 1
upvote count: 13
has body: I'm working on creating a simulated VPN (Doesn't actually create a real connection to server) to get all incoming and outgoing network bytes (information). For now i can get packets and parse them. What i get for example: IP Version:4 Header Length:20 Total Length:60 Protocol:6 Source IP:10.0.2.0 Destination IP:5.20.5.59 Hostname:clients4.google.com I would like to know what and how should i do to make connections to websites/applications (For now it doesn't connect). In this website: http://www.thegeekstuff.com/2014/06/android-vpn-service/ writes that it is needed to make these steps: Get IP packet from TUN. Same as all VPN service does. Extract layer 4 information. Protocol type (e.g. TCP/UDP) and its payload is a must. As there is a handshake procedure in TCP, before getting actually payload data from it, we need to write back handshake packet first. Choose corresponding socket to send out the payload. As this step is working on layer 4, so we need to save the socket and try to get return data later. If there is any return data, we need to pass these packet to TUN. Get packet from socket, and build a layer 3 packet. First, we need to build a valid layer 4 packet. UDP is a bit easier as the 4 byte UDP header only contains source address, source port, destination address, destination port. TCP is more complex as it’s a state connection, the sequence number and acknowledge number should be properly set. Then, use the layer 4 packet as payload, we need to build a valid layer 3 packet. Write IP packet back to TUN. Same as all VPN service does. At 2 step i get information from packet. But don't undearstand how it should be done further. Maybe someone can explain me in detail. Plus maybe can tell me how to get destinations Port when i have its IP address. Also there is the code: public class VPN extends VpnService implements Handler.Callback, Runnable { private static final String TAG = "VpnService"; private String mServerAddress = "127.0.0.1"; private int mServerPort =…
tagged with: android
favorite count: 0
tagged with: parsing
type: UnansweredQuestion
downvote count: 1
tagged with: vpn
has comment: http://stackoverflow.com/comment/62720552
tagged with: java
has answer: http://stackoverflow.com/a/37619282
type: Question
tagged with: ip
score: 12
has title: VPN packet bypass
has comment: http://stackoverflow.com/comment/62828041

http://stackoverflow.com/comment/38973012
type: Comment
comment on: http://stackoverflow.com/q/25054482
score: 0
has text: Looks like the image is not found. can you show your project layout? where is the jpg and teh class located? Try `JpegToArray.class.getResource("/img/abc.jpg")`
type: QuestionComment

http://stackoverflow.com/a/25048279
type: Answer
answers question: http://stackoverflow.com/q/25037914
score: 0
has body: public String makeServiceCall(String url, int method, List&lt;NameValuePair&gt; params) { try { // http client DefaultHttpClient httpClient = new DefaultHttpClient(); HttpEntity httpEntity = null; HttpResponse httpResponse = null; // Checking http request method type if (method == POST) { HttpPost httpPost = new HttpPost(url); // adding post params if (params != null) { httpPost.setEntity(new UrlEncodedFormEntity(params)); } httpResponse = httpClient.execute(httpPost); } else if (method == GET) { // appending params to url if (params != null) { String paramString = URLEncodedUtils.format(params, "utf-8"); url += "?" + paramString; } HttpGet httpGet = new HttpGet(url); httpResponse = httpClient.execute(httpGet); } httpEntity = httpResponse.getEntity(); response = EntityUtils.toString(httpEntity); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } catch (ClientProtocolException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } return response; } To use PUT method to Send Message to Web Server use NameValuePair : List&lt;NameValuePair&gt; myProfileList = new ArrayList&lt;NameValuePair&gt;(7); try { myProfileList.add(new BasicNameValuePair("Name", "Your Name")); myProfileList.add(new BasicNameValuePair("Age", "Your Age ")); } catch (Exception e) { e.printStackTrace(); }

http://stackoverflow.com/comment/38852234
type: Comment
comment on: http://stackoverflow.com/a/24990309
type: AnswerComment
has text: @james I did not see the comments, yes. It is true. If I were coding the OP program I would use replace as I answered.
score: 0

http://stackoverflow.com/comment/38755918
has text: Where's the code with `String.format`?
comment on: http://stackoverflow.com/q/24939084
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39045132
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25051184
type: QuestionComment
has text: Hm. This is not possible, because I can not influence the interfaces and their implementations. So I guess the answer is is simply: No, it is not possible.

http://stackoverflow.com/a/25034172
answers question: http://stackoverflow.com/q/25033898
downvote count: 0
has comment: http://stackoverflow.com/comment/38935362
type: Answer
has comment: http://stackoverflow.com/comment/38934481
score: 1
upvote count: 1
has body: I think you could achieve this using the in clause: query = entityManager.createQuery( "DELETE FROM MessageFolder " + "WHERE id NOT in (" + "SELECT distinct parentFolder.id FROM MessageFolder" + ") "); rowsAffected = query.executeUpdate();

http://stackoverflow.com/a/25074443
type: Answer
accepted answer of: http://stackoverflow.com/q/24933819
answers question: http://stackoverflow.com/q/24933819
score: 0
type: AcceptedAnswer
has body: Problem IBM Was use own axis framework for web service client. Problem is when you use third part library for web service client, (axis2, jax-ws) client code is generated by third part library. There can be a discrepancy between generated code and was ws library. Solution Use local classloader first for your application. (WAS administration console) Enterprise Applications > "your_app" > Manage Modules > "module_name" > Custom properties add: com.ibm.websphere.webservices.DisableIBMJAXWSEngine = true Enterprise Applications > "your_app" > Manage Modules > "module_name" select: "local classloader first (parent last)" Enterprise Applications > "your_app" > Class loader tick: Override class reloading settings for Web and EJB modules tick: Classes loaded with local class loader first (parent last) tick: Class loader for each WAR file in application

http://stackoverflow.com/comment/38947845
type: Comment
comment on: http://stackoverflow.com/q/25041104
type: QuestionComment
score: 0
has text: Take a screenshot of your directory structure within android studio

linux
tags question: http://stackoverflow.com/q/24987649
tags question: http://stackoverflow.com/q/24984274
tags question: http://stackoverflow.com/q/24945184
tags question: http://stackoverflow.com/q/24917902
tags question: http://stackoverflow.com/q/24921708
tags question: http://stackoverflow.com/q/24996664
tags question: http://stackoverflow.com/q/24951059
tags question: http://stackoverflow.com/q/25062983
type: Tag
tags question: http://stackoverflow.com/q/24926430
tags question: http://stackoverflow.com/q/24958303
tags question: http://stackoverflow.com/q/25051278
tags question: http://stackoverflow.com/q/24917253
tags question: http://stackoverflow.com/q/25009276
tags question: http://stackoverflow.com/q/24963117
tags question: http://stackoverflow.com/q/24913320
tags question: http://stackoverflow.com/q/25030212
tag name: linux
tags question: http://stackoverflow.com/q/25003724
tags question: http://stackoverflow.com/q/25028123
tags question: http://stackoverflow.com/q/25069301
tags question: http://stackoverflow.com/q/24996017
tags question: http://stackoverflow.com/q/24962302
tags question: http://stackoverflow.com/q/24917240
tags question: http://stackoverflow.com/q/24941686
tags question: http://stackoverflow.com/q/25005122
tags question: http://stackoverflow.com/q/25001079
tags question: http://stackoverflow.com/q/25010314
tags question: http://stackoverflow.com/q/24962077

http://stackoverflow.com/q/24966453
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/38807570
has comment: http://stackoverflow.com/comment/38807485
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24966468
tagged with: android
has comment: http://stackoverflow.com/comment/38808191
has body: I'm following the instructions from the official android site to create my first android app. When I click the button to "send" a message, the app crashes. MainActivity: package com.example.myfirstapp; import android.content.Intent; import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v7.app.ActionBarActivity; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.widget.EditText; public class MainActivity extends ActionBarActivity { public final static String EXTRA_MESSAGE = "com.example.myfirstapp.MESSAGE"; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); if (savedInstanceState == null) { getSupportFragmentManager().beginTransaction() .add(R.id.container, new PlaceholderFragment()).commit(); } } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } /** * A placeholder fragment containing a simple view. */ public static class PlaceholderFragment extends Fragment { public PlaceholderFragment() { } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_main, container, false); return rootView; } } /** Called when the user clicks the Send button */ public void sendMessage(View view) { // Do something in response to button Intent intent = ne…
has title: My First App crashes when I click button?
tagged with: java
has comment: http://stackoverflow.com/comment/38807275
upvote count: 1
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/38807683
has comment: http://stackoverflow.com/comment/38807476
has comment: http://stackoverflow.com/comment/38807295
has comment: http://stackoverflow.com/comment/38808161
has comment: http://stackoverflow.com/comment/38808371
linked to: http://stackoverflow.com/q/3988788

http://stackoverflow.com/q/24998832
favorite count: 0
upvote count: 2
possible better answer: http://stackoverflow.com/a/24999005
has comment: http://stackoverflow.com/comment/38868057
has body: I should implement a four method to handle one specific objective for different types. I couldnot find a logical way how to implement it. At below code, should I create a abstract and extend relationship or just put them into one class and use method overriding ? What do I want to manage is that just call(argument). Internally, below methods should be called: call foo(String argument) if argument is in type of String call foo(Map argument) if argument is in type of Map call foo(Integer[] argument) if argument is in type of Array of Integer
has answer: http://stackoverflow.com/a/24999005
accepted answer: http://stackoverflow.com/a/24999037
has title: How to implement one method with different argument types?
has comment: http://stackoverflow.com/comment/38868206
has comment: http://stackoverflow.com/comment/38867922
type: AnsweredQuestion
tagged with: oop
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/38867849
has comment: http://stackoverflow.com/comment/38867986
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/38868274
has answer: http://stackoverflow.com/a/24999037
answer count: 2
has comment: http://stackoverflow.com/comment/38868930
has comment: http://stackoverflow.com/comment/38867899

http://stackoverflow.com/q/25062653
duplicate of: http://stackoverflow.com/q/1393004
type: UnansweredQuestion
has body: I want to write a program in python that writes a string to a file in a manner that a java application can read it. This java application reads the string in modified UTF-8 format (see this question). It basically means that all unicode characters have to be written as surrogate characters aka UTF-16BE. Is there a graceful, effective method that can do this. I have tried the following to do so: import re; o_string = b'' for splitter in re.split("([\U00010000-\U0010FFFF])", w_string): if len(splitter) == 1 and ord(splitter) &gt; 0xFFFF: o_string += splitter.encode("UTF-16") else: o_string += splitter.decode("UTF-8") print(o_string) But this seems so bulky (also it uses regex which seems to be en easy to dodge overhead). Can someone propose a better solution to this?
upvote count: 1
has comment: http://stackoverflow.com/comment/38990305
tagged with: python
linked to: http://stackoverflow.com/q/7921016
has title: Unicode: Automatically detect high characters and convert them to surrogate pairs
answer count: 0
score: 1
tagged with: java
type: Question
downvote count: 0
tagged with: unicode
linked to: http://stackoverflow.com/q/1393004
tagged with: utf-8
favorite count: 0

http://stackoverflow.com/comment/38720669
type: AnswerComment
comment on: http://stackoverflow.com/a/24919914
type: Comment
score: 0
has text: @user3437460 I would like to find phone numbers for all countries/regions of the world that may appear in text stream.

http://stackoverflow.com/comment/38910958
score: 0
has text: I don't want to lose the client.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25021285

http://stackoverflow.com/comment/38916355
score: 1
has text: "*i need to split it an array of string removing `#` and `@`*" — How should the final array look like?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25024086

http://stackoverflow.com/comment/38996935
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25062451
score: 1
has text: Well yes, in that you'd need to work out how you wanted to store them. I'm assuming you want to store one byte per int, if they're all in that range...

http://stackoverflow.com/a/24957466
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/24957294
downvote count: 0
type: Answer
has body: You can use a ThreadPoolExecutor (http://docs.oracle.com/javase/7/docs/api/java/util/concurrent/ThreadPoolExecutor.html) initialized with a set number of threads when it is created.

http://stackoverflow.com/comment/38834570
score: 0
type: Comment
type: QuestionComment
has text: Actually I am a java trainer, I need to explain about `JNDI` directory services, But I do not know any thing about this. So I need some guidance, what is `JNDI` directory service and where we can apply it and what is difference between `JNDI` naming and directory services.
comment on: http://stackoverflow.com/q/24981139

http://stackoverflow.com/comment/38787985
comment on: http://stackoverflow.com/a/24945402
type: AnswerComment
score: 0
has text: @djechlin Actually, a long time ago some intel processors had a [similar mistake](http://en.wikipedia.org/wiki/Pentium_FDIV_bug) to what you fear, but this would be considered a hardware fault. If you want to get those on current processors, you can overclock them too much and have too low voltage + too low cooling, increasing the likelihood of such an error. ^^
type: Comment

http://stackoverflow.com/comment/38803483
type: AnswerComment
comment on: http://stackoverflow.com/a/24961822
type: Comment
has text: Is there another themes?
score: 0

http://stackoverflow.com/comment/38806071
comment on: http://stackoverflow.com/q/24965775
score: 0
type: Comment
type: QuestionComment
has text: Are you sure it's not a 32 vs 64 bit mixup? If Java and Java EE have different bitness, they may not be able to share the driver.

http://stackoverflow.com/comment/38775423
has text: Application succesfully installed doesnt mean that your app will run successfully.There must be some exception.Post your logcat and relevant code.
type: Comment
comment on: http://stackoverflow.com/q/24949161
score: 0
type: QuestionComment

http://stackoverflow.com/comment/39035705
type: AnswerComment
comment on: http://stackoverflow.com/a/25029797
score: 0
type: Comment
has text: @user3078335 You can do this two ways. Do you want **any difference** to be highlighted as a full yellow, or do you want the intensity of the yellow to change depending on the difference of the two colours? (i.e. the more difference there is, the stronger the yellow appears)

http://stackoverflow.com/comment/38769210
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24945868
type: Comment
has text: I did it and the app main activity showed up but in the transition to the second activity it force closes

http://stackoverflow.com/a/25034079
score: 2
downvote count: 0
has body: Your main problem is String concatenation, for instance: mfparent" + "WHERE would produce invalid statement because of missing spacebar character mfparentWHERE My recommendation is to stop spliting String in JPQL as it brings more harm than good.
has comment: http://stackoverflow.com/comment/38934296
upvote count: 2
answers question: http://stackoverflow.com/q/25033898
type: Answer
has comment: http://stackoverflow.com/comment/38934768

chemistry
tag name: chemistry
tags question: http://stackoverflow.com/q/24916348
type: Tag

http://stackoverflow.com/q/24996776
has answer: http://stackoverflow.com/a/25001086
type: Question
has body: I have a camel DSL route with a Camel processor that determines a location to send a file to. The path is saved to a header in the Exchange so that it is passed back to the route. I want to use this header value (the path) in my route but I am receiving the following error: "Dynamic expressions with ${ } placeholders is not allowed. Use the fileName option to set the dynamic expression." When I use the fileName option this creates a file as the last directory from the path, whereas I want this to be a directory but there is no option like directoryName The to section of the route is below, where the fileLocation is picked up from an external properties file. .to("file://"+fileLocation+"/${in.header."+AppConstants.DIRECTORYLOCATION+"}? autoCreate=true&amp;delay=3000"); Any help/advice would be greatly appreciated.
type: AnsweredQuestion
score: 3
has comment: http://stackoverflow.com/comment/38868001
tagged with: java
tagged with: apache-camel
accepted answer: http://stackoverflow.com/a/25001086
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/38872026
favorite count: 0
has comment: http://stackoverflow.com/comment/38871233
has title: Setting directory from Exchange headers in Camel
tagged with: dsl
upvote count: 3

http://stackoverflow.com/comment/38962783
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25048852
has text: yes i already did it: org.hibernate.dialect.PostgreSQLDialect the query is : Query q = session.createQuery("from Gare ORDER BY "+jtSorting+" "); q.setFirstResult(startIndex); q.setMaxResults(pageSize); gares = (List<Gare>)q.list();
type: QuestionComment

http://stackoverflow.com/comment/49053552
type: Comment
comment on: http://stackoverflow.com/a/25029157
has text: Your `contentStream.moveTo(0,0)` starts creating a path. Path creation must end with a path drawing operation. Instead of such an operation, you begin a text object. Thus, strictly speaking your solution creates invalid PDFs.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/43732280
has text: @Loco they used orchid as a maven module for bitcoinj (without [git submodules](http://git-scm.com/book/en/v2/Git-Tools-Submodules)), may be something like described [here](http://stackoverflow.com/questions/20161602/loading-maven-dependencies-from-github) would be better!
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25040163

http://stackoverflow.com/comment/38719213
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24918877
has text: Please post an image of the actual output.

http://stackoverflow.com/comment/38980022
has text: I want to invoke the extension method from Groovy, only the declaration of the method is in Java.
comment on: http://stackoverflow.com/a/25055836
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/24985177
downvote count: 0
tagged with: jsp
linked to: http://stackoverflow.com/q/14775670
favorite count: 0
has title: Display Navigation Bar Throughout Spring MVC/JSP Application
has body: I am in the process of building a JSP based website using the Spring MVC framework and Bootstrap, and I have all of my separate web pages pretty much done. A little late in the game I've decided that I want to add a navigation bar to my website. I've created the navigation bar already but is there some easy way to "tack" it onto the other web pages easily so I don't have to duplicate code in separate files? If I put the navigation bar HTML code in a separate file and include it on a JSP page, will it show up appropriately? Is there a normal standard way people extend navigation bars to their whole website? I'm sure people who have experience creating websites should be able to easily answer this. I certainly appreciate any help that can be offered. Thank you!!!!
has answer: http://stackoverflow.com/a/24985230
tagged with: spring
tagged with: spring-mvc
upvote count: 3
type: AnsweredQuestion
score: 3
accepted answer: http://stackoverflow.com/a/24985230
tagged with: java
possible better answer: http://stackoverflow.com/a/24985303
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/24985303

http://stackoverflow.com/a/24938844
has comment: http://stackoverflow.com/comment/38757764
has body: XJC generates this class right? @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "BodyType", propOrder = { "test1", "test2" }) @XmlRootElement public class BodyType implements Serializable{ private final static long serialVersionUID = 12343L; @XmlElement(name = "TEST1") protected TEST1 test1; @XmlElement(name = "TEST2") protected TEST2 test2; XML Schema choice element allows only one of the elements contained in the declaration to be present within the containing element, But for JAXB are two different element. You haven't way to verify it, Your only solution to use JAXB is a statement like "if(bodyType.getTest2() != null)"
has comment: http://stackoverflow.com/comment/38759026
has comment: http://stackoverflow.com/comment/38758519
score: 0
has comment: http://stackoverflow.com/comment/41344270
has comment: http://stackoverflow.com/comment/38758148
answers question: http://stackoverflow.com/q/24922936
type: Answer

http://stackoverflow.com/q/24982948
has body: This question is also asked by me: How to integrate batch script multiple selections into JAVA GUI? As I did not get a suitable answer for my question, that's why I decided to ask again in stackoverflow with a more short and sweet manner. Disclaimer: I edited the question in that site. That's why I couldn't find a suitable answer for my question. I have this batch script which needs to be integrated into a java coding. But this is the first time I am doing integration so I am not familiar how it should be done. It would be good if anyone can answer my question in that site. But if you aren't, it would also be good to provide me with an example of integrating multiple selection batch script into java.
tagged with: java
has comment: http://stackoverflow.com/comment/38838372
tagged with: integration
type: Question
has title: Integrating batch script into Java GUI?
has comment: http://stackoverflow.com/comment/38838272
has comment: http://stackoverflow.com/comment/38838397
has comment: http://stackoverflow.com/comment/38838266
score: 0
tagged with: batch-file
has comment: http://stackoverflow.com/comment/38838352
answer count: 1
has comment: http://stackoverflow.com/comment/38838154
has comment: http://stackoverflow.com/comment/38838284
has comment: http://stackoverflow.com/comment/38838325
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/24948004
has answer: http://stackoverflow.com/a/24983217

http://stackoverflow.com/a/77276963
type: Answer
has body: I wouldn't recommend you doing it the way you are doing it. I created an example project that shows how to do it with Map<String, Object> rather than Map<String, String> . https://github.com/djangofan/json-serialization-jackson-example/blob/main/src/test/java/com/example/TestObjectsTest.java In that example: .... private static final ObjectMapper MAPPER = new ObjectMapper(); ..... @Test void testDeserialization() { Map<String, Object> linkedHashMap = new LinkedHashMap<>(); linkedHashMap.put("foo", "bar"); linkedHashMap.put("bar", "foo"); TestObjects.Bar bar = TestObjects.Bar.builder() .id(3) .description("bar description") .stringBoolean("false") .nestedMap(linkedHashMap) .build(); TestObjects.Foo foo = TestObjects.Foo.builder() .id(1) .description("foo description") .primitiveBoolean(false) .bar(bar) .build(); String serialized = null; try { serialized = MAPPER.writeValueAsString(foo); } catch (JsonProcessingException e) { throw new RuntimeException(e); } assertTrue(serialized.contains("foo description")); try { TestObjects.Foo foo1 = MAPPER.readValue(serialized, TestObjects.Foo.class); TestObjects.Bar bar1 = foo1.getBar(); assertEquals(bar1.id, 3); } catch (JsonProcessingException e) { throw new RuntimeException(e); } }
score: 0
answers question: http://stackoverflow.com/q/24946034

http://stackoverflow.com/comment/38842400
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24978867
score: 0
has text: what is -target. how can i compile using -target.

http://stackoverflow.com/comment/38882373
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25006308
has text: What do you mean by "custom settings"? I personally would simply use something like `GridBagLayout` or even `MigLayout`...

http://stackoverflow.com/q/25025230
has body: When I search for a value in my list of names, it returns the corresponding value. But when I delete this value, my ListView does not return all the names on the list again, they disappear. How to solve this? Any idea? Code of TabelaActivity.java: package com.akzonobel.malote.tabela; import com.akzonobel.malote.R; import android.app.Activity; import android.os.Bundle; import android.text.Editable; import android.text.TextWatcher; import android.widget.EditText; import android.widget.ListView; /* * Very basic Activity, the only things it does * are get the ListView reference from our layout. * Create an Adapter, set the Adapter to the ListView * and handle the onItemClick events for when the user * clicks on a row. */ public class TabelaActivity extends Activity { EditText inputSearch; CSVAdapter mAdapter; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_tabela); //Lookup our ListView ListView mList = (ListView)findViewById(R.id.mList); inputSearch = (EditText) findViewById(R.id.inputSearch); //Create Adapter. The second parameter is required by ArrayAdapter //which our Adapter extends. In this example though it is unused, //so we'll pass it a "dummy" value of -1. mAdapter = new CSVAdapter(this, -1); //attach our Adapter to the ListView. This will populate all of the rows. mList.setAdapter(mAdapter); /* * This listener will get a callback whenever the user clicks on a row. * The pos parameter will tell us which row got clicked. * * For now we'll just show a Toast with the state capital for the state that was clicked. */ inputSearch.addTextChangedListener(new TextWatcher() { @Override public void onTextChanged(CharSequence cs, int arg1, int arg2, int arg3) { // When user changed the Text TabelaActivity.this.mAdapter.getFilter().filter(cs); } @Override public void beforeTextChanged(CharSequence arg0, int arg1, int arg2, int arg3) { // TODO Auto-generated method stub } @Override public vo…
tagged with: listview
score: 0
tagged with: android-listview
tagged with: android
answer count: 1
type: UnansweredQuestion
has title: Bug with ArrayAdapter and Search function?
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/25026981

http://stackoverflow.com/comment/38834907
has text: Can you please explain why?
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24981299

http://stackoverflow.com/comment/38777733
has text: Use HttpWebRequest instead of HttpURLConnection
comment on: http://stackoverflow.com/a/24949597
type: Comment
score: 1
type: AnswerComment

http://stackoverflow.com/comment/38896085
type: Comment
type: QuestionComment
score: 2
has text: if (dataProvider != null) {...
comment on: http://stackoverflow.com/q/25013677

http://stackoverflow.com/comment/38930591
comment on: http://stackoverflow.com/q/25030117
score: 0
has text: Take a look [here which describes four different approaches](http://blog.soebes.de/blog/2014/01/02/version-information-into-your-appas-with-maven/)
type: QuestionComment
type: Comment

http://stackoverflow.com/a/25082287
upvote count: 2
downvote count: 1
has body: Agree you will probably need a server for signaling. My company OnSIP offers a hosted solution for this, so you would not need to manage servers, but whether you decide to or not - here is an explainer vid on signaling &amp; why you'll need it. Rather than write an explanation here, I'm just going to link it: https://www.youtube.com/watch?v=-waKd_edBGw Also, if you intend to run an application that reliably sets up calls 90%+ time, you'll also need media relay (TURN) servers. This is to handle NAT and firewall traversal, which can mess with P2P call setup in real life networking situations as the endpoints have private IP addresses. Media relay servers have a public IP address and literally relay the media stream. These require a lot of bandwidth to run— I don't believe any cloud hosting service will suffice. Again, my company offers this as part of a hosted solution with simple APIs. It is doable to do this all on your own. Competitive services that handle signaling &amp; media relay &amp; provide developer APIs: EasyRTC &amp; TokBox.
score: 1
type: Answer
answers question: http://stackoverflow.com/q/25058897

http://stackoverflow.com/comment/38713113
score: 0
type: Comment
type: QuestionComment
has text: Sorry I put the wrong code in one second I'll change it>
comment on: http://stackoverflow.com/q/24916255

http://stackoverflow.com/a/24922967
type: Answer
has comment: http://stackoverflow.com/comment/38725906
score: 0
has body: Isn't it just a[k] = 15;? The description says to directly assign 15 to the index k, it says nothing about the previous value at that index or that you should search for an element with the value k.
answers question: http://stackoverflow.com/q/24922856

http://stackoverflow.com/q/24954447
type: Question
has comment: http://stackoverflow.com/comment/38789760
upvote count: 0
score: -2
accepted answer: http://stackoverflow.com/a/24967432
has comment: http://stackoverflow.com/comment/38809085
has comment: http://stackoverflow.com/comment/38785250
has title: How to lock if condition until both conditions are true?
answer count: 1
has comment: http://stackoverflow.com/comment/38790917
has comment: http://stackoverflow.com/comment/38791061
favorite count: 0
downvote count: 2
has comment: http://stackoverflow.com/comment/38788696
has answer: http://stackoverflow.com/a/24967432
has body: I have a program which parses last one hour data from a log file and keeps it in another file. I need to keep the condition running until the program finds one hour data. The one hour data will be written inside the log file by a server. How do I keep the condition running until it finds one hour data? ReversedLinesFileReader reverse= new ReversedLinesFileReader(file); PrintWriter writer= new PrintWriter(f2+"/"+fileName1); ; String line; while ((line = reverse.readLine()) != null) { List&lt;String&gt; stringList = Arrays.asList(line); if(line.contains(Constants.SPEEDO)) { timeFromLine = getTimeFromLine(line); timeFromSystem= getSystemTime(); timeGap= propertiesReader.getPropertyValue("timeGap"); format.setTimeZone(TimeZone.getTimeZone("GMT")); timeLine= format.parse(timeFromLine); timeSystem=format.parse(timeFromSystem); timeGapDate=format.parse(timeGap); startTimeLong=timeSystem.getTime(); timeGapLong=timeGapDate.getTime(); endTimeLong=startTimeLong-timeGapLong; Date d= new Date(endTimeLong); endTimeString= format.format(d); endTimeDate1=format.parse(endTimeString); if(timeLine.before(timeSystem)&amp;&amp;timeLine.after(endTimeDate1)) { writer.println(line); } } } writer.close(); reverse.close();
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38790687
has comment: http://stackoverflow.com/comment/38793657
has comment: http://stackoverflow.com/comment/38784612
tagged with: java

http://stackoverflow.com/comment/38859884
type: QuestionComment
has text: @laune our customers are vendors and they do not use tools provided by us to generate this XML file which we are using as data-feed for our application. They possibly are using their own home-grown tool to provide us file in format format (XML tags and encoding) but they may fail due to one or another reason if they are not doing it right.
comment on: http://stackoverflow.com/q/24994107
score: 0
type: Comment

http://stackoverflow.com/comment/38892569
comment on: http://stackoverflow.com/a/25011631
type: Comment
has text: if i do that, won't same word if i encrypt will give the same encrypted value? because the password and the salt both are the same for everything? because i don't decrypt it at the same time. it will store the encrypted value and when user wanted only it will decrypt. then i need to specify the salt right?
type: AnswerComment
score: 0

http://stackoverflow.com/a/25023950
has comment: http://stackoverflow.com/comment/38916772
upvote count: 2
type: Answer
score: 2
answers question: http://stackoverflow.com/q/25023606
has body: I think both methods are valid All depends on what you want to do. For example, if you have many buttons on a screen and you choose to use the first option, for each button you'll need a new object to handle the click. In contrast to the second option, with the same object (activity) as a listener, you'll consume fewer resources because it would be creating fewer objects (Java). On the other hand, remember that the view holds a reference to context.
downvote count: 0

http://stackoverflow.com/a/24990889
has comment: http://stackoverflow.com/comment/38853200
score: 5
type: AcceptedAnswer
upvote count: 5
downvote count: 0
answers question: http://stackoverflow.com/q/24990836
accepted answer of: http://stackoverflow.com/q/24990836
type: Answer
has body: Try this: try { } catch(HibernateException e) { if(e instanceof ConstraintViolationException) { ConstraintViolationException ce = (ConstraintViolationException) e; String constraintName = ce.getConstraintName(); } }

http://stackoverflow.com/a/25034415
score: 0
type: Answer
has body: package com.example.testing; import java.io.BufferedWriter; import java.io.File; import java.io.FileWriter; import java.io.IOException; import android.annotation.SuppressLint; import android.app.Activity; import android.os.Bundle; import android.os.Environment; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; public class Favorite extends Activity { EditText etName; EditText etAdress; Button bAdd; TextView tvDisplay; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.favorite); etName = (EditText) findViewById(R.id.etName); etAdress = (EditText) findViewById(R.id.etAdress); bAdd = (Button) findViewById(R.id.bAdd); tvDisplay = (TextView) findViewById(R.id.tvDisplay); bAdd.setOnClickListener(new View.OnClickListener() { @SuppressLint("NewApi") @Override public void onClick(View v) { String name = etName.getText().toString(); String adress = etAdress.getText().toString(); if (adress != null) { if (adress.contains("http://") || adress.contains("www.") || adress.contains(".com") || adress.contains(".ro") || adress.contains(".org")) { try { File file = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS), "favorite.txt"); FileWriter WriteFile = new FileWriter(file); BufferedWriter out = new BufferedWriter(WriteFile); out.write(name + " " + adress); tvDisplay.setText("Name: " + name + " Adress: " + adress); out.close(); } catch (IOException e) { e.printStackTrace(); } } else tvDisplay.setText("The adress you have entered is invalid"); } else { tvDisplay.setText("You haven't entered anything"); } } }); } } Dont' forget to add "uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" in AndroidManifest.xml it Works for me.
answers question: http://stackoverflow.com/q/25032924

http://stackoverflow.com/comment/38974421
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25055210
score: 0
has text: Your program will not compile because of 3 identical statements like -- int value1 = (int) list.get(0); -- Reason: Cannot cast from Object to int -- Update it to -- Integer value1 = (Integer ) list.get(0);

http://stackoverflow.com/comment/38948947
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25041290
has text: I tried. It wouldn't let me... This was my first question.

http://stackoverflow.com/comment/38923706
score: 0
type: AnswerComment
has text: The problem is in the `Triangle` constructor, check the update to the question for details
type: Comment
comment on: http://stackoverflow.com/a/25027414

http://stackoverflow.com/a/25015601
accepted answer of: http://stackoverflow.com/q/25015400
type: Answer
score: 5
upvote count: 5
has body: The return value for a compare function should be -1, 0 or +1, not just 1 or 0. return Integer.compare(r1.getId(), r2.getId()); in place of the if statement should do the job. A Java 8 sort using a lambda would be listArr.sort(Comparator.comparing(e -&gt; e.getId()));
answers question: http://stackoverflow.com/q/25015400
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/25010296
downvote count: 0
score: 1
type: Answer
has comment: http://stackoverflow.com/comment/38893921
answers question: http://stackoverflow.com/q/25010175
upvote count: 1
has body: You have an error in your pattern String s = "@123456@ 123456789[ 123456@ 12"; Pattern p = Pattern.compile("@(\\d{6})@\\s?(\\d{9})\\[\\s?(\\d{6})@\\s?(\\d{2})"); Matcher m = p.matcher(s); if (m.matches()) { System.out.println(m.group(1)); System.out.println(m.group(2)); System.out.println(m.group(3)); System.out.println(m.group(4)); }

http://stackoverflow.com/comment/38982614
comment on: http://stackoverflow.com/a/25059422
type: AnswerComment
type: Comment
score: 0
has text: Try to check you have a recent JRE in your build path and that your compiler compliance is > Java 1.2.

http://stackoverflow.com/comment/38843966
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/24965702
type: Comment
has text: load() only works from the rhino shell, not when you're running in embedded mode.

http://stackoverflow.com/comment/38841165
comment on: http://stackoverflow.com/q/24978867
has text: Well we don't even know what operating system you're using, which makes it hard to help you. Why don't you just uninstall 1.7?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38833899
score: 0
type: Comment
has text: Firstly you persist a product without accounts, them add accounts and update foreign key.
type: AnswerComment
comment on: http://stackoverflow.com/a/24973976

rmi
tags question: http://stackoverflow.com/q/25046960
tags question: http://stackoverflow.com/q/25055466
tags question: http://stackoverflow.com/q/24918323
tag name: rmi
type: Tag

http://stackoverflow.com/comment/38712744
has text: Once I've added the jar files as dependencies should the rest work, i.e. are the log.debug... and the next 3 lines proper commands?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24915766
type: Comment

http://stackoverflow.com/comment/38784498
comment on: http://stackoverflow.com/q/24953683
score: 0
type: Comment
type: QuestionComment
has text: What I mean is that PM uses the storage of MB but only for getting messages. So when I create a new private message, this is stored successfully in PM table but there is no respective record created in MB storage. This results in the above exception, as the view_messages jsp of PM tries to get a message from MB board which has the id of the record that was created in PM table.

http://stackoverflow.com/q/25029668
downvote count: 0
score: 1
tagged with: java
linked to: http://stackoverflow.com/q/19501067
tagged with: mysql
linked to: http://stackoverflow.com/q/2780284
type: Question
has body: I am a newbie to Java and MySQL. Please pardon me if my question seems silly, I want to know the answer... I have gone through many articles and questions asked in forums, but I didn't see a relevant answer for my question... That is, I have made a switch statement in Java and I want to show the list of available tables in a database if I press 1( that is go into the case 1 and execute a query "show tables;" ) In MySQL Console, it is easy to check for available tables using the same query. But I want to know whether "show tables;" query or similar queries can be executed inside a Java Program... Here's a sample snippet of my code, Connection con=null; String url = "jdbc:mysql://localhost:3306/giftson"; String dbName = "giftson"; String userName = "root"; String password = "password"; con=DriverManager.getConnection(url,userName,password); Statement st=con.createStatement(); //String query; Statement st=con.createStatement(); System.out.println("\tDatabase Connection for Various Operations"); System.out.println("\n1. Show list of tables\n2. Show contents of Table\n3. Create New Table\n4. Insert into table\n5. Update Table\n6. Delete From Table\n7. Exit\n"); System.out.println("Enter your option Number "); DataInputStream dis=new DataInputStream(System.in); int ch=Integer.parseInt(dis.readLine()); switch(ch) { case 1: System.out.println(" You have selected to Show list of available tables"); //ResultSet rs=st.executeQuery("Show tables"); //while(rs.next()) //{ // System.out.println("List of Tables\n" +rs.getString("?????")); //} break; } from the above piece of code, If I execute the query in ResultSet, How do I print the values inside the while loop..? In rs.getString(); we can only pass either the column index or the column label as argument, but how do I get the list of tables... what do I enter in place of "?????" inside print statement...? please do help me, keeping in mind that you are explaining for a beginner... Thanks in advance...!
has comment: http://stackoverflow.com/comment/39052080
has comment: http://stackoverflow.com/comment/38926734
answer count: 2
has comment: http://stackoverflow.com/comment/38926251
has comment: http://stackoverflow.com/comment/38926393
upvote count: 1
has title: How to execute MySQL query, "show tables;" inside a Java Program..?
favorite count: 0
possible better answer: http://stackoverflow.com/a/25096953
has answer: http://stackoverflow.com/a/25096953
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25096914
accepted answer: http://stackoverflow.com/a/25096914
linked to: http://stackoverflow.com/q/12771120

http://stackoverflow.com/a/25039266
accepted answer of: http://stackoverflow.com/q/25038912
has comment: http://stackoverflow.com/comment/38945233
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25038912
has comment: http://stackoverflow.com/comment/38968082
has comment: http://stackoverflow.com/comment/38946526
type: Answer
has comment: http://stackoverflow.com/comment/38945753
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/38944799
has comment: http://stackoverflow.com/comment/38947973
downvote count: 0
has comment: http://stackoverflow.com/comment/38948782
has body: You should buffer the OutputStream: OutputStream procOutput = proc.getOutputStream(); BufferedOutputStream bos = new BufferedOutputStream(procOutput); IOUtils.copy(fileInput, bos); Moreover, why don't you simply redirect fileInput as the process InputStream? ProcessBuilder pb = new ProcessBuilder(command); pb.redirectInput(file); Process proc = pb.start(); proc.waitFor();
has comment: http://stackoverflow.com/comment/38947058
has comment: http://stackoverflow.com/comment/38984847
has comment: http://stackoverflow.com/comment/38945942

http://stackoverflow.com/a/24918951
has comment: http://stackoverflow.com/comment/39877237
type: Answer
has body: You can code Requirement class as follows: @Entity public class Requirement { @EmbeddedId private RequirementKey id; @ManyToOne @JoinColumns({ @JoinColumn(name = "name", referencedColumnName = "name", insertable = false, updatable = false), @JoinColumn(name = "system_version", referencedColumnName = "version", insertable = false, updatable = false) }) private System system; @ManyToOne @JoinColumns({ @JoinColumn(name = "id", referencedColumnName = "id", insertable = false, updatable = false), @JoinColumn(name = "version", referencedColumnName = "version", insertable = false, updatable = false) }) private Software software; } with RequirementKey: @Embeddable public class RequirementKey implements Serializable { int id; int version; String name; } I think there is better solution, but I cannot figure out how it may be done.
has comment: http://stackoverflow.com/comment/38796620
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/38741123
has comment: http://stackoverflow.com/comment/38755132
has comment: http://stackoverflow.com/comment/38763997
answers question: http://stackoverflow.com/q/24917105
has comment: http://stackoverflow.com/comment/39924855
has comment: http://stackoverflow.com/comment/38727283
downvote count: 0
has comment: http://stackoverflow.com/comment/39883427

http://stackoverflow.com/comment/38704351
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24910921
has text: Thanks! this will certainly help

http://stackoverflow.com/comment/38785247
score: 0
type: Comment
has text: I dont have a URI for my images, i get them from a DB
comment on: http://stackoverflow.com/a/24954525
type: AnswerComment

http://stackoverflow.com/q/24982392
answer count: 0
tagged with: java
type: Question
tagged with: image
score: 0
has body: UPDATE: read the bottom part for more updated information I need help with my two programs, server and client program. The client program listen for mouse and key events and on every key event the client will send a string message to the server and on every mouse click capture the screen and send first a string message saying "CAPTURE" and after that send the image. Here are mye two client classes: package me.l0lkj.logger; import java.awt.Dimension; import java.awt.Graphics2D; import java.awt.Image; import java.awt.Rectangle; import java.awt.Robot; import java.awt.Toolkit; import java.awt.image.BufferedImage; import java.io.File; import java.net.URL; import javax.imageio.ImageIO; import org.jnativehook.GlobalScreen; import org.jnativehook.NativeHookException; import org.jnativehook.keyboard.NativeKeyEvent; import org.jnativehook.keyboard.NativeKeyListener; import org.jnativehook.mouse.NativeMouseEvent; import org.jnativehook.mouse.NativeMouseInputListener; import org.jnativehook.mouse.NativeMouseWheelEvent; import org.jnativehook.mouse.NativeMouseWheelListener; public class Listener implements NativeKeyListener, NativeMouseInputListener, NativeMouseWheelListener { public void nativeKeyPressed(NativeKeyEvent e) { MultiThreadChatClient.send(NativeKeyEvent.getKeyText(e.getKeyCode())); } public void nativeKeyReleased(NativeKeyEvent e) { } public void nativeKeyTyped(NativeKeyEvent e) { } public void nativeMouseClicked(NativeMouseEvent e) { } public void nativeMousePressed(NativeMouseEvent e) { MultiThreadChatClient.send( "MOUSE: " + e.getX() + ", " + e.getY() + " " + e.getButton() ); captureScreen( e.getX(), e.getY() ); } public void nativeMouseReleased(NativeMouseEvent e) { } public void nativeMouseMoved(NativeMouseEvent e) { } public void nativeMouseDragged(NativeMouseEvent e) { } public void nativeMouseWheelMoved(NativeMouseWheelEvent e) { } public static void start() { try { GlobalScreen.registerNativeHook(); } catch (NativeHookException ex) { System.exit(1); } Liste…
has comment: http://stackoverflow.com/comment/38837146
has comment: http://stackoverflow.com/comment/38837111
has title: Java socket, send image
has comment: http://stackoverflow.com/comment/38837132
type: UnansweredQuestion
tagged with: sockets

http://stackoverflow.com/comment/38786149
comment on: http://stackoverflow.com/q/24955418
type: Comment
type: QuestionComment
score: 1
has text: https://stackoverflow.com/questions/23353173/unfortunately-myapp-has-stopped-how-can-i-solve-this

http://stackoverflow.com/comment/38759670
comment on: http://stackoverflow.com/a/24917360
type: AnswerComment
score: 0
type: Comment
has text: respectfully, please read both the question and the comments more carefully before replying. as stated in the previous comment "you can see in the eclipse console all three booleans are set to 'true'" - which I posted in response to your query about the result of my running the code you posted. moreover, as i stated in both the question and more directly in the comment "in the application view, on the right you can see three properly rendered buttons and one improperly rendered ones" - it doesn't matter what the buttons do, it matters that they aren't rendering in a consistent fashion.

http://stackoverflow.com/comment/38970509
comment on: http://stackoverflow.com/q/25053057
score: 1
has text: hi, thanks for using the stackoveflow. Unfortunately for you this is Question&Answer site where questions should be concrete. Answer for your question is opinion based and require multiple steps. Please read FAQ and came back with specific problem. Good luck
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38786353
score: 0
type: AnswerComment
type: Comment
has text: You said that database in not on your computer. Then you need to give IP address of the computer and port no where DB is located. DB_SQL = "jdbc:microsoft:sqlserver://IP_ADDRESS:1433;" + "database=DataDB;" + "user=sa;" + "password=1234";
comment on: http://stackoverflow.com/a/24954941

http://stackoverflow.com/q/24927475
type: Question
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/38733881
has answer: http://stackoverflow.com/a/24927645
accepted answer: http://stackoverflow.com/a/24927675
has title: Nesting for-loop in Order to Create Brick Wall
possible better answer: http://stackoverflow.com/a/24927645
has body: I am new to programming and this is my first time posting to this site. I am currently working on an assignment which will allow a user to input a number between 1 and 20, and then will create a brick wall based upon the number of brick layers the user entered into the JTextField. I was able to create one row, but I don't really understand nesting statements, and all of the examples I've looked at on the web just confuse me more, so I was wondering if someone could possibly help me to better understand nesting for-loops. //Package List import java.awt.*; import java.applet.*; import javax.swing.*; import java.util.*; import java.awt.event.*; public class Wall extends JApplet implements KeyListener { //Component declaration JLabel directions; JTextField input; //Variable declaration int startX = 50; int startY = 650; int width = 50; int height = 20; int spacing = 2; //Method declaration public void init() { getContentPane().setBackground(new Color (128, 128, 128));//Changes backround of JApplet to black //Set JTextField and JLabel setLayout (new FlowLayout( )); directions = new JLabel("Enter in any number between 1 and 20 and then press Enter on your keyboard."); input = new JTextField ( 10 ); add (directions ); add (input); //Key listener addKeyListener( this ); setFocusable( true ); } //Method declaration public void paint(Graphics g) { super.paint (g); for (int col=1; col&lt;= 8; col++) { // for (int row; row&lt;=20; row++) { g.setColor (Color.RED); g.fillRect (startX, startY, 50, 20); startX = startX + spacing + width; } } } //Key event methods public void keyReleased( KeyEvent ke ){} public void keyTyped (KeyEvent ke ) {} public void keyPressed ( KeyEvent ke ) { int key = ke.getKeyCode ( ); if (key == KeyEvent.VK_ENTER) { } }
type: AnsweredQuestion
tagged with: nested-loops
tagged with: java
has answer: http://stackoverflow.com/a/24927675

http://stackoverflow.com/a/24953517
upvote count: 7
type: AcceptedAnswer
type: Answer
downvote count: 0
has body: You could use negative lookbehind. It matches the colon which was not preceeded by ? (?&lt;!\?): Java regex would be, "(?&lt;!\\?):" DEMO
accepted answer of: http://stackoverflow.com/q/24953477
score: 7
answers question: http://stackoverflow.com/q/24953477

http://stackoverflow.com/comment/43856353
has text: I get the exact same problem except I am on win7. I did install the jdk (in C:\Program Files\Java\jdk1.8.0_25) and I copied/pasted that in the JAVA_HOME env. Same error message. As Android Studio denies starting, I have no access to its user interface to investigate the said classpath. BTW I have a 64 bits version of everything : Android studio, java sdk).
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24915686

http://stackoverflow.com/comment/38888378
score: 3
has text: @MadProgrammer Have to propose stringcompare.stackoverlow.com on [area51](http://area51.stackexchange.com/) :P
comment on: http://stackoverflow.com/q/25009579
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25009717
tagged with: android
has answer: http://stackoverflow.com/a/31066296
has answer: http://stackoverflow.com/a/57650808
has answer: http://stackoverflow.com/a/58174100
has answer: http://stackoverflow.com/a/75125920
has answer: http://stackoverflow.com/a/39791244
has answer: http://stackoverflow.com/a/29445927
upvote count: 120
score: 118
has answer: http://stackoverflow.com/a/39709146
tagged with: java
has answer: http://stackoverflow.com/a/25028216
has answer: http://stackoverflow.com/a/72205269
has answer: http://stackoverflow.com/a/28090752
has answer: http://stackoverflow.com/a/45591944
has answer: http://stackoverflow.com/a/58229346
has answer: http://stackoverflow.com/a/51483727
has answer: http://stackoverflow.com/a/51491729
has body: Version of Android Studio (Beta) 0.8.4 OS version: Windows 8 Java JRE/JDK version: 1.8.0_11 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 ----------------------- Error occurred during initialization of VM Could not reserve enough space for 1048576KB object heap Java HotSpot(TM) Client VM warning: ignoring option MaxPermSize=256m; support was removed in 8.0
has answer: http://stackoverflow.com/a/40705429
type: Question
has answer: http://stackoverflow.com/a/31907972
tagged with: beta
has answer: http://stackoverflow.com/a/71049965
answer count: 39
has answer: http://stackoverflow.com/a/39680977
linked to: http://stackoverflow.com/q/41787197
has title: Android Studio Gradle project "Unable to start the daemon process /initialization of VM"
has answer: http://stackoverflow.com/a/51589606
has answer: http://stackoverflow.com/a/77752154
has answer: http://stackoverflow.com/a/39692882
has answer: http://stackoverflow.com/a/27665627
has answer: http://stackoverflow.com/a/49085274
downvote count: 2
has answer: http://stackoverflow.com/a/38282108
has answer: http://stackoverflow.com/a/39722609
has answer: http://stackoverflow.com/a/39689178
has answer: http://stackoverflow.com/a/48544813
has answer: http://stackoverflow.com/a/61336957
tagged with: jvm
has answer: http://stackoverflow.com/a/76710859
has answer: http://stackoverflow.com/a/39986513
favorite count: 0
has answer: http://stackoverflow.com/a/34966101
tagged with: daemon
has answer: http://stackoverflow.com/a/34734684
has answer: http://stackoverflow.com/a/39837430
has answer: http://stackoverflow.com/a/27516679
has answer: http://stackoverflow.com/a/26955062
has answer: http://stackoverflow.com/a/51361376
has answer: http://stackoverflow.com/a/68831213
has answer: http://stackoverflow.com/a/30897165
has comment: http://stackoverflow.com/comment/86760931
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/40684831

http://stackoverflow.com/q/24956510
tagged with: java
has title: Bi-directional Scrolling with canvas android
has comment: http://stackoverflow.com/comment/38788634
has body: I have drawn a marker image using canvas with fix coordinates on a large image, which is also drawn by canvas, but when I scroll the image, marker image doesn't move with image simultaneously like in Google maps. Is there any solution for it? activity_main.xml &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;TableLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/table" android:layout_width="fill_parent" android:layout_height="fill_parent" &gt; &lt;HorizontalScrollView android:layout_width="wrap_content" android:layout_height="wrap_content" &gt; &lt;ScrollView android:layout_width="wrap_content" android:layout_height="wrap_content" &gt; &lt;ImageView android:id="@+id/imageView" android:layout_width="fill_parent" android:layout_height="fill_parent" android:contentDescription="hello" /&gt; &lt;/ScrollView&gt; &lt;/HorizontalScrollView&gt; ImageViewFromURLActivity.java package com.example.image; import java.io.IOException; import java.io.InputStream; import java.net.HttpURLConnection; import java.net.URL; import java.net.URLConnection; import android.app.Activity; import android.app.ProgressDialog; import android.content.Context; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Paint; import android.graphics.Rect; import android.os.AsyncTask; import android.os.Bundle; import android.view.Display; import android.view.MotionEvent; import android.view.View; import android.view.View.OnClickListener; import android.view.WindowManager; import android.widget.ImageView; public class ImageViewFromURLActivity extends Activity { private static int displayWidth = 0; private static int displayHeight = 0; public static final String URL = "http://goo.gl/plT1wB"; static float mX=100; static float mY=200; ImageView imageView; static Bitmap abc = null; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInst…
downvote count: 0
tagged with: android-canvas
tagged with: bitmapimage
favorite count: 0
type: UnansweredQuestion
tagged with: android
answer count: 0
score: 1
upvote count: 1
type: Question

http://stackoverflow.com/q/24935010
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38748347
has answer: http://stackoverflow.com/a/24935166
tagged with: java
has title: Android SQLite errors while inserting records
type: Question
has comment: http://stackoverflow.com/comment/38748645
has answer: http://stackoverflow.com/a/24937419
has comment: http://stackoverflow.com/comment/38748050
has comment: http://stackoverflow.com/comment/38748803
score: 0
has comment: http://stackoverflow.com/comment/38748406
answer count: 3
linked to: http://stackoverflow.com/q/513832
has comment: http://stackoverflow.com/comment/38748472
tagged with: sql
has comment: http://stackoverflow.com/comment/38748278
tagged with: android
tagged with: sqlite
has comment: http://stackoverflow.com/comment/38747924
has comment: http://stackoverflow.com/comment/38748607
has answer: http://stackoverflow.com/a/24935104
has comment: http://stackoverflow.com/comment/38748028
has comment: http://stackoverflow.com/comment/38748566
has comment: http://stackoverflow.com/comment/38748213
has comment: http://stackoverflow.com/comment/38748514
accepted answer: http://stackoverflow.com/a/24937419
has body: I have tried many things and searched both SO and google, but this is an odd error. The error happens when I click a button which creates(inserts) a new level in the database. Logcat follows: http://pokit.org/get/?564ecab747237335f72006e8e3d5d633.jpg There is more down but it's the same error. And here is the code that does the insert. I'm using SQLiteAssetHelper by the way. public void createLevel(Level lev){ ContentValues values = new ContentValues(); if(lev.getGameMode()=="SinglePlayer") { LevelSinglePlayer level=(LevelSinglePlayer)lev; values.put(GAME_MODE_COLUMN, level.getGameMode()); values.put(DIFFICULTY_COLUMN, level.getDifficulty()); values.put(SINGLE_PLAYER_MODE_COLUMN, level.getSinglePlayerMode()); values.putNull(TIME_CHALLENGE_MODE_COLUMN); values.put(POINTS_COLUMN, level.getPoints()); values.put(LIVES_COLUMN, level.getLives()); values.putNull(TIME_COLUMN); values.put(SUFFIX_COLUMN, level.getSuffix()); values.put(SUFFIX_WORDS_COUNT_COLUMN, level.getSuffixWordsCount()); db.insert(LEVELS_TABLE, null, values); Log.w("INSERT_NEW_LEVEL", "SUCCESSFUL INSERT"); } else if(lev.getGameMode()=="TimeChallenge") { LevelTimeChallenge level= (LevelTimeChallenge)lev; values.put(GAME_MODE_COLUMN, level.getGameMode()); values.put(DIFFICULTY_COLUMN, level.getDifficulty()); values.putNull(SINGLE_PLAYER_MODE_COLUMN); values.put(TIME_CHALLENGE_MODE_COLUMN, level.getTimeChallengeMode()); values.put(POINTS_COLUMN, level.getPoints()); values.put(LIVES_COLUMN, level.getLives()); values.put(TIME_COLUMN, level.getTime()); values.put(SUFFIX_COLUMN, level.getSuffix()); values.put(SUFFIX_WORDS_COUNT_COLUMN, level.getSuffixWordsCount()); db.insert(LEVELS_TABLE, null, values); Log.w("INSERT_NEW_LEVEL", "SUCCESSFUL INSERT"); } } I have three tables, created by the following statements: CREATE TABLE IF NOT EXISTS words(_id INTEGER PRIMARY KEY, word TEXT, tezina INTEGER) CREATE TABLE IF NOT EXISTS levels(_id INTEGER PRIMARY KEY, modIgre TEXT NOT NULL, tezina INTEGER NOT NULL, modSingle TEX…
has comment: http://stackoverflow.com/comment/38748979
has comment: http://stackoverflow.com/comment/38748254
has comment: http://stackoverflow.com/comment/38748112
has comment: http://stackoverflow.com/comment/38749568
possible better answer: http://stackoverflow.com/a/24935104

http://stackoverflow.com/comment/38995725
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/24958682
has text: Agreed that it appears that there is some difference between the reading and writing of the data. It is always possible that it is in Coherence code, but that is less likely due to the test coverage (and the wide-spread use in thousands of systems). Nonetheless, it is still possible, so I suggest posting the POF serialization logic in the various classes in question.

http://stackoverflow.com/q/24916011
has answer: http://stackoverflow.com/a/24916282
has comment: http://stackoverflow.com/comment/38713081
linked to: http://stackoverflow.com/q/9824296
tagged with: swing
has comment: http://stackoverflow.com/comment/38712678
tagged with: treetablecelleditor
has comment: http://stackoverflow.com/comment/38729126
type: AnsweredQuestion
score: 3
downvote count: 0
tagged with: java
possible better answer: http://stackoverflow.com/a/24916282
type: Question
accepted answer: http://stackoverflow.com/a/24916211
answer count: 2
has comment: http://stackoverflow.com/comment/38713250
has body: I have here a very simple demo program and sorry for the not so short version of code but its the shortest I can do. Anyway, I have here a jtable with editable cell for column 2. I want the numpad on the right side to append to the selected cell of the jtable but the .setValueAt() does not do that. Is there any way that the numpad on the right side to append to the selected cell? Or I should import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.EventObject; import javax.swing.*; import javax.swing.border.BevelBorder; import javax.swing.border.Border; import javax.swing.border.EmptyBorder; import javax.swing.event.CellEditorListener; import javax.swing.table.*; public class Jtabledemo { private static class JTabledemo { JTable table; JFrame Card = new JFrame(); JTabbedPane card_tab = new JTabbedPane(); // FOR TAB JPanel buttonpanel = new JPanel(); // FOR BUTTON BELOW FlowLayout flow = new FlowLayout(FlowLayout.LEFT); public JTabledemo() { Card.setVisible(true); Card.setSize(821,340); Card.setTitle(""); Card.setResizable(false); final Toolkit toolkit = Toolkit.getDefaultToolkit(); Dimension dimension = Toolkit.getDefaultToolkit().getScreenSize(); int x=(int)((dimension.getWidth() - Card.getWidth())/2); int y=(int)((dimension.getHeight() - Card.getHeight())/2); Card.setLocation(x, y); Card.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); JPanel bodypanel = new JPanel(); bodypanel.setLayout(new BorderLayout()); JPanel container = new JPanel(); container.setLayout(new BorderLayout()); JPanel jp1 = new JPanel(); jp1.setBackground(Color.lightGray); jp1.setPreferredSize(new Dimension(510,260)); jp1.setLayout(new BorderLayout()); table = new JTable(new ExampleTableModel()); JScrollPane scrollPane = new JScrollPane(table); table.setFillsViewportHeight(true); JTableHeader header = table.getTableHeader(); table.setRowHeight(20); jp1.add(scrollPane); JPanel buttonpanel = new JPanel(); buttonpanel.setLayout(new FlowLayout(F…
has title: How to append text in JTable cell
favorite count: 0
has comment: http://stackoverflow.com/comment/38712608
has answer: http://stackoverflow.com/a/24916211
tagged with: jtable
upvote count: 3
has comment: http://stackoverflow.com/comment/38712818

http://stackoverflow.com/q/24981723
has title: Read next or previous mysql rows and update current row without using cursors or auto-incremented value
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38835882
tagged with: php
has answer: http://stackoverflow.com/a/24981953
tagged with: java
has body: I need to process some records that are in a mysql table.The problem is the incrementable id is not a reliable way of knowing what the next or previous record is because some records are deleted. My table has three fields. Id,Number,Status . I want to read the numbers one at a time and I don't mind fetching it from the database every time I want to read the next or previous.Once i get the number,i want to double it and write the value to the column status. The use of cursor would be nice but cursors wouldn't allow me update the underlying table i am reading from.Is there a solution that can allow me read the next and previous value and at the same time allow me update the current row?. Thanks.
tagged with: http://stackoverflow.com/tag/json
tagged with: mysql
type: Question
answer count: 1
has comment: http://stackoverflow.com/comment/38835670
has comment: http://stackoverflow.com/comment/38835809
score: 0
has comment: http://stackoverflow.com/comment/38835892
tagged with: android

http://stackoverflow.com/q/25009687
has comment: http://stackoverflow.com/comment/38889610
score: 0
has body: command line input: mvn archetype:generate -DgroupId=com.azalea.web -DartifactId=test -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false errors as follows: failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:2.2:generate (default-cli) on project standalone-pom: Execution default-cli of goal org.apache.maven.plugins:maven-archetype-plugin:2.2:generate failed: A required class was missing while executing org apache.maven.plugins:maven-archetype-plugin:2.2 generate: org/dom4j/DocumentException that's it ! thanks at first
has comment: http://stackoverflow.com/comment/38888868
type: UnansweredQuestion
has title: can't create java project by maven on command line , Windows
tagged with: maven
linked to: http://stackoverflow.com/q/6044026
answer count: 0
tagged with: java
type: Question

http://stackoverflow.com/a/24989364
upvote count: 2
type: Answer
score: 2
answers question: http://stackoverflow.com/q/24986887
downvote count: 0
has body: try FileSystem fileSystem = FileSystem.get(new Configuration()); Path path = new Path(fileSystem.getName() + "/" + args[0]); BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(fileSystem.open(path))); String line = bufferedReader.readLine(); and give file path in HDFS as (with no prefix) "/myFirstSelfWriteFile" do not include "hdfs:/localhost"

http://stackoverflow.com/comment/38801901
type: QuestionComment
type: Comment
has text: Maybe I misunderstood something here, but ... isn't the whole point of having a hierarchy in form of a scene graph that you *only* have to apply the transformation to the parent (and the children will "follow" without the transform explicitly being set)? An aside: You should consider storing the transformation as a 4x4 matrix, because otherwise you'll get into trouble when you perform multiple transformations (rotations, translations, scalings...)
score: 0
comment on: http://stackoverflow.com/q/24962555

http://stackoverflow.com/comment/38819544
score: 0
has text: I added some ot the stacktrace. let me know if there is a need for more
comment on: http://stackoverflow.com/q/24972437
type: Comment
type: QuestionComment

hadoop
tags question: http://stackoverflow.com/q/25010288
tags question: http://stackoverflow.com/q/25005910
tags question: http://stackoverflow.com/q/25051671
tags question: http://stackoverflow.com/q/25056195
tag name: hadoop
tags question: http://stackoverflow.com/q/24926927
tags question: http://stackoverflow.com/q/25018356
tags question: http://stackoverflow.com/q/25054901
tags question: http://stackoverflow.com/q/25062844
type: Tag
tags question: http://stackoverflow.com/q/25018800
tags question: http://stackoverflow.com/q/24955655
tags question: http://stackoverflow.com/q/25022657
tags question: http://stackoverflow.com/q/25062473
tags question: http://stackoverflow.com/q/24985635
tags question: http://stackoverflow.com/q/25066905
tags question: http://stackoverflow.com/q/24992079
tags question: http://stackoverflow.com/q/25067915
tags question: http://stackoverflow.com/q/24986887
tags question: http://stackoverflow.com/q/24987672
tags question: http://stackoverflow.com/q/24914035
tags question: http://stackoverflow.com/q/25030737
tags question: http://stackoverflow.com/q/25012680
tags question: http://stackoverflow.com/q/25059951
tags question: http://stackoverflow.com/q/24934612
tags question: http://stackoverflow.com/q/24923407

http://stackoverflow.com/a/24966161
upvote count: 3
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/38806791
downvote count: 0
score: 3
accepted answer of: http://stackoverflow.com/q/24966143
has comment: http://stackoverflow.com/comment/38806809
has body: This is incorrect: ArrayList&lt;Integer&gt; integerArgs[]; An ArrayList is not an array, and integerArgs[] is only applicable for arrays. Although this is "valid", it is likely not what you want. What it says is "create an array of ArrayLists". What you mean to do is ArrayList&lt;Integer&gt; integerArgs; ... integerArgs = new ArrayList&lt;Integer&gt;(); And you may want a more meaningful name, such as intList. However, if your goal is to convert strings that are known to be ints, into ints, you could use Integer.parseInt: int[] ints = new int[args.length]; for(int i = 0; i &lt; args.length; i++) { ints[i] = Integer.parseInt(args[i]); } To be safe, you should try/catch the conversion, in case bogus (non-integer) parameters are provided: try { ints[i] = Integer.parseInt(args[i]); } catch(NumberFormatException nfx) { throw new NumberFormatException("Cannot parse parameter index " + i + ": \"" + args[i] + "\""); }
answers question: http://stackoverflow.com/q/24966143

http://stackoverflow.com/q/25030534
tagged with: java
type: Question
answer count: 1
has answer: http://stackoverflow.com/a/25030619
score: 0
has title: Connecting to db with spring - org.springframework.beans.factory.BeanCreationException
has body: I want to setup a db connection over spring. Basically I am writing a program which just selects some colums from a db. For the selects I would like to use the entity manager of spring. My applicationContext.xml looks like that: &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;beans xmlns="http://www.springframework.org/schema/beans" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:context="http://www.springframework.org/schema/context" xmlns:security="http://www.springframework.org/schema/security" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.2.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.2.xsd"&gt; &lt;context:annotation-config /&gt; &lt;context:component-scan base-package="com.TestProject" annotation-config="true" /&gt; &lt;tx:annotation-driven transaction-manager="transactionManager" proxy-target-class="true" /&gt; &lt;bean id="mainGUI" class="com.TestProject.gui.MainWindow" /&gt; &lt;bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"&gt; &lt;property name="driverClassName" value="oracle.jdbc.OracleDriver" /&gt; &lt;property name="url" value="jdbc:oracle:thin:@theUrl.com:6666" /&gt; &lt;property name="username" value="test" /&gt; &lt;property name="password" value="testPass" /&gt; &lt;property name="maxActive" value="20" /&gt; &lt;/bean&gt; &lt;bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager"&gt; &lt;/bean&gt; &lt;bean id="entityManager" class="org.springframework.orm.jpa.support.SharedEntityManagerBean" /&gt; &lt;bean class="org.springframework.orm.…
type: UnansweredQuestion
tagged with: transactionmanager
tagged with: spring
tagged with: spring-mvc

http://stackoverflow.com/a/25018271
upvote count: 4
downvote count: 0
has body: You can use TimeLine And KeyFrames. Just replace showTime() with your own code. and do not extend thread. public class FXMLTimeController implements Initializable { @FXML private TextField txtTime; //timeline private Timeline timeline; private void showTime() { txtTime.setText((new Date()).toString()); } @Override public void initialize(URL url, ResourceBundle rb) { timeline = new Timeline(); timeline.setCycleCount(Timeline.INDEFINITE); timeline.setAutoReverse(false); timeline.getKeyFrames().add( new KeyFrame(Duration.seconds(1), new EventHandler&lt;ActionEvent&gt;() { @Override public void handle(ActionEvent event) { showTime(); } })); timeline.play(); } }
answers question: http://stackoverflow.com/q/25017351
score: 4
type: Answer

http://stackoverflow.com/a/24994551
downvote count: 0
has body: If your customer sends you an XML file with a header where the encoding does not match file contents, you might as well give up to try and do anything meaningful with that file. - Are they really sending data where the header does not match the actual encoding? That's not XML, then. And you ought to charge them more ;-) Simply read the file as a FileInputStream, byte by byte. If it contains a negative byte value, refuse to process it. You can keep encoding settings like UTF-8 or ISO 8859-1, because they all have US-ASCII as a proper subset.
type: Answer
answers question: http://stackoverflow.com/q/24994107
upvote count: 1
score: 1

http://stackoverflow.com/q/25067742
tagged with: java
accepted answer: http://stackoverflow.com/a/25067811
type: Question
has title: Joda Time Interval Not returning what I expect
answer count: 1
has answer: http://stackoverflow.com/a/25067811
score: 0
has comment: http://stackoverflow.com/comment/38998316
has body: I have the following program import java.util.*; import java.text.*; import org.joda.time.*; public class ScopeControl { public static Interval getInterval() { DateTime currDate = new DateTime(2008, 4, 4, 15, 30, 0, 0); DateTime epochDate = new DateTime(2000, 1, 1, 12, 0, 0, 0); Interval interval = new Interval(epochDate, currDate); return interval; } public static void main(String[] args) { double daysBtween = getInterval().toDurationMillis()/1000/60/60/24; StdOut.println(daysBtween); } } I'm getting the output: 3016.0 but what I'm looking for is: 3016.1458333333 What am I doing wrong?
type: AnsweredQuestion

http://stackoverflow.com/q/24932145
score: 0
tagged with: java
type: Question
tagged with: jsp
has body: I have page where you have drop-down-box and textarea. Drop down box is populated with values got from DB. I know how to do it using scriplets but I want to use strictly servlet solution. Problem is I know how to use them when for example you click on some bottom in form etc. But where I have a menu with a link I have no idea what to do. Is that GET request? My link is just http://localhost:8080/TestPage/functionNamesRegister.jsp and from there I jump straight into page with that form. Should I add annotation @WebServlet("functionNamesRegister") and then create a servlet with that name? That is code from menu Register FM Function Names I am quite new to the servlets I know how to execute them when I have something like: I would really appreciate any help from you guys.
tagged with: servlets
has title: Servlet Execution on Link Click
answer count: 3
has comment: http://stackoverflow.com/comment/38748465
has comment: http://stackoverflow.com/comment/38747553
has answer: http://stackoverflow.com/a/24935087
has answer: http://stackoverflow.com/a/24933930
has comment: http://stackoverflow.com/comment/38747594
has answer: http://stackoverflow.com/a/24932686
type: UnansweredQuestion

http://stackoverflow.com/q/24992050
type: Question
score: 0
has comment: http://stackoverflow.com/comment/38855206
tagged with: directory
has comment: http://stackoverflow.com/comment/38855316
has title: Java Optimal way saving directory paths
type: UnansweredQuestion
has body: What is the best way to save directory paths by keeping the ability of calling them fast? As an example: - private static String Path1 = "C:\\b\\x"; - private static String Path2 = "C:\\b\\xy"; - private static String Path3 = "C:\\b\\xyz"; A call would look like: funccall(Path1+"\\app"); My first approach was to make them static, but i have over 60 paths to save so it gets a little bit confusing. Is it good practice to save them into an HashMap? regards Stefan
answer count: 0
has comment: http://stackoverflow.com/comment/38857279
tagged with: java
tagged with: directory-listing

http://stackoverflow.com/comment/38785749
comment on: http://stackoverflow.com/q/24954978
type: Comment
type: QuestionComment
has text: I tried to fix your formatting, but was entirely unable to decipher your expected results and what you actually get. And seeing the `InPUt`, this don't seem to be the actual code for that output.
score: 0

java-native-interface
tags question: http://stackoverflow.com/q/25068381
tags question: http://stackoverflow.com/q/25011597
tags question: http://stackoverflow.com/q/24955953
tags question: http://stackoverflow.com/q/25020536
tags question: http://stackoverflow.com/q/24996017
type: Tag
tag name: java-native-interface
tags question: http://stackoverflow.com/q/25029464
tags question: http://stackoverflow.com/q/25019762
tags question: http://stackoverflow.com/q/24930044
tags question: http://stackoverflow.com/q/25025956
tags question: http://stackoverflow.com/q/25058574
tags question: http://stackoverflow.com/q/25050643
tags question: http://stackoverflow.com/q/24915555
tags question: http://stackoverflow.com/q/25000316
tags question: http://stackoverflow.com/q/24991970
tags question: http://stackoverflow.com/q/24995953
tags question: http://stackoverflow.com/q/25028314
tags question: http://stackoverflow.com/q/24943155
tags question: http://stackoverflow.com/q/24929345
tags question: http://stackoverflow.com/q/25013979
tags question: http://stackoverflow.com/q/24910171
tags question: http://stackoverflow.com/q/24990194
tags question: http://stackoverflow.com/q/24936348

http://stackoverflow.com/q/25042502
answer count: 1
has body: I have some code that uses Google App Engine Datastore statistics, and I would like to test this method. I have the following code in order to test this: @RunWith(MockitoJUnitRunner.class) public class MyTest { private final LocalServiceTestHelper helper = new LocalServiceTestHelper(new LocalDatastoreServiceTestConfig()); @Before public void setUp() throws Exception { helper.setUp(); } @After public void tearDown() { helper.tearDown(); } @Test public void getKinds() { DatastoreService datastoreService = DatastoreServiceFactory.getDatastoreService(); assertEquals(0, datastoreService.prepare(new Query("yam")).countEntities(withLimit(10))); datastoreService.put(new Entity("yam")); datastoreService.put(new Entity("yam")); Iterable&lt;Entity&gt; kinds = datastoreService.prepare(new Query("__Stat_Kind__")).asIterable(); System.out.println("In 'getKinds'"); for (Entity kind : kinds) { System.out.println(kind.getProperty("kind_name").toString()); } } } I am expecting this to print In 'getKinds' yam But I am only getting In 'getKinds' Am I missing something in my code, or is there another way to test datastore statistics? Thanks. Reference links: https://developers.google.com/appengine/docs/java/tools/localunittesting https://developers.google.com/appengine/docs/java/datastore/stats
type: UnansweredQuestion
score: 0
has title: How to test GAE datastore statistics
tagged with: unit-testing
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/25046149
tagged with: google-app-engine

http://stackoverflow.com/a/24949004
downvote count: 0
has body: Handlers by default are created on the (Looper) thread that they are instantiated in. To ensure that a Handler is on the main UI thread, you can do this: Handler myHandler = new Handler(Looper.getMainLooper()); Then, to post items to the main thread, create a class that implements the Runnable interface then post to the Handler. myHandler.post(new Runnable() { @Override public void run() { // Code to run on UI thread. } }); Another handy dandy trick is you can post to a View that's visible of your Activity. For example your root view. View myView = findViewById(R.id.myViewId); Runnable runnableObject = new MyRunnableObject(); myView.post(runnableObject); Some things to note about this. Everything posted to Views will run on the UI thread. Items posted to Views will not execute until the View is on the View tree. You can post Runnables to your View, and then they all fire the second the View is visible to the user. It should also be noted that it's not particularly easy to cancel Runnables that have been posted to Views. They use a Handler internally, but the remove____() methods are abstracted out.
type: Answer
upvote count: 2
accepted answer of: http://stackoverflow.com/q/24948880
answers question: http://stackoverflow.com/q/24948880
score: 2
type: AcceptedAnswer

http://stackoverflow.com/comment/38800564
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24958148
has text: I cannot edit the schema, I have to work with the given schema and produce an XML file which can be validated with that schema.
type: Comment

http://stackoverflow.com/a/25059528
upvote count: 2
accepted answer of: http://stackoverflow.com/q/25059482
answers question: http://stackoverflow.com/q/25059482
type: AcceptedAnswer
downvote count: 0
has body: I think the alarm manager you are using to start the service is restarting the service for you,You have to stop that alarm,Stop the alarm like this Intent intent = new Intent(this, YourService.class); PendingIntent pendingIntent = PendingIntent.getBroadcast(getApplicationContext(), 1253, intent, 0); AlarmManager alarmManager = (AlarmManager) getSystemService(ALARM_SERVICE); alarmManager.cancel(pendingIntent); pass the SAME ID FOR THE PENDING INTENT which you used while creating the pending intent
type: Answer
score: 2

http://stackoverflow.com/q/24968820
downvote count: 0
linked to: http://stackoverflow.com/q/12313156
tagged with: java
type: Question
has title: How to use different validate methods in one action class in Struts 2
score: 4
tagged with: struts2
has body: I have an action class and it has two action methods in it. I want separate validate methods for it. I am new to Struts2. I want something like this. I think it can be implemented by validation interceptor but how? public class ApplicantRegistration extends ActionSupport{ public String method1(){ // validate1 } public String method2(){ // validate2 } @override public void validate1(){ // validations } public void validate2(){ //validations } }
tagged with: struts2-interceptors
linked to: http://stackoverflow.com/q/18222955
has answer: http://stackoverflow.com/a/24969667
tagged with: validation
accepted answer: http://stackoverflow.com/a/24969667
answer count: 1
has comment: http://stackoverflow.com/comment/38825338
favorite count: 0
upvote count: 4
type: AnsweredQuestion

http://stackoverflow.com/q/24909667
favorite count: 0
possible better answer: http://stackoverflow.com/a/32607101
has body: We have a Java webstart application and want to deploy/copy all third-party libraries into lib/ext/ and all of our project jar files into lib/ after the project has been built with Gradle. Using this answer to a previous question I was able to almost accomplish this, except that my shared project libraries are copied both to lib/ and lib/ext/. However, they should only be copied to lib/. Now I am looking for a way to exclude all shared project libraries from this task: task copyDeps(type: Copy) { from(subprojects.configurations.runtime) into project.file('lib/ext') } I was trying to add something like exclude(subprojects.jar), but I don't know how I can get all subproject jars in a parameter which I could pass to exclude(). How can I accomplish this? I am also open to other suggestions on how to accomlish the main goal of copying the libraries to the above mentioned folders.
accepted answer: http://stackoverflow.com/a/24936415
has answer: http://stackoverflow.com/a/32607101
has title: Excluding all subproject jars from a copy task in Gradle
tagged with: shared-libraries
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/38701103
tagged with: gradle
type: Question
linked to: http://stackoverflow.com/q/24868668
has answer: http://stackoverflow.com/a/24936415
score: 4
upvote count: 4
has comment: http://stackoverflow.com/comment/38734995
answer count: 2
tagged with: groovy
downvote count: 0
tagged with: jar

http://stackoverflow.com/a/48522091
has body: Solved the problem by providing the implementation of WebApplicationInitializer public class SpringDispatcherConfig implements WebApplicationInitializer { @Override public void onStartup(ServletContext servletContext) throws ServletException { AnnotationConfigWebApplicationContext Contianer = new AnnotationConfigWebApplicationContext(); Contianer.register(SpringConfig.class); Contianer.setServletContext(servletContext); DispatcherServlet dispatcherServlet = new DispatcherServlet(Contianer); dispatcherServlet.setThrowExceptionIfNoHandlerFound(true); Dynamic servlet = servletContext.addServlet("spring",dispatcherServlet); servlet.addMapping("/"); servlet.setLoadOnStartup(1); }
type: Answer
upvote count: 0
answers question: http://stackoverflow.com/q/25030008
score: -1
downvote count: 1

http://stackoverflow.com/comment/38828886
comment on: http://stackoverflow.com/a/24947642
has text: Don't know how are you doing it, I have shared a running code.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/24911509
answers question: http://stackoverflow.com/q/24911393
type: Answer
has body: The DataInputStream works with the binary data, while the BufferedReader work with character data. All primitive data types can be handled by using the corresponding methods in DataInputStream class, while only string data can be read from BufferedReader class and they need to be parsed into the respective primitives. DataInputStream is a part of filtered streams, while BufferedReader is not. DataInputStream consumes less amount of memory space being it is binary stream, where as BufferedReader consumes more memory space being it is character stream. The data to be handled is limited in DataInputStream, where as the number of characters to be handled has wide scope in BufferedReader.
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/38703827
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24911393

http://stackoverflow.com/a/24926618
score: 0
has comment: http://stackoverflow.com/comment/38732326
type: Answer
has comment: http://stackoverflow.com/comment/38732392
has comment: http://stackoverflow.com/comment/38732370
has body: I guess you are missing @Entity from the main POJO try it like @Entity @Table(name = "table_records") public class SampleClass implements Serializable
answers question: http://stackoverflow.com/q/24926401

http://stackoverflow.com/a/24982975
type: Answer
score: 3
downvote count: 0
upvote count: 3
has body: Your problem is in this.Analyze();. It should be inside some method. Though it's not clear what this line is supposed to do anyway.
answers question: http://stackoverflow.com/q/24982964

http://stackoverflow.com/q/24927977
has comment: http://stackoverflow.com/comment/38740181
type: Question
tagged with: gwt
score: 3
has answer: http://stackoverflow.com/a/34636092
answer count: 2
has body: I'm new in GWT! Can anyone help me to implement a context menu with GWT? I have seen some example like: MenuBar options = new MenuBar(true); MenuBar gwtPopup = new MenuBar(true); options.addItem("GWT", gwtPopup ); MenuItem entryPoint = new MenuItem(new SafeHtmlBuilder().appendEscaped("EntryPoint").toSafeHtml()); entryPoint.setScheduledCommand(new ScheduledCommand() { public void execute() { Window.alert( "hello" ); } } ); final DialogBox menuWrapper = new DialogBox( true ); menuWrapper.add( options ); gwtPopup.addItem( entryPoint ); Button showMenu = new Button( "Click me", new ClickHandler() { public void onClick( ClickEvent event ) { menuWrapper.showRelativeTo( menuWrapper ); } } ); RootPanel.get().add( showMenu ); but it doesn't works. Thanks.
has answer: http://stackoverflow.com/a/24931069
has comment: http://stackoverflow.com/comment/38734905
downvote count: 0
favorite count: 0
type: UnansweredQuestion
has title: How to implement context menu with native GWT (Java)?
has comment: http://stackoverflow.com/comment/38738553
tagged with: contextmenu
upvote count: 3
tagged with: java

http://stackoverflow.com/comment/38849120
type: AnswerComment
comment on: http://stackoverflow.com/a/24988334
has text: They are values by their nature, you could use them like: Test t = Test.FIRST or String s = Test.FIRST.name()
score: 0
type: Comment

http://stackoverflow.com/comment/38803118
comment on: http://stackoverflow.com/q/24963869
has text: JSTL functions may help - http://docs.oracle.com/javaee/5/tutorial/doc/bnalg.html
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/comment/39000967
has text: Well I don't want it to skip anything and I want the loop to exit properly. I haven't debugged it yet but even if i did, I wouldn't know exactly what to do. I am still new to coding.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25069047

http://stackoverflow.com/q/24985465
tagged with: java
has body: Whenever i change the condition to i==2 or i==3 i always get NPE but not in case of 5 why? I have no more details to add the question is self explanatory i guess import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Random; public class Test{ public static void main(String args[]) throws Exception{ List&lt;X&gt; arr=new ArrayList&lt;X&gt;(); for(int i=0;i&lt;5;i++){ arr.add(new X(i)); if(i==5){ arr.add(null); } } Collections.sort(arr); for(X x:arr){ System.out.println(x.i); } } } class X implements Comparable{ public int i; public X(int i2) { i=i2; } @Override public int compareTo(Object o) { return new Random().nextInt(10)-5; } }
has answer: http://stackoverflow.com/a/24985500
answer count: 4
possible better answer: http://stackoverflow.com/a/24985488
downvote count: 5
has answer: http://stackoverflow.com/a/24985488
has answer: http://stackoverflow.com/a/24985508
has title: Why am i NOT getting null pointer exception in this case while adding null to a list and sorting it
tagged with: nullpointerexception
type: AnsweredQuestion
upvote count: 0
score: -5
favorite count: 0
has comment: http://stackoverflow.com/comment/38842943
type: Question
has comment: http://stackoverflow.com/comment/38842896
has answer: http://stackoverflow.com/a/24985484
accepted answer: http://stackoverflow.com/a/24985484
has comment: http://stackoverflow.com/comment/38842899

http://stackoverflow.com/comment/38719187
comment on: http://stackoverflow.com/q/24917112
has text: I updated the code. It's still not working, but it works better now :)
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38773856
comment on: http://stackoverflow.com/a/24948120
score: 0
type: AnswerComment
type: Comment
has text: In the first line of his post, he asks how to go through the array from a specific index. He gave what he found, ie the enhanced for loop, and asks if it's okay, which it isn't.

http://stackoverflow.com/a/24974281
type: Answer
answers question: http://stackoverflow.com/q/24931615
upvote count: 1
has body: Annotations have their advantages and disadvantages, and there is a lot to say about choosing to create an annotation based API versus a (how you say) "traditional" API using interfaces. I won't go into that since you'll find plenty of wars online. Used correctly, annotations provide better information about what a class/method's responsibility is. Many prefer annotations and as such they have become a trend and they are used everywhere. With that out of the way, let's get back to your question: Why did this implementation do things this way using annotations? Before looking at this, I would have expected there to be an abstract OnMessage function which needs to be overridden and explicit registration functions for Encoder and Decoder. Instead of such a "traditional" approach, why does the websocket implementation do it via annotations? Actually they don't. Annotation is just a provided way of using the API. If you don't like it then you can do it the old way. Here is from the JSR-356 spec: There are two main means by which an endpoint can be created. The first means is to implement certain of the API classes from the Java WebSocket API with the required behavior to handle the endpoint lifecycle, consume and send messages, publish itself, or connect to a peer. Often, this specification will refer to this kind of endpoint as a programmatic endpoint. The second means is to decorate a Plain Old Java Object (POJO) with certain of the annotations from the Java WebSocket API. The implementation then takes these annotated classes and creates the appropriate objects at runtime to deploy the POJO as a websocket endpoint. Often, this specification will refer to this kind of endpoint as an annotated endpoint. Again, people prefer using annotations and that's what you'll find most of tutorials using, but you can do without them if you want it bad enough.
has comment: http://stackoverflow.com/comment/47458540
has comment: http://stackoverflow.com/comment/47377759
accepted answer of: http://stackoverflow.com/q/24931615
score: 1
has comment: http://stackoverflow.com/comment/38827146
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/24933484
accepted answer of: http://stackoverflow.com/q/24933421
upvote count: 8
has comment: http://stackoverflow.com/comment/38745598
answers question: http://stackoverflow.com/q/24933421
has body: try this code your button ID is R.id.advanced_button and you have written R.id.advancedButton public void onClick(View arg0) { // TODO Auto-generated method stub switch(arg0.getId()){ case R.id.advanced_button: Intent a = new Intent(Registration.this, RegistrationAdvanced.class); startActivity(a); break; } } Edit i follow naming convention like viewType_layoutName_ViewName So i not cofuse at the time of Writing R.id.XXXX For example in your case my button id will like this R.id.btn_registration_advance its reduce chance to mix up IDs ...
has comment: http://stackoverflow.com/comment/38745216
type: AcceptedAnswer
downvote count: 1
has comment: http://stackoverflow.com/comment/38745169
type: Answer
has comment: http://stackoverflow.com/comment/38745185
score: 7

http://stackoverflow.com/a/24965905
answers question: http://stackoverflow.com/q/24960408
has body: You can verify with Mockito Matchers. If you only care that the method is called with some Entity, you can verify that with verify(daoInterface).insert(any(Entity.class)); If you care about which Entity, and the Entity class has an equals method, you can make an entity that should be equal to the one created and verify with verify(daoInterface).insert(eq(expectedEntity); If it's more complex than either of these cases, you can also write your own argument matchers.
downvote count: 0
score: 1
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38807633
accepted answer of: http://stackoverflow.com/q/24960408
type: Answer

http://stackoverflow.com/a/25044896
has comment: http://stackoverflow.com/comment/38988139
upvote count: 1
has body: I am not sure how much of an answer this is Something similar is happening when i try it as well. I am quite sure its an Eclipse thing though, because if you run it on cmd, it works just fine. I found a way around it that prints all characters fine for me. So, assuming you have a fixed width of 80 characters lets say. Then you can do the following: public static void delayedPrint(int delay, String s){ int charCounter = 0; try { for (char c : s.toCharArray()){ System.out.print(c); charCounter++; if(charCounter % 80 == 0) System.out.println();//Replace 80 with your console width Thread.sleep(delay); } }catch (InterruptedException e){ } System.out.println(); } So basically force a linebreak every time you reach the console width. I am not sure how useful it is for you. Hope it helps.
score: 1
accepted answer of: http://stackoverflow.com/q/25044081
answers question: http://stackoverflow.com/q/25044081
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/comment/38766409
type: QuestionComment
has text: @AdrianPang: Details added
type: Comment
score: 0
comment on: http://stackoverflow.com/q/24944304

http://stackoverflow.com/q/25035171
score: 0
tagged with: java
tagged with: selenium
tagged with: loops
answer count: 1
has body: I got this issue. I want to loop in my selenium webdriver this function: driver.findElement(By.id("some id")).sendKeys("Example 1"); But i want that every next generated elemented was "Example 2","Example 3","Example 4" etc. and so on. Is there a simple method for that ? OK. I've managed it by making this: int x = 1; while (x&lt;20) { driver.findElement(By.id("some id")).sendKeys("Example" + x);x++; }
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38984645
type: Question
has title: Looping a selenium webdriver script in java but with different values
has comment: http://stackoverflow.com/comment/38940921
has answer: http://stackoverflow.com/a/25037394

http://stackoverflow.com/comment/38855436
has text: If you have an index on the `Email_Address` column, (NOT) IN can use this index to speed up lookups. EXCEPT always creates a temporary sorted table for the first query, then deletes all rows from the second query.
comment on: http://stackoverflow.com/a/24990838
type: AnswerComment
type: Comment
score: 0

http://stackoverflow.com/a/24921658
answers question: http://stackoverflow.com/q/24920168
has comment: http://stackoverflow.com/comment/39230460
has body: Try forcing the look and feel to use the "system" look and feel... public void run() { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) { ex.printStackTrace(); } //... This should ensure that it overrides any other settings... Take a look at How to Set the Look and Feel for more details
score: 1
has comment: http://stackoverflow.com/comment/39133725
upvote count: 1
has comment: http://stackoverflow.com/comment/39232069
downvote count: 0
has comment: http://stackoverflow.com/comment/38765933
has comment: http://stackoverflow.com/comment/39231141
has comment: http://stackoverflow.com/comment/39148914
has comment: http://stackoverflow.com/comment/38751250
type: Answer

http://stackoverflow.com/comment/38974916
score: 0
type: Comment
type: QuestionComment
has text: 1) Change the value type of the map to `List`. 2) User `hashMap.get("users").get(0)`
comment on: http://stackoverflow.com/q/25055508

http://stackoverflow.com/comment/38815548
type: Comment
score: 1
has text: VG At least somebody recognized that you don't have to calculate both factorials.
comment on: http://stackoverflow.com/a/24970984
type: AnswerComment

http://stackoverflow.com/a/25008548
score: 0
answers question: http://stackoverflow.com/q/25003526
type: Answer
accepted answer of: http://stackoverflow.com/q/25003526
has body: You need to take layout for that. &amp; inside layout you can put edittext &amp; next to it button For Example, &lt;RelativeLayout&gt; &lt;Edittext&gt; &lt;Button&gt; &lt;/RelativeLayout&gt; This is a simple sample case to implement above functionality. You need to mange design as per your requirement. &amp; on button click you can add number of contacts in edittext setText() method separating by them ",".
type: AcceptedAnswer

http://stackoverflow.com/q/24957513
favorite count: 0
has comment: http://stackoverflow.com/comment/38791140
has title: Exception in hibernate-validator. nested exception is java.lang.NoClassDefFoundError: ConfigurationImpl
tagged with: hibernate-validator
has body: Details: I am making form-validation using javax-validation and hibaernate-validator in Spring. Other than basic necessary JAR files for Spring. I have included: validation-api-1.1.0.Final hibernate-validator-5.1.0.Final I read somewhere that spl4j version is also in concern: so I'm also telling: ###slf4j-api-1.7.5### ###slf4j-simple-1.7.5### ###log4j-1.2.17### Can the cause of error be due to slf4j and log4j compatibility? I use annotation base validation. Let me provide some code: Customer.java import java.util.Date; import javax.validation.constraints.Max; import javax.validation.constraints.Min; import javax.validation.constraints.NotNull; import javax.validation.constraints.Past; import javax.validation.constraints.Size; import org.hibernate.validator.constraints.Email; import org.hibernate.validator.constraints.NotEmpty; import org.springframework.format.annotation.DateTimeFormat; public class Customer { @Size(min=2, max=30) @NotEmpty private String name; @NotEmpty @Email private String email; @NotNull @Min(18) @Max(100) private Integer age; public String getName() { return name; } public void setName(String name) { this.name = name; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public Integer getAge() { return age; } public void setAge(Integer age) { this.age = age; } } CustomerController.java import javax.validation.Valid; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.context.MessageSource; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.validation.BindingResult; import org.springframework.validation.FieldError; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.a…
tagged with: spring
has comment: http://stackoverflow.com/comment/38791323
score: 4
type: AnsweredQuestion
tagged with: java
tagged with: hibernate
downvote count: 1
has answer: http://stackoverflow.com/a/25032444
type: Question
upvote count: 5
has comment: http://stackoverflow.com/comment/38791247
has comment: http://stackoverflow.com/comment/38790560
tagged with: validation
answer count: 1
accepted answer: http://stackoverflow.com/a/25032444
has comment: http://stackoverflow.com/comment/38926857

http://stackoverflow.com/a/25041820
accepted answer of: http://stackoverflow.com/q/25021155
type: Answer
answers question: http://stackoverflow.com/q/25021155
has body: I used byte[] instead of InputStream. which seemed to remedy the problem with 20mb files, as our QA server only has 124 mb.
score: 0
type: AcceptedAnswer

http://stackoverflow.com/q/24967352
linked to: http://stackoverflow.com/q/2591098
has answer: http://stackoverflow.com/a/24967483
has comment: http://stackoverflow.com/comment/38809150
upvote count: 3
answer count: 3
favorite count: 0
has answer: http://stackoverflow.com/a/75569102
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38808983
has comment: http://stackoverflow.com/comment/38813879
score: 3
downvote count: 0
has title: Deserialize Document type to a Java Class
tagged with: java
has body: Is it possible to deserialize a "org.w3c.dom.Document" type into a Java class? We have this class (Employee), and we have an existing method in our application that calls a web service and returns a "Document" type of the Employee class. Can we serialize the Document to Employee class? Can you please show some example? Most of the sample I found from the internet reads an XML file in a directory then deserialize it to the class. But in our scenario, the object is a Document type. What I'm trying to achieve is something like as below (pseudocode): String employeeID = "12344444"; org.w3c.dom.Document xmlEmployee = helperClass.callWebServiceEmployee(employeeID); EmployeeClass employee = new EmployeeClass(); employee = (EmployeeClass)xmlEmployee.
has comment: http://stackoverflow.com/comment/38808999
has comment: http://stackoverflow.com/comment/38808976
linked to: http://stackoverflow.com/q/13731322
has answer: http://stackoverflow.com/a/24967544
type: Question
has comment: http://stackoverflow.com/comment/38809174
has comment: http://stackoverflow.com/comment/38808967

http://stackoverflow.com/q/25038034
tagged with: jacoco
has body: Hi I am trying to exclude classes for my code coverage using jacoco. I want to exclude the gui folder and all the classes inside it. com.project/folder/tools/gui/*.class com.project -> folder -> tools -> gui I have tried many different paths but for some reason it wont exclude any of them. Am I doing this wrong? Can anyone point me in the right direction.
downvote count: 0
has answer: http://stackoverflow.com/a/63682984
answer count: 3
has answer: http://stackoverflow.com/a/25057005
favorite count: 0
has title: Jacoco exclude classes
upvote count: 3
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/47871741
has answer: http://stackoverflow.com/a/28147991
tagged with: unit-testing
type: Question
score: 3
tagged with: java

http://stackoverflow.com/comment/38756161
type: Comment
comment on: http://stackoverflow.com/a/24939210
has text: thanks very much...this wasn't clear to me. as soon as possible I'll accept your answer...it says I have to wait for 12 minutes before :S
score: 0
type: AnswerComment

http://stackoverflow.com/a/28024683
has body: Recently I've faced the same problem and found a solution. What is really happens are that inner declaration of Runnable is kicking all your mocks out! 'Cause the Runnable class is loaded by bootstrap Classloader, PowerMock has no way to mock any action inside. The solution (to me) is declare the instantiation outside Runnable inner class.
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24960051
type: Answer
answers question: http://stackoverflow.com/q/24960051
score: 2
downvote count: 0
upvote count: 2

http://stackoverflow.com/a/25027972
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/25014993
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/25014993
has body: Please understand how the mongo query works, As of mongodb is concerned, The query pattern and projection pattern are in this way, collection.find(query,projection); --&gt; grade.find({type:exam,_id:0},{score:1}); So It it obvious that, you need to separate query and projection part. So Give in the following way to execute your query as expected, String json = "{'type':'exam','student_id':0}"; DBObject dbObj = (DBObject) JSON.parse(json); DBObject projection = (DBObject) JSON.parse("{'score':1,}"); System.out.println(dbObj); Dao dao = new Dao(); final DBCollection collection = dao.getDb("test").getCollection("test"); **List&lt;DBObject&gt; dbOList=collection.find(dbObj,projection).toArray();** System.out.println(dbOList); This gives you the result as expected, So for sure you need to seperate the query and projection part as above. you will get the result as list of score field alone (with ID as default) [{ "_id" : { "$oid" : "53d8574e26b7d8cafbf80f9b"} , "score" : 54.6535436362647}] Thanks and Regards, Hari
type: Answer

mouse-picking
type: Tag
tag name: mouse-picking
tags question: http://stackoverflow.com/q/24944576

http://stackoverflow.com/a/24964772
answers question: http://stackoverflow.com/q/24964598
has comment: http://stackoverflow.com/comment/38804432
has body: Classloader/security/correct-environment/correct-context concerns aside: put TestJar.jar on your application's classpath from your application, invoke /*TestJar ignored =*/ new TestJar();
score: 0
type: Answer

http://stackoverflow.com/comment/38774342
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24948579
has text: TheLostMind and Hari have as good of an answer as any. Finializers are bad, stay away from them. Try to find an alternative, like [ReferenceQueue](http://docs.oracle.com/javase/7/docs/api/java/lang/ref/ReferenceQueue.html)s if you must, but the best option is not to do anything, just allow the object to be garbage collected.

http://stackoverflow.com/q/24910827
upvote count: 3
downvote count: 2
tagged with: mysql
has body: I'm making a simple phone book diary, so here is my database schema: create database if not exists Rajendra; use Rajendra; create table if not exists family(name varchar(50), mobile varchar(50)); select * from family; Now, i'm inserting values from input dialog boxes but that's giving me this kind of errors: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown column 'raj' in 'field list' at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) at java.lang.reflect.Constructor.newInstance(Unknown Source) at com.mysql.jdbc.Util.handleNewInstance(Util.java:411) at com.mysql.jdbc.Util.getInstance(Util.java:386) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1054) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4237) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4169) at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2617) at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2778) at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2819) at com.mysql.jdbc.StatementImpl.executeUpdate(StatementImpl.java:1811) at com.mysql.jdbc.StatementImpl.executeUpdate(StatementImpl.java:1725) at phonebook.MainProgram$2.actionPerformed(MainProgram.java:76) at javax.swing.AbstractButton.fireActionPerformed(Unknown Source) at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source) at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source) at javax.swing.DefaultButtonModel.setPressed(Unknown Source) at javax.swing.AbstractButton.doClick(Unknown Source) at javax.swing.plaf.basic.BasicMenuItemUI.doClick(Unknown Source) at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(Unknown Source) at java.awt.Component.processMouseEvent(Unknown Source) at javax.swing.JComponent.processMouseEvent(Unknown Source) at java.awt.Component.processEvent(Unknow…
type: Question
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/24911158
answer count: 3
has title: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown column 'raj' in 'field list' at sun.reflect
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24910884
has answer: http://stackoverflow.com/a/24910958
tagged with: jdbc

http://stackoverflow.com/a/24972020
answers question: http://stackoverflow.com/q/24970760
upvote count: 2
type: Answer
score: 2
has body: I've tried setting Insets, to 0, 0, 0, 110 and it moves the logo to the left a bit, not sure why. That's because insets are, in order: top, left, bottom, right Try 0, 0, 110, 0 instead to offset it from the bottom.
downvote count: 0

http://stackoverflow.com/q/25001914
has comment: http://stackoverflow.com/comment/38878551
tagged with: java
tagged with: gradle
type: Question
has comment: http://stackoverflow.com/comment/38875285
tagged with: build-process
has title: Copy jars including all dependecies into common directory using gradle
score: 0
answer count: 0
has body: I have a multi-module gradle build setup. Directory structure: api/ build.gradle common/ build.gradle master/ settings.gradle build.gradle settings.gradle: includeFlat "api", "common" api build.gradle: dependencies { compile project(':common') } common build.gradle: dependencies { // all common dependencies here } master build.gradle subprojects { apply plugin: 'java' task copyLibraries(type: Copy) { into "../lib/" from configurations.compile } jar { destinationDir = new File("../lib/") } } I run 'gradle clean build copyLibraries'. common.jar is 0kb. api.jar is copied correctly and has the correct code included, but some common is completely empty. All of the library jars are included correctly. The above example is a small subset of our actual codebase. What I've noticed is any project dependency listed gets copied empty. So all of our leaf projects (not a dependency for any other project) get copied correctly, the rest do not. Is there something I am missing, or is there another better way to move all dependencies and jars into a common directory using gradle?
type: UnansweredQuestion

http://stackoverflow.com/q/25057107
has answer: http://stackoverflow.com/a/25057998
has comment: http://stackoverflow.com/comment/39017427
type: Question
linked to: http://stackoverflow.com/q/14229072
linked to: http://stackoverflow.com/q/22003802
tagged with: jtable
has comment: http://stackoverflow.com/comment/38977802
linked to: http://stackoverflow.com/q/24761621
answer count: 2
has answer: http://stackoverflow.com/a/60913047
tagged with: ms-access
has title: Code for populating a JTable with data from a MS Access database
type: UnansweredQuestion
tagged with: jdbc
tagged with: swing
has body: I am doing a Practical Assessment Task for my Grade 12 IT class. I am struggling with the code to populate my jTable (From the swing controls) in my GUI. I am using Netbeans as an IDE. The database connects using a jdbc:odbc bridge. This code is in a java class in my project. **please note that i am relatively inexperienced when it comes to coding Here is the code i have currently (but it gives no output in my jtable) if you can fix it, please explain what you did or if you can please give me code that will work :) db.setConnection(); Statement stmt = null; try { con = DriverManager.getConnection("jdbc:odbc:Driver={Microsoft Access Driver (*.mdb, *.accdb)}" + ";DBQ=src/TheChangeProjectDB.accdb"); stmt = con.createStatement(); } catch (SQLException ex) { JOptionPane.showMessageDialog(null, "Error: " + ex); } String sql = "SELECT * FROM KanyisaLearners"; try { ResultSet rs = stmt.executeQuery(sql); ResultSetMetaData md = rs.getMetaData(); int columns = md.getColumnCount(); for (int i = 1; i &lt;= columns; i++) { columnNames.addElement(md.getColumnName(i)); } while (rs.next()) { Vector row = new Vector(columns); for (int i = 0; i &lt;= columns; i++) { row.addElement(rs.getObject(i)); } data.addElement(row); } rs.close(); stmt.close(); } catch (Exception e) { System.out.println(e); } JTable table = new JTable(data, columnNames); JScrollPane scrollPane = new JScrollPane(table); getContentPane().add(scrollPane); JPanel buttonPanel = new JPanel(); getContentPane().add(buttonPanel, BorderLayout.SOUTH); KanyisaHoofskerm frame = new KanyisaHoofskerm(); frame.setDefaultCloseOperation(EXIT_ON_CLOSE); frame.pack(); frame.setTitle("Learners"); frame.setVisible(true);
score: 0
tagged with: java

http://stackoverflow.com/a/25045120
accepted answer of: http://stackoverflow.com/q/25043009
type: Answer
answers question: http://stackoverflow.com/q/25043009
upvote count: 1
has body: Try this String encodedString = URLEncoder.encode(s, "UTF-8");
type: AcceptedAnswer
downvote count: 0
score: 1

automated-tests
tags question: http://stackoverflow.com/q/25036819
tag name: automated-tests
type: Tag

http://stackoverflow.com/comment/38828410
score: 0
type: Comment
has text: Thanks, that's what I want to know :) I should have checked the document more carefully.
comment on: http://stackoverflow.com/a/24977728
type: AnswerComment

http://stackoverflow.com/comment/38974119
score: 0
type: Comment
type: QuestionComment
has text: sending values to constructor for each page
comment on: http://stackoverflow.com/q/25029364

http://stackoverflow.com/q/25000157
has body: I have two Java classes: public class foo{ protected int foo_func(){ //do stuff } } And also public class bar extends foo{ protected void bar_func(){ x = this.foo_func(); } } (It's worth noting that I didn't write these classes, I'm seeing them in a project I'm working on) Now, when I open up eclipse and look at the bar.java class I don't see any errors. Does the java compiler not see this as an issue? If not, what's the difference (in this case) between this.foo_func() and super.foo_func()?
tagged with: java
possible better answer: http://stackoverflow.com/a/25000775
type: Question
has comment: http://stackoverflow.com/comment/38870484
upvote count: 0
score: -2
has title: Using this vs super in an extended class
tagged with: inheritance
has answer: http://stackoverflow.com/a/25000973
has answer: http://stackoverflow.com/a/25000775
has answer: http://stackoverflow.com/a/25000178
accepted answer: http://stackoverflow.com/a/25000178
answer count: 3
favorite count: 0
downvote count: 2
type: AnsweredQuestion

http://stackoverflow.com/a/24970942
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/24970760
type: Answer
has body: There are other properties that you can use for better control on the width and height of the component in percentage. weightx Specifies how to distribute extra horizontal space. weighty Specifies how to distribute extra vertical space. It's better expanded under Swing Tutorial on How to Use GridBagLayout Try t.weighty=0.5; that will divide both in 50%-50% and place the component in the center as well. and let me know whether it looks as per your need or not? Use frame.pack() instead of frame.setSize() that fits the components as per component's preferred size. Override getPreferredSize() to set the preferred size of the JPanel instead of using setSize() method. sample code: JPanel panel = new JPanel() { @Override public Dimension getPreferredSize() { return new Dimension(..., ...); } };
upvote count: 5
score: 5
accepted answer of: http://stackoverflow.com/q/24970760

http://stackoverflow.com/comment/38897294
score: 4
comment on: http://stackoverflow.com/q/25014355
type: Comment
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).

http://stackoverflow.com/a/25021370
type: Answer
has body: It should be WHERE TST_CATAGORY='"+catg+"'", since a String parameter should be in quotes. That said, that's a very bad practice, and you run the risk of SQL injection. Use a prepared statement : String sql = "SELECT * " + "FROM AVAILABLE_TESTS " + "WHERE TST_CATAGORY=?"; PreparedStatement stmt = conn.prepareStatement(sql); stmt.setString (1, catg); ResultSet res = stmt.executeQuery ();;
score: 4
answers question: http://stackoverflow.com/q/25021329
upvote count: 4
downvote count: 0

http://stackoverflow.com/q/24969326
has title: hibernate.dialect must be set when no connection available
linked to: http://stackoverflow.com/q/18717555
has answer: http://stackoverflow.com/a/24969393
has answer: http://stackoverflow.com/a/24969494
type: AnsweredQuestion
has body: this is my Person.java class package com.hibernate.project.pos.model; import javax.persistence.*; @Entity @Table(name="testdb") public class Person { @Id @GeneratedValue(strategy=GenerationType.AUTO) @Column(name="id") private Long id; @Column(name="first", unique=true, length=100) private String firstName; @Column(name="last", unique=true, length=100) private String lastName; public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getFirstName() { return firstName; } public void setFirstName(String firstName) { this.firstName = firstName; } public String getLastName() { return lastName; } public void setLastName(String lastName) { this.lastName = lastName; } } this is my hibernate.cfg.xml file <?xml version="1.0" encoding="UTF-8"?> <hibernate-configuration> org.hibernate.dialect.MySQLInnoDBDialect com.mysql.jdbc.Driver jdbc:mysql://localhost:3306/testdb root create true true <mapping class="com.hibernate.project.pos.model.Person" /> </hibernate-configuration> MainHibernate.java class package com.hibernate.project.pos.model; import java.util.List; import javax.imageio.spi.ServiceRegistry; import org.hibernate.*; import org.hibernate.cfg.Configuration; import org.hibernate.service.ServiceRegistryBuilder; public class MainHibernate { public static void main(String[] args) { @SuppressWarnings("deprecation") SessionFactory sessionFactory = new Configuration().buildSessionFactory(); Person p = new Person(); p.setFirstName("dian"); p.setLastName("bodat"); Session session = sessionFactory.openSession(); try{ session.beginTransaction(); session.save(p); session.getTransaction().commit(); }catch(HibernateException hibernateException){ session.getTransaction().rollback(); } session.close(); session = sessionFactory.openSession(); Query query = session.createQuery("from testdb"); List<Person> persons = query.list(); for(Person person : persons){ System.out.println("id: "+person.getId()); System.out.println("first name : "+person.getFirstNa…
tagged with: java
tagged with: hibernate
tagged with: database
tagged with: eclipse
type: Question
has answer: http://stackoverflow.com/a/24969526
has comment: http://stackoverflow.com/comment/38816070
possible better answer: http://stackoverflow.com/a/24969494
score: 0
has comment: http://stackoverflow.com/comment/38812625
has answer: http://stackoverflow.com/a/24969904
answer count: 4
accepted answer: http://stackoverflow.com/a/24969904

http://stackoverflow.com/a/25085619
score: 0
type: Answer
has body: Sorry for the people who asked for an example of code, but it was as basic as that, with a Gradle build. I fixed the issue by creating a library project within my project. So module A is actually a Library. I said that I couldn't use library because of the non-constant-field, but that error was generated by AndroidAnnotations, which explains how to create library modules with it: https://github.com/excilys/androidannotations/wiki/Library-projects#referencing-ids-by-name Thanks.
accepted answer of: http://stackoverflow.com/q/25044823
answers question: http://stackoverflow.com/q/25044823
type: AcceptedAnswer

http://stackoverflow.com/a/24984518
has comment: http://stackoverflow.com/comment/38850394
score: 0
has body: All of this looks to me as if you were simply trying to invoke xjc from a Java program. (Why not from the command line, or maven, or...???) However, whatever system you are on, you might invoke xjc from Java using ProcessBuilder, where you can specify all required parameters and options, including `-b pathname' for specifying a binding file. Alternatively, you could insert all binding specs in the XML schema file. Later Warning: getOption is not guranteed to remain stable with future releases of xjc but there's no other way. com.sun.tools.xjc.api is not really meant to be used in applications. SchemaCompiler sc = ...; File bindings = new File(...); sc.getOptions().addBindFile( bindings ); You can also use the command line parser, which could simplify things if you have multiple options. String[] args = ...; // options and parameters as they appear on a command line int done = 0; while( done &lt; args.length ){ int eaten = 0; try { eaten = sc.getOptions().parseArgument( args, done ); } catch( com.sun.tools.xjc.BadCommandLineException bcle ){ // handle the exception } finally { done += eaten; } if( eaten == 0 ) break; // not recognized, can't continue, abort }
type: Answer
has comment: http://stackoverflow.com/comment/38848923
answers question: http://stackoverflow.com/q/24980109
has comment: http://stackoverflow.com/comment/38851315
accepted answer of: http://stackoverflow.com/q/24980109
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38967314
has comment: http://stackoverflow.com/comment/38972179

http://stackoverflow.com/a/25003407
has comment: http://stackoverflow.com/comment/38876708
type: Answer
has comment: http://stackoverflow.com/comment/38876838
has body: Operations on int occur many times faster than operations on enum. Judge for yourself. Each time you create a enum you create as a minimum: 1) Class-loader for it. 2) You keep this object in memory. 3) Since enum is static anonymous class - it will always hang in your memory (sometimes even after you close the application.) With regard to the Service. In this class, the flags are mainly used for comparisons and return the result to the class above (ContextWrapper). But basically, if you dig into the bowels of Android SDK you will discover for yourself that almost all these flags are used to bynary shift operations. Even in Java use a binary shift operations in JDK : /** * Max capacity for a HashMap. Must be a power of two &gt;= MINIMUM_CAPACITY. */ private static final int MAXIMUM_CAPACITY = 1 &lt;&lt; 30; Also you can look to Window class in Android SDK /** * Set the container for this window. If not set, the DecorWindow * operates as a top-level window; otherwise, it negotiates with the * container to display itself appropriately. * * @param container The desired containing Window. */ public void setContainer(Window container) { mContainer = container; if (container != null) { // Embedded screens never have a title. mFeatures |= 1&lt;&lt;FEATURE_NO_TITLE; mLocalFeatures |= 1&lt;&lt;FEATURE_NO_TITLE; container.mHasChildren = true; } } /** The default features enabled */ @SuppressWarnings({"PointlessBitwiseExpression"}) protected static final int DEFAULT_FEATURES = (1 &lt;&lt; FEATURE_OPTIONS_PANEL) | (1 &lt;&lt; FEATURE_CONTEXT_MENU); So reasons is two(at least): Less memory consumption. Working faster due bitwise operations.
has comment: http://stackoverflow.com/comment/38876913
has comment: http://stackoverflow.com/comment/38876782
has comment: http://stackoverflow.com/comment/38877775
downvote count: 0
score: 6
has comment: http://stackoverflow.com/comment/38955898
has comment: http://stackoverflow.com/comment/38921447
upvote count: 6
answers question: http://stackoverflow.com/q/25003208
has comment: http://stackoverflow.com/comment/38877599
has comment: http://stackoverflow.com/comment/38929655
has comment: http://stackoverflow.com/comment/38921339

http://stackoverflow.com/q/24963587
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
accepted answer: http://stackoverflow.com/a/25024338
type: Question
tagged with: amazon-sqs
has comment: http://stackoverflow.com/comment/38838151
has comment: http://stackoverflow.com/comment/38861511
has title: Elastic Beanstalk Work Tier - stop/start message processing
answer count: 1
downvote count: 0
linked to: http://stackoverflow.com/q/24172661
tagged with: amazon-elastic-beanstalk
favorite count: 0
has answer: http://stackoverflow.com/a/25024338
has body: Could I stop / start the message processing in Elastic Beanstalk Work Tier?

http://stackoverflow.com/comment/38968531
score: 0
has text: Thanks man. I moved the code around, but can't seem to be having formating issues with curley braces. I tried using source->format and try fixing it, but is still getting an error. I have posted an updated code in my initial post.
type: Comment
comment on: http://stackoverflow.com/a/25051871
type: AnswerComment

http://stackoverflow.com/q/24970760
answer count: 2
tagged with: user-interface
downvote count: 0
tagged with: layout-manager
favorite count: 0
has title: GridBagLayout - adding margin to constraints to move the component to top from center
upvote count: 2
has answer: http://stackoverflow.com/a/24970942
has answer: http://stackoverflow.com/a/24972020
score: 2
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/24972020
tagged with: swing
type: Question
tagged with: gridbaglayout
accepted answer: http://stackoverflow.com/a/24970942
has body: I am working on my first application to practice layout managers, I started learning the GridBagLayout and I want to create a login window, with a logo and a login box. Currently my app looks like this: (source: gyazo.com) I feel that the logo is way too close to the login box, and far away from the top - therefore I need to find a way to give the logo a margin from the bottom, so it goes a bit to the top, so there will be a space between the two components, and the logo will be near the top bar. Is it possible to do with GridBagLayout? I've tried setting Insets, to 0, 0, 0, 110 and it moves the logo to the left a bit, not sure why. @Override public void init() throws Exception { GridBagLayout layout = new GridBagLayout(); super.setLayout(layout); this.loginPane = new JPanel(); this.loginPane.setSize(400, 400); this.loginPane.setBackground(Color.RED); JTextField username = new JTextField(); username.setSize(200, 45); BufferedImage logo = ImageIO.read(new File("assets/logo.png")); JLabel logoLabel = new JLabel(new ImageIcon(logo)); GridBagConstraints t = new GridBagConstraints(); t.ipadx = logo.getWidth(); t.ipady = logo.getHeight(); t.gridx = 0; t.gridy = 0; super.add(logoLabel, t); t.ipadx = 500; t.ipady = 300; t.gridwidth = 1; t.gridheight = 1; t.gridy++; super.add(loginPane, t); } How can I do this?
has comment: http://stackoverflow.com/comment/38821939

http://stackoverflow.com/q/24967722
type: UnansweredQuestion
tagged with: maven
tagged with: git
score: 2
has answer: http://stackoverflow.com/a/24968052
downvote count: 0
has title: maven resourse pluggin error
tagged with: java
tagged with: eclipse
has comment: http://stackoverflow.com/comment/38809710
type: Question
tagged with: filenotfoundexception
has comment: http://stackoverflow.com/comment/38809645
has body: Failed to execute goal org.apache.maven.plugins:maven-resources-plugin:2.6:resources (default-resources) on project : Error loading property file 'D:\.... [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException This occurs when I import a git project in Eclipse. I tried mvn install, mvn package, but it gives the same error. And then I update my project as well, but still the same issue. How to solve this? This is with -e: [ERROR] Failed to execute goal org.apache.maven.plugins:maven-resources-plugin:2.6:resources (default-resources) on project anuragropu: Error loading property file 'D:\.\main\environments\${env}.properties' -&gt; [Help 1] org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-resources-plugin:2.6:resources (default- resources) on project anuragropu: Error loading property file 'D:\...\src\main\environments\${env}.properties' at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:216) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:108) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:76) at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:116) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:361) at org.apache.maven.DefaultMaven.execute(Defau…
upvote count: 2
answer count: 1
favorite count: 0

http://stackoverflow.com/comment/38740908
type: QuestionComment
comment on: http://stackoverflow.com/q/24927165
score: 2
has text: Got the point ! It means it is a jpeg file with tiff extension.
type: Comment

http://stackoverflow.com/comment/38743260
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24932335
has text: ok agreed. Also, found a post on the same topic at here: http://stackoverflow.com/questions/8066501/how-should-i-use-try-with-resources-with-jdbc May be someone can mark this one as duplicate. I don't have that privilege yet.

http://stackoverflow.com/comment/38932191
comment on: http://stackoverflow.com/q/25032924
type: QuestionComment
has text: Read the exception stacktrace from logcat to learn that you don't have a `D:` path on your Android device.
type: Comment
score: 1

http://stackoverflow.com/comment/38967291
has text: Thank you Michael. problem was on writing permission on sdcard. In Manifest file I just add permission rule and problem solved. Thank you so so much!
score: 2
type: AnswerComment
comment on: http://stackoverflow.com/a/25043804
type: Comment

http://stackoverflow.com/comment/38707975
comment on: http://stackoverflow.com/a/24913071
type: AnswerComment
score: 0
type: Comment
has text: Well the thing compiles on the PC where I wrote the thing to begin with. Is there something about the way I pass the location of the program that might be causing an issue?

http://stackoverflow.com/a/24968495
score: 0
type: Answer
has body: Finally I figured it out: copied everything from bin/res/crunch folder and pasted it in res and then deleted the crunch folder. If the library project is modified, the error will reappear. Redoing the procedure above will fix it again.
accepted answer of: http://stackoverflow.com/q/24937540
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24937540

http://stackoverflow.com/a/25068663
accepted answer of: http://stackoverflow.com/q/24920665
score: 0
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/24920665
has body: The answer is Struts 2 treats the codeArray variable inside the Action class as an Array: String [] codeArray; This is not documented.

http://stackoverflow.com/comment/38961822
score: 0
comment on: http://stackoverflow.com/q/25048238
type: Comment
has text: How about instead of screenshots view source in browser and look at the HTML
type: QuestionComment

http://stackoverflow.com/comment/38744757
comment on: http://stackoverflow.com/a/24933132
type: AnswerComment
score: 0
type: Comment
has text: @Braj you are like my guardian angel, This works perfectly, but i had to change "List<Object[]> list = new ArrayList<Object[]>();" to "ArrayList<Object[]> list = new ArrayList<Object[]>();" For the Code to work, but dude thanks for your input, Again :)

http://stackoverflow.com/q/25049584
favorite count: 0
possible better answer: http://stackoverflow.com/a/25070229
has answer: http://stackoverflow.com/a/25070229
tagged with: dictionary
accepted answer: http://stackoverflow.com/a/25070251
has comment: http://stackoverflow.com/comment/38964163
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39003063
has body: I am a beginner in Java programming. I want to create a HashMap whose values are String[]'s. Suppose I have a JTable parametersTable with values in columns 2, 3, and 4 that I wish to fetch from each row. Each three-value set constitutes a HashMap value (String[]). HashMap&lt;String, String[]&gt; map = new HashMap&lt;String, String[]&gt;(); String[] row = {"one", "two", "three", "four", "five", "six", "seven","eight","nine","ten","eleven"}; for (int i=0; i&lt;row.length; i++) { map.put(row[i], new String[] { (String) parametersTable.getValueAt(i, 2), (String) parametersTable.getValueAt(i, 3), (String) parametersTable.getValueAt(i, 4)}); } System.out.println(map); The above code outputs: {nine=[Ljava.lang.String;@187930f1, six=[Ljava.lang.String;@2a8000ab, four=[Ljava.lang.String;@4436b0fd, one=[Ljava.lang.String;@134bc965, seven=[Ljava.lang.String;@42e49d45, eleven=[Ljava.lang.String;@68cb58ea, ten=[Ljava.lang.String;@198bbc56, two=[Ljava.lang.String;@54464ee3, three=[Ljava.lang.String;@32aeff9b, five=[Ljava.lang.String;@90ed2c, eight=[Ljava.lang.String;@443d9864} Why is the output something cryptic and not the values like I expect?
upvote count: 1
has comment: http://stackoverflow.com/comment/38964330
downvote count: 1
type: Question
has title: Can I use String[] as HashMap values in Java?
has comment: http://stackoverflow.com/comment/38964313
tagged with: java
has comment: http://stackoverflow.com/comment/38964155
has comment: http://stackoverflow.com/comment/38981772
has answer: http://stackoverflow.com/a/25070251
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/38964012
tagged with: string

http://stackoverflow.com/comment/38835046
type: QuestionComment
type: Comment
score: 0
has text: oh okay i will edit my post agan
comment on: http://stackoverflow.com/q/24979244

http://stackoverflow.com/a/24916196
answers question: http://stackoverflow.com/q/24915938
score: 0
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/24915938
has body: You can use app.class.getClassLoader().getResourceAsStream("package/FileToEdit.xml") to access your file within your program even if it's packed in a jar. As you can see, you don't need to use full path there, just make sure that your resource is included into build path.This is to read files though. There is no guarantee that the file will be writable. OR You can use temporary files to do what you need to do. Those are most likely be writable. You can use your original FileToEdit.xml file as a template for temp file and then create it with File file = File.createTempFile("FileToEdit.xml", null); and use that file. But if you REALLY want to persist data, then you should use proper database.

http://stackoverflow.com/comment/38962641
type: Comment
score: 2
has text: And example of how you handling the file reading/writing is all that is needed...
type: QuestionComment
comment on: http://stackoverflow.com/q/25048691

http://stackoverflow.com/a/24988312
has comment: http://stackoverflow.com/comment/38850576
has comment: http://stackoverflow.com/comment/38848880
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/38850687
score: 4
accepted answer of: http://stackoverflow.com/q/24988300
has comment: http://stackoverflow.com/comment/38848670
has comment: http://stackoverflow.com/comment/38850532
has comment: http://stackoverflow.com/comment/38850598
answers question: http://stackoverflow.com/q/24988300
has comment: http://stackoverflow.com/comment/38848628
type: Answer
has comment: http://stackoverflow.com/comment/38881938
has comment: http://stackoverflow.com/comment/38850570
has comment: http://stackoverflow.com/comment/38850478
has body: You're trying to run a class which is uncompilable...JFrame.DISPOSE_ON_EXIT doesn't exist. You are actually looking for JFrame.EXIT_ON_CLOSE Take a minute to read the JavaDocs for JFrame public void setDefaultCloseOperation(int operation) Sets the operation that will happen by default when the user initiates a "close" on this frame. You must specify one of the following choices: * DO_NOTHING_ON_CLOSE (defined in WindowConstants): Don't do anything; require the program to handle the operation in the windowClosing method of a registered WindowListener object. * HIDE_ON_CLOSE (defined in WindowConstants): Automatically hide the frame after invoking any registered WindowListener objects. * DISPOSE_ON_CLOSE (defined in WindowConstants): Automatically hide and dispose the frame after invoking any registered WindowListener objects. * EXIT_ON_CLOSE (defined in JFrame): Exit the application using the System exit method. Use this only in applications. The value is set to HIDE_ON_CLOSE by default. Changes to the value of this property cause the firing of a property change event, with property name "defaultCloseOperation". You might also find How to Make Frames (Main Windows) of some use... You should also ensure that your UI is created within the context of the Event Dispatching Thread, take a look at Initial Threads for more details Updated with example import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JTextField; public class InvestmentFrame2 extends JFrame { private static final int FRAME_WIDTH = 450; private static final int FRAME_HEIGHT = 250; private static final double DEFAULT_RATE = 0; private static final double INITIAL_BALANCE = 0; private static final double YEARS = 0; private JLabel rateLabel; private JLabel balanceLabel; private JLabel yearsLabel; private JTextField rateField; private JTextField balanceField; privat…
has comment: http://stackoverflow.com/comment/38850812
upvote count: 4

http://stackoverflow.com/comment/38776267
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24949695
has text: I'm gonna gues `lL` is null

http://stackoverflow.com/a/24980446
has comment: http://stackoverflow.com/comment/38833412
accepted answer of: http://stackoverflow.com/q/24979946
type: Answer
has body: I fixed this by looking at another stackoverflow answer, if I just hit return after the redirect it will stop the filter from doing his forward. Stop further processing when redirecting in a filter
answers question: http://stackoverflow.com/q/24979946
has comment: http://stackoverflow.com/comment/38833463
score: 0
type: AcceptedAnswer

http://stackoverflow.com/a/31574962
answers question: http://stackoverflow.com/q/25045642
downvote count: 1
score: -1
upvote count: 0
has body: clientSession.sendAsyncRemote().sendObject(someObjectInfo); In the above line, the session object will be created per connection basis. It holds the reference socket object (per connection). Hence, when message is sent, data will be transferred to the respective client.
type: Answer

http://stackoverflow.com/a/25036473
answers question: http://stackoverflow.com/q/25014340
score: 0
type: AcceptedAnswer
type: Answer
has body: I could solve it: public void updateList() { feedListView= (ListView) findViewById(R.id.custom_list); feedListView.setVisibility(View.VISIBLE); progressbar.setVisibility(View.GONE); feedListView.setAdapter(new CustomListAdapter(this, feedList)); final ListView V = (ListView) findViewById(R.id.contato_list); //V.setVisibility(View.VISIBLE); V.setAdapter(new ContatosListAdapter(this, contatoList)); feedListView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView&lt;?&gt; a, View v, int position, long id) { Object o = V.getItemAtPosition(position); ClientesContatosModel newsData = (ClientesContatosModel) o; Intent intent = new Intent(FeedListActivity.this, FeedDetailsActivity.class); intent.putExtra("feed", newsData); startActivity(intent); } }); }
accepted answer of: http://stackoverflow.com/q/25014340

http://stackoverflow.com/q/25058682
tagged with: mysql
answer count: 1
has comment: http://stackoverflow.com/comment/38985657
has comment: http://stackoverflow.com/comment/38981119
has body: Can someone explain why i get the "operation not allowed after ResultSet closed" error at the following code; My db consists of two tables, consoles and hardware. Consoles table has 3 columns ( id, name and cost) while hardware has 4 columns (id, CPU, Memory and HDD). When i reach to: while(rs1.next()) { a1 = rs1.getString(1); b1 = rs1.getString(2); c1 = rs1.getString(3); model1.addRow(new Object[]{a1,b1,c1}); } the error pops up and i cant figure out why. Code : try { add = true; conn1 = DriverManager.getConnection("jdbc:mysql://localhost/test1?user=me&amp;password=12345"); conn3 = DriverManager.getConnection("jdbc:mysql://localhost/test1?user=me&amp;password=12345"); stmt1 = conn1.createStatement(); stmt3 = conn3.createStatement(); rs1 = stmt1.executeQuery("SELECT * FROM consoles"); rs3 = stmt1.executeQuery("SELECT * FROM hardware"); conn_pr1 = DriverManager.getConnection("jdbc:mysql://localhost/test1?user=me&amp;password=12345"); conn_pr3 = DriverManager.getConnection("jdbc:mysql://localhost/test1?user=me&amp;password=12345"); String sql1 = "INSERT INTO consoles (name,cost) VALUES (?,?)"; String sql3 = "INSERT INTO hardware (CPU,Memory,HDD) VALUES (?,?,?)"; ps1 =conn_pr1.prepareStatement(sql1); ps3 = conn_pr3.prepareStatement(sql3); str1 = JOptionPane.showInputDialog(null,"Console name : "); if(!(str1 == null)) { ps1.setString(1,str1); str2 = JOptionPane.showInputDialog(null,"Cost : "); } if(!(str2 == null)) { int2 = Integer.parseInt(str2); ps1.setLong(2,int2); str3 = JOptionPane.showInputDialog(null,"CPU : "); } if(!(str3 == null)) { str4 = JOptionPane.showInputDialog(null,"Memory : "); ps3.setString(1,str3); } if(!(str4 == null)) { str5 = JOptionPane.showInputDialog(null,"HDD : "); ps3.setString(2,str4); } if(!(str5 == null)) { int3 = Integer.parseInt(str5); ps3.setLong(3,int3); } if((!(str1 == null)) &amp;&amp; (!(str2 == null)) &amp;&amp; (!(str3 == null)) &amp;&amp; (!(str4 == null)) &amp;&amp; (!(str5 == null))) { //start if ps1.executeUpdate(); ps3.execute…
has comment: http://stackoverflow.com/comment/38980753
accepted answer: http://stackoverflow.com/a/25058835
has comment: http://stackoverflow.com/comment/38983824
has comment: http://stackoverflow.com/comment/38980891
has title: operation not allowed after ResultSet closed Part2
type: AnsweredQuestion
tagged with: sql
has comment: http://stackoverflow.com/comment/38986120
has comment: http://stackoverflow.com/comment/38984753
tagged with: resultset
type: Question
has comment: http://stackoverflow.com/comment/38981902
tagged with: jdbc
has answer: http://stackoverflow.com/a/25058835
score: 0
has comment: http://stackoverflow.com/comment/38980637
tagged with: java

http://stackoverflow.com/q/24918942
has comment: http://stackoverflow.com/comment/38726636
favorite count: 0
has answer: http://stackoverflow.com/a/24919478
type: UnansweredQuestion
score: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/38723677
tagged with: java
has comment: http://stackoverflow.com/comment/38730762
has comment: http://stackoverflow.com/comment/38745742
has answer: http://stackoverflow.com/a/24919411
tagged with: bufferedimage
type: Question
has body: It seems to me there are two ways to store an attachment in a NotesDocument. Either as a RichTextField or as a "MIME Part". If they are stored as RichText you can do stuff like: document.getAttachment(fileName) That does not seem to work for an attachment stored as a MIME Part. See screenshot I have thousands of documents like this in the backend. This is NOT a UI issue where I need to use the file Download control of XPages. Each document as only 1 attachment. An Image. A JPG file. I have 3 databases for different sizes. Original, Large, and Small. Originally I created everything from documents that had the attachment stored as RichText. But my code saved them as MIME Part. that's just what it did. Not really my intent. What happened is I lost some of my "Small" pictures so I need to rebuild them from the Original pictures that are now stored as MIME Part. So my ultimate goal is to get it from the NotesDocument into a Java Buffered Image. I think I have the code to do what I want but I just "simply" can't figure out how to get the attachment off the document and then into a Java Buffered Image. Below is some rough code I'm working with. My goal is to pass in the document with the original picture. I already have the fileName because I stored that out in metaData. But I don't know how to get that from the document itself. And I'm passing in "Small" to create the Small image. I think I just don't know how to work with attachments stored in this manner. Any ideas/advice would be appreciated! Thanks!!! public Document processImage(Document inputDoc, String fileName, String size) throws IOException { // fileName is the name of the attachment on the document // The goal is to return a NEW BLANK document with the image on it // The Calling code can then deal with keys and meta data. // size is "Original", "Large" or "Small" System.out.println("Processing Image, Size = " + size); //System.out.println("Filename = " + fileName); boolean result = false; Session session = Fact…
answer count: 2
has comment: http://stackoverflow.com/comment/38745168
tagged with: xpages
upvote count: 3
has title: How do you access an attachment stored as MIME Part?

http://stackoverflow.com/q/25061500
has title: jsonpath find all object(restassured)
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25102910
has answer: http://stackoverflow.com/a/25061763
upvote count: 4
downvote count: 0
tagged with: rest-assured-jsonpath
tagged with: java
type: Question
has body: This is my JSON : [ { "id": 9741962, "name": "getName", "isActive": true }, { "id": 1, "name": "New", "isActive": true } ] I want to get all the object that has the name :getName using jsonPath how can I do it using JsonPath (the onw that comes with rest assured) I try this one JsonPath.with(jsonResponse).get("findAll { a -&gt; a.name == getName }"); but I am getting Error. java.lang.IllegalArgumentException: No such property: sdfsdf for class: Script1 Thanks.
score: 4
answer count: 2
tagged with: rest-assured

http://stackoverflow.com/q/25019986
type: Question
accepted answer: http://stackoverflow.com/a/25020176
has comment: http://stackoverflow.com/comment/38908928
tagged with: optimization
score: 0
has comment: http://stackoverflow.com/comment/38910077
answer count: 2
has body: I am currently making an application that scan a folder and create Song for each file. [loop] if(!alreadyInLibrary(folder.getAbsolutePath())){ Song s = new Song(folder.getAbsolutePath()); this.addSong(s); // Add the song // Clear s = null; System.gc(); } [end loop] If I call the GC my app consumme 150Mb of memory and 400Mb without. But calling GC each time is really slow. So, I wonder if there is another way to optimize memory. Thanks
possible better answer: http://stackoverflow.com/a/25020073
favorite count: 0
has answer: http://stackoverflow.com/a/25020073
has title: How to optimize memory without calling System.gc();
has answer: http://stackoverflow.com/a/25020176
has comment: http://stackoverflow.com/comment/38909138
tagged with: garbage-collection
has comment: http://stackoverflow.com/comment/38908367
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/38908528
upvote count: 1
tagged with: memory
downvote count: 1

http://stackoverflow.com/comment/38894277
has text: Just a guess try using `Gdx.files.classpath("assets/packed.png");`.
comment on: http://stackoverflow.com/q/25012478
type: QuestionComment
score: 0
type: Comment

http://stackoverflow.com/comment/38770997
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24946549
has text: dang I have been running this but I am not sure why I am getting a java.lang.RuntimeException: Unable to start activity ComponentInfo{com.spicycurryman.getdisciplined10.app.dev/com.spicycurryman.getdisciplined10.app.MainActivity}: java.lang.NullPointerException
score: 0

http://stackoverflow.com/comment/38923559
type: AnswerComment
comment on: http://stackoverflow.com/a/25027913
score: 0
type: Comment
has text: @KennethEspinal Can you get the full json object retrieved stored in allPersons (e.g., using alert) and post it here?

http://stackoverflow.com/q/25062763
downvote count: 7
score: -7
tagged with: java
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38988474
has answer: http://stackoverflow.com/a/25062919
upvote count: 0
has answer: http://stackoverflow.com/a/25062964
favorite count: 0
tagged with: arraylist
type: Question
has title: Java - why will this only let me add to an arraylist when it is passed from main?
has comment: http://stackoverflow.com/comment/38988567
has body: This line, result.add(temp.get(temp.size() - 3)); shows an error when the ArrayList is local to the threeConsecutiveInt method; note I've made sure only that is showing error, and it's not syntax, or failure to define. Temp would too if I moved it back. I can add to the list public static void main(String[] args) { // TODO code application logic here ArrayList&lt;Integer&gt; colInts = new ArrayList&lt;&gt;(); ArrayList&lt;Integer&gt; temp = new ArrayList&lt;&gt;(); //ArrayList&lt;Integer&gt; result = new ArrayList&lt;&gt;(); colInts.add(54); colInts.add(4); colInts.add(544); colInts.add(1237); colInts.add(98757); colInts.add(874); colInts.add(54987); colInts.add(874); colInts.add(154987); System.out.println(colInts); //System.out.println(threeConsecutiveInt(colInts, temp, result)); System.out.println(threeConsecutiveInt(colInts, temp)); } public static ArrayList&lt;Integer&gt; threeConsecutiveInt(ArrayList ints, ArrayList temp) { // , ArrayList result ArrayList&lt;Integer&gt; result = new ArrayList&lt;&gt;(); int start = 0; int count = ints.size() - 1; int size = count; for (int i = 0; i &lt;= size; i++) { temp.add(ints.get(i)); } Collections.sort(temp); result.clear(); result.add(temp.get(temp.size() - 3)); //result.add(temp.get(temp.size() - 2)); //result.add(temp.get(temp.size() - 1)); for (int i = 0; i &lt; size; i++) { ints.remove(ints.size() - 1); } return result; }
answer count: 2

http://stackoverflow.com/comment/38943876
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25039156
has text: The file obviously does not "satisfy other system-dependent criteria"

http://stackoverflow.com/q/24950666
tagged with: oop
tagged with: java
type: Question
score: 5
has title: How do you deal when the implementation for an interface method is the same for some classes?
upvote count: 5
downvote count: 0
has answer: http://stackoverflow.com/a/24950895
has comment: http://stackoverflow.com/comment/38778235
has comment: http://stackoverflow.com/comment/38779427
tagged with: class
has body: Assume I have defined interface ISomeInterface with methods foo and bar. E.g. public interface ISomeInterface { public void foo(); public void bar(); } Let's say I have classes A and B that for them it makes sense to both implement the interface. But it also does not make sense to have a different implementation for foo(). Taking into account that deriving A from B or B from A is incorrect/weird is there a standard coding practice for this design? I assume I could create some utilities class to implement foo() and call it as a delegate but I was wondering if this whole structure can be dealt with differently Update: To give a full understanding of my question I stumbled upon this:http://perlbuzz.com/2010/07/why-roles-in-perl-are-awesome.html and I was trying to understand if this feature is lacking from the traditional OO concepts as we use them in Java or not
has answer: http://stackoverflow.com/a/24950976
has answer: http://stackoverflow.com/a/24951197
has comment: http://stackoverflow.com/comment/38778725
favorite count: 0
has answer: http://stackoverflow.com/a/24951381
has comment: http://stackoverflow.com/comment/38778172
answer count: 5
type: UnansweredQuestion
tagged with: interface
has answer: http://stackoverflow.com/a/24950906
has comment: http://stackoverflow.com/comment/38777984
tagged with: design-patterns

http://stackoverflow.com/q/24990853
has answer: http://stackoverflow.com/a/24991109
accepted answer: http://stackoverflow.com/a/24991109
has comment: http://stackoverflow.com/comment/38853266
type: Question
has body: I have an action class in which many action methods are defined and appropriate getters and setters methods are also defined. I have some action methods from which I get the data as json by calling them from jQuery. but when I get the json data it includes all the fields for which getters and setters are defined but i want to get only that field which is filled by that method to which i am calling. for example- public class ApplicantRegistration extends ActionSupport{ private String s1; private XyzBean bean; private String s2; // respective getters and setters.... public String m1(){ // some work return SUCCESS; } public String m2(){ //some work s2="abc"; return SUCCESS; } } when i call method m2 via jQuery and get json response it gives { s1: null, bean: null, s2:"abc", m2: "success", } but I want only { s2:"abc" }
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has title: How to get only particular fields in response in Struts 2
tagged with: struts2
upvote count: 2
has comment: http://stackoverflow.com/comment/38853151
answer count: 1
downvote count: 0
tagged with: jquery
favorite count: 0
tagged with: regex
score: 2
type: AnsweredQuestion

http://stackoverflow.com/comment/38740579
comment on: http://stackoverflow.com/a/24930337
has text: @Martynas Don't *ever* use a literal like `0.00001` to test for two doubles being "almost equal". Elementary numerical mathematics teaches you to distinguish between *absolute* and *relative* error. Please read http://en.wikipedia.org/wiki/Approximation_error
type: Comment
score: 1
type: AnswerComment

http://stackoverflow.com/a/24968839
has comment: http://stackoverflow.com/comment/38824925
has comment: http://stackoverflow.com/comment/38818455
upvote count: 1
has comment: http://stackoverflow.com/comment/38817431
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24968525
score: 1
answers question: http://stackoverflow.com/q/24968525
has comment: http://stackoverflow.com/comment/38817881
has body: This is not a memory leak. If you open an Activity A and then an Activity B, the first one will continue in memory until Android needs memory or Android considers that that Activity A potentially won't be open again. Further more, in your case the activity A is playing something which will consume more than an usual activity.
type: Answer

http://stackoverflow.com/a/45372527
downvote count: 1
has body: pattern="w{3}\.[a-z]+\.?[a-z]{2,3}(|\.[a-z]{2,3})" this will only accept addresses like e.g www.google.com &amp; www.google.co.in
upvote count: 2
type: Answer
answers question: http://stackoverflow.com/q/24924072
score: 1

http://stackoverflow.com/q/25067915
answer count: 2
has title: Efficient Data Structure To Store Millions of Records
score: 0
has comment: http://stackoverflow.com/comment/38998779
has comment: http://stackoverflow.com/comment/38998599
has answer: http://stackoverflow.com/a/25068088
has comment: http://stackoverflow.com/comment/38998856
has comment: http://stackoverflow.com/comment/38998953
has comment: http://stackoverflow.com/comment/38998596
has body: I have an input file that contains millions of records and each record contains again thousands of columns in which each of the column is separated by a delimiter. Number of records and columns can vary from file to file. I have a requirement that I have to parse these records and store them in the java object so that it can be further passed to the Drools Framework for the column level validation. This is how my input data and schema file looks like. Input File : John|Doe|35|10 Floyd St|132|Los Angeles|CA|USA ... and so on ... ... Millions records like this Schema File : firstName|String|false|20|NA lastName|String|false|20|NA age|Integer|false|3|NA addressLine1|String|false|20|NA addressLine2|String|false|20|NA city|String|false|5|NA state|String|false|10|NA country|String|false|10|NA I tried to implement this solution with the help of a map and created a Java class containing this map. class GenericRecord { Map&lt;String,FieldSpecification&gt; properties; //used HashMap as an implementation } class FieldSpecification { public String fieldName; public String dataType; public int length; public String value; public String format; } For reach row in the input file I am creating a Record Object and using map to store the values of its column. In addition to this I am also storing the metadata about the column in FieldSpecification Object like dataType , length ,format etc. For few thousands of rows in my input file it worked fine but as soon as number of rows starts increasing , it started blowing off because of the memory issue (as expected). As it is creating millions of map of objects having thousands of keys in it. I am aware this is not efficient solution is to solve this type of problem. So my concern is will the in memory based solution work in my scenario or I have to prefer the disk based solution like embedded DB or disk based Maps . Please advise if is there any other open source Map implementation that I can use. Note : For File Parsing and Data Validatio…
tagged with: memory-management
has comment: http://stackoverflow.com/comment/38998930
type: UnansweredQuestion
tagged with: bigdata
has comment: http://stackoverflow.com/comment/39002226
has comment: http://stackoverflow.com/comment/38999420
has comment: http://stackoverflow.com/comment/38999106
tagged with: java
has comment: http://stackoverflow.com/comment/39000656
has comment: http://stackoverflow.com/comment/39024248
has comment: http://stackoverflow.com/comment/38999183
type: Question
tagged with: hadoop
has answer: http://stackoverflow.com/a/25068149

http://stackoverflow.com/comment/58247779
comment on: http://stackoverflow.com/a/25031933
type: Comment
score: 0
has text: If i set this code, I add reference to the jar, I am able to compile my jar, but on runtime, tomcat throws Advautil32 cannot be resolved, where do i need to put the waffle jars ? thanks
type: AnswerComment

http://stackoverflow.com/q/24932882
type: Question
has body: I've been playing a little with the stacked notifications in Android Wear (http://developer.android.com/training/wearables/notifications/stacks.html) but I have a little issue. In my application I want to show a notification at a given time and then cancel it 2 hours later. On a classic Android notification I use notificationManager.cancel(NotifId) but as each stacked notification has it's own id I wonder if only cancelling the summary notification if enough or if I have to cancel all of them explicitly. Do you have any idea ?
tagged with: notifications
accepted answer: http://stackoverflow.com/a/24943826
downvote count: 0
answer count: 1
has title: Cancel all stacked notifications in Android Wear
favorite count: 0
tagged with: android
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
has answer: http://stackoverflow.com/a/24943826
tagged with: wear-os

http://stackoverflow.com/q/24909574
has title: How to do unix export in windows eclipse
tagged with: unix
type: UnansweredQuestion
type: Question
tagged with: java
tagged with: eclipse
has body: In Unix we can set variable like below: $ export FOO="bar" How can i do samething in windows through eclipse, i need to set this variable before my app starts. Regards, Chaitu
answer count: 1
has answer: http://stackoverflow.com/a/24909666
score: 0

http://stackoverflow.com/comment/38732799
type: QuestionComment
comment on: http://stackoverflow.com/q/24926320
has text: Are you using hamcrest-all-1.3.jar ?
score: 0
type: Comment

http://stackoverflow.com/q/25067895
has title: Browser navigates to webpage, but I get 500 error when using HttpURLConnection
score: 0
has comment: http://stackoverflow.com/comment/38999142
tagged with: httpurlconnection
has comment: http://stackoverflow.com/comment/39000520
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38999054
has comment: http://stackoverflow.com/comment/39011390
answer count: 0
has comment: http://stackoverflow.com/comment/38999211
tagged with: java
has comment: http://stackoverflow.com/comment/38998757
type: Question
has comment: http://stackoverflow.com/comment/38998907
has comment: http://stackoverflow.com/comment/39022477
has body: I need to send a request to a webpage. In the past, I have used HttpURLConnection, and everything worked fine. When I try to do the same thing this time, I get a 500 return code. Usually, this means a problem on the server, but I can actually paste the url directly into a web browser, and I get there with no problem. (The browser is not loading a cached version.) java.net.URL myURL = new java.net.URL(STRING_OF_URL_TO_BE_VISITED); java.net.HttpURLConnection connection = (java.net.HttpURLConnection) myURL.openConnection(); connection.setRequestMethod("GET"); connection.setRequestMethod("User-Agent","Mozilla/5.0"); connection.connect(); Integer responseCode = connection.getResponseCode(); String headerItem = ""; String headerKey = ""; for(Integer i = 0; ; i++) { headerKey = connection.getHeaderFieldKey(i); headerItem = connection.getHeaderField(i); if(headerKey == null) headerKey = ""; else headerKey += ": "; if(headerItem == null) break; System.out.println(headerKey + headerItem); } The response header looks like HTTP/1.1 500 Internal Server Error Content-Type: text/html;charset=UTF-8 Content-Language: en-US Server: Microsoft-IIS/7.5 Set-Cookie: JSESSIONID=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx; Path=/webapps/myWebApp; Secure X-appserver: myserver.mydomain.com P3P: CP="CAO PSA OUR" Date: Thu, 31 Jul 2014 19:24:19 GMT Content-Length: 25912 A co-worker thought that maybe the webpage was trying to re-direct to another webpage, but I don't see a Location line in the header, so I don't know how it would be redirecting. I've tried keeping the connection alive and listening for another response, but I never get another one.
has comment: http://stackoverflow.com/comment/39060634

http://stackoverflow.com/a/24982216
type: Answer
answers question: http://stackoverflow.com/q/24979824
upvote count: 2
score: 2
accepted answer of: http://stackoverflow.com/q/24979824
has body: You want to use the same validation file for both action classes because they have the same properties. You should read Defining Validation Rules and choose option 3. Create a base action class that has the same property set for both action classes and create *-validation.xml for this. Actions are mapped to the methods by name in the action configuration. This name might differ from the method name, that's why it's called an action alias. You might also been interested How Validators of an Action are Found that will compliment said above. Another option is to use one class for actions that are mapped to different methods and use the same per action class validation.
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/24959461
type: UnansweredQuestion
tagged with: android
has title: Get items recursively inside SoapObject
tagged with: android-ksoap2
tagged with: java
type: Question
has body: I have all classes generated from WSDL2KSoap and I receive response from envelope.bodyIn as normal. My envelope.bodyIn.toString() looks like this. getCatResponse{ getCatResult=anyType{ returnCode=200; category=anyType{ Category=anyType{ code=101; name=Games; }; Category=anyType{ code=102; name=Apps; }; }; }; } How do I get each one out of this SoapObject. Right now, I can only use soapResult.getProperty(name). Can I cast it to my getCatResponse.java that I have?
score: 0
has answer: http://stackoverflow.com/a/24959877
answer count: 1

http://stackoverflow.com/comment/38779301
type: AnswerComment
score: 0
type: Comment
has text: @knecht, Its working fine when I try it ,did you also swapped the cos and sin? you had it wrong ,cos is x and sin is y
comment on: http://stackoverflow.com/a/24950980

http://stackoverflow.com/comment/38744348
score: 1
type: Comment
type: QuestionComment
has text: No you are going about this the wrong way. Android already takes care of scaling etc. You can define separate drawables for different screen sizes or densities. You should **NEVER** try to manually scale it in code. Take a look at [**this**](http://developer.android.com/guide/practices/screens_support.html).
comment on: http://stackoverflow.com/q/24932956

http://stackoverflow.com/comment/38927026
has text: Scary a small edit is there String printme = words[x].replace("{","").replace("}","");
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25029991
score: 0

http://stackoverflow.com/comment/38708350
type: Comment
has text: Okay i will explain like just a java project. lets think that hibernate mapping is your db example. When you make this hibernate mapping you have to make class which includes all column names as a private variable in Class (with getter and setter). That property name is class variable name.
score: 0
comment on: http://stackoverflow.com/a/24912895
type: AnswerComment

http://stackoverflow.com/comment/38926251
type: QuestionComment
comment on: http://stackoverflow.com/q/25029668
has text: Take a look at [JDBC is not executing SHOW DATABASES command](http://stackoverflow.com/questions/12771120/jdbc-is-not-executing-show-databases-command?rq=1) and [show tables with like using Java and MySQL?](http://stackoverflow.com/questions/19501067/show-tables-with-like-using-java-and-mysql)
score: 0
type: Comment

http://stackoverflow.com/a/25068112
has body: No, the filechooser doesn't have this functionality by default (why would it?). You could take the source to filechooser and add this functionality in your own version of it, but this definitely seems like a corner case to me.
has comment: http://stackoverflow.com/comment/38999037
downvote count: 0
answers question: http://stackoverflow.com/q/25068046
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/a/56206974
type: Answer
downvote count: 0
score: 1
has body: Create this class public class ChainableUrlBasedViewResolver extends UrlBasedViewResolver { public ChainableUrlBasedViewResolver() { setViewClass(InternalResourceView.class); } @Override protected AbstractUrlBasedView buildView(String viewName) throws Exception { String url = getPrefix() + viewName + getSuffix(); InputStream stream = getServletContext().getResourceAsStream(url); if (stream == null){ return new NonExistentView(); } return super.buildView(viewName); } private static class NonExistentView extends AbstractUrlBasedView { @Override protected boolean isUrlRequired() { return false; } @Override public boolean checkResource(Locale locale) throws Exception { return false; } @Override protected void renderMergedOutputModel(Map&lt;String , Object&gt; model, HttpServletRequest request, HttpServletResponse response) throws Exception { // Purposely empty, it should never get called } } } then create this one @Configuration @EnableWebMvc @ComponentScan(basePackages = "ch.frankel.blog.spring.viewresolver.controller") public class WebConfig { @Bean public ViewResolver pageViewResolver() { UrlBasedViewResolver resolver = new ChainableUrlBasedViewResolver(); resolver.setPrefix("/resources/myApp/"); resolver.setSuffix(".html"); resolver.setOrder(1); return resolver; } } based on this way you have a mapping for your jsp from servlet-context.xml using this code: &lt;beans:bean class="org.springframework.web.servlet.view.InternalResourceViewResolver"&gt; &lt;beans:property name="prefix" value="/WEB-INF/views/" /&gt; &lt;beans:property name="suffix" value=".jsp" /&gt; &lt;/beans:bean&gt; and a mapping by creating those classes for html or others in resources folder. this link can help you
answers question: http://stackoverflow.com/q/25055610
upvote count: 1

http://stackoverflow.com/comment/38888904
has text: You can still use it from the support library.
type: AnswerComment
comment on: http://stackoverflow.com/a/25009854
type: Comment
score: 0

http://stackoverflow.com/comment/38811931
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24967768
has text: Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/58050/discussion-between-jaskey-and-abhijeet-panwar).
type: AnswerComment

semaphore
type: Tag
tags question: http://stackoverflow.com/q/25068625
tag name: semaphore

http://stackoverflow.com/comment/38860499
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24994802
has text: @resus it's not my call:( I have to deal with this s%^t, not complain about it.
score: 2

http://stackoverflow.com/q/24957057
tagged with: gxt
upvote count: 1
type: Question
tagged with: gwt
has comment: http://stackoverflow.com/comment/38789432
has comment: http://stackoverflow.com/comment/38789303
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/38789895
has answer: http://stackoverflow.com/a/24958684
downvote count: 0
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/38789616
has title: Self reference in GXT Propery access
accepted answer: http://stackoverflow.com/a/24958684
type: AnsweredQuestion
has body: I am reading this documentation about GXT PropertyAccess. I am creating a Grid&lt;Stock&gt; which contains a custom column. This column needs a ValueProvider which provides the whole Stock : public class MyCustomCol&lt;T&gt; extends ColumnConfig&lt;T, Stock&gt; { public MyCustomColl(ValueProvider&lt;? super T, Stock&gt; valueProvider, String header) { ... } } How can I express it in a GXT ProperyAccess ? public interface StockPropertyAccess extends PropertyAccess&lt;Stock&gt;{ @Editor.Path("") //Which Path should I use here? I unsuccessfully tried "" ValueProvider&lt;Stock, Stock&gt; zis(); ValueProvider&lt;Stock, Integer&gt; id(); ValueProvider&lt;Stock, String&gt; name(); ... }

http://stackoverflow.com/a/24975732
has body: First of all, you should include your LogCat, since it will usually give you the exact cause of the error. Second of all, I don't see a button in your XML nor an "onClick". What are you clicking to execute the code? Now to the code. This is probably the cause of the crash: showsitename.setText(sName); showurl.setText(sAge); You never define Textviews called "showsitename" and "showurl". You do have Textviews called "showsname" and "showage". Were you intending to use those?
upvote count: 1
answers question: http://stackoverflow.com/q/24975641
downvote count: 0
has comment: http://stackoverflow.com/comment/38824610
has comment: http://stackoverflow.com/comment/38836790
type: Answer
score: 1

http://stackoverflow.com/comment/39010459
type: Comment
type: QuestionComment
has text: Can you refer to my sample code and elaborate? I'm not able to figure out from the API ..
comment on: http://stackoverflow.com/q/25054901
score: 0

http://stackoverflow.com/comment/38801630
type: QuestionComment
comment on: http://stackoverflow.com/q/24963352
has text: Curiosity: Why won't you use a map or arraylist?
score: 4
type: Comment

http://stackoverflow.com/q/24999198
type: AnsweredQuestion
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/38869113
has comment: http://stackoverflow.com/comment/40656842
type: Question
has comment: http://stackoverflow.com/comment/38868743
answer count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/40668697
has comment: http://stackoverflow.com/comment/38868671
favorite count: 0
has title: How to read a ;-separated CSV in Java that can countain an unknown number of elements
has answer: http://stackoverflow.com/a/24999294
tagged with: http://stackoverflow.com/tag/csv
has answer: http://stackoverflow.com/a/24999500
has comment: http://stackoverflow.com/comment/38868960
has body: I know there exist a lot questions about reading CSV files, but I simply can't find one that fits my needs. I try to get keywords from a keywords.csv that can be in a form like this. The delimeter is always the ";". SAP;BI; Business Intelligence; ERP; SOA; SomethingElse; I already looked into openCSV and so on, but I can't find a functioning example how to do that (simple) task. I tried this: public void getKeywords() { try { int rowCount = 0; CSVReader reader = new CSVReader(new FileReader(csvFilename), ';'); String[] row = null; while((row = reader.readNext()) != null) { System.out.println(row[rowCount]); rowCount++; } //... reader.close(); } catch (IOException e) { System.out.println("File Read Error"); } But it will just return the first element. I don't know what I do wrong. Im new to coding as you may have noticed :) EDIT: Got what I wanted, thanks for your help! while((row = reader.readNext()) != null) { for (int i=0; i&lt; row.length; i++ ) { System.out.println(row[i]); } Please help an old man out. Thank you!
possible better answer: http://stackoverflow.com/a/24999500
upvote count: 1
accepted answer: http://stackoverflow.com/a/24999294
has comment: http://stackoverflow.com/comment/38868697

http://stackoverflow.com/q/25004508
tagged with: settings
tagged with: http://stackoverflow.com/tag/xml
score: 2
answer count: 0
upvote count: 2
type: UnansweredQuestion
has title: Android Settings java.lang.ExceptionInInitializerError when integrating Xposed
type: Question
tagged with: java
has body: I've been working on an Android ROM for about a month now, and one of my goals was to integrate Xposed framework into the stock Settings app. I built in the Setting, and made the layouts, but for some reason, I always get a force-close if I click on any of the menus. The logcat is as follows. D/SubSettings( 1570): Launching fragment com.android.settings.xposed.Framework W/dalvikvm( 1570): Exception Ljava/lang/NullPointerException; thrown while initializing Lcom/android/settings/xposed/util/AssetUtil; D/AndroidRuntime( 1570): Shutting down VM W/dalvikvm( 1570): threadid=1: thread exiting with uncaught exception (group=0x4157ace0) E/AndroidRuntime( 1570): FATAL EXCEPTION: main E/AndroidRuntime( 1570): Process: com.android.settings, PID: 1570 E/AndroidRuntime( 1570): java.lang.ExceptionInInitializerError E/AndroidRuntime( 1570): at com.android.settings.xposed.Framework.&lt;init&gt;(Framework.java:44) E/AndroidRuntime( 1570): at java.lang.Class.newInstanceImpl(Native Method) E/AndroidRuntime( 1570): at java.lang.Class.newInstance(Class.java:1208) E/AndroidRuntime( 1570): at android.app.Fragment.instantiate(Fragment.java:590) E/AndroidRuntime( 1570): at android.preference.PreferenceActivity.switchToHeaderInner(PreferenceActivity.java:1183) E/AndroidRuntime( 1570): at android.preference.PreferenceActivity.switchToHeader(PreferenceActivity.java:1199) E/AndroidRuntime( 1570): at android.preference.PreferenceActivity.onCreate(PreferenceActivity.java:545) E/AndroidRuntime( 1570): at com.android.settings.Settings.onCreate(Settings.java:213) E/AndroidRuntime( 1570): at android.app.Activity.performCreate(Activity.java:5312) E/AndroidRuntime( 1570): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087) E/AndroidRuntime( 1570): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2181) E/AndroidRuntime( 1570): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2276) E/AndroidRuntime( 1570): at android.app.ActivityThre…
downvote count: 0
favorite count: 0
tagged with: android

http://stackoverflow.com/q/24998431
has comment: http://stackoverflow.com/comment/38867064
tagged with: http://stackoverflow.com/tag/html
has answer: http://stackoverflow.com/a/24998576
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/24998576
has title: HTML and Java Beginner Website Creaton
answer count: 1
downvote count: 0
favorite count: 0
has body: So I understand creating really basic webpages like a hello world web page. I also understand some basic coding, having taken Java, C++ and even played with some Python and Powershell in my actual job as a Windows Server Admin. These were almost all console programs, interacting with text files local to the system. I am reading a book on HTML &amp; CSS (havent gotten to the CSS part yet) and I just went through the chapter on forms. My question is: How do I write an application in Java or whatever language that sits there and waits for a form to submission to come through so Java has access to that data to do whatever with it? I feel like I am missing something that everyone else seems as obvious, or is explained as too complex and covered later. Please point me in the right direction for how you take a basic website, into one that can take input and store it somewhere and then display that input
has comment: http://stackoverflow.com/comment/38868244

http://stackoverflow.com/q/24985832
upvote count: 5
downvote count: 0
has title: 405 Method Not Allowed with Spring
tagged with: retrofit
answer count: 3
accepted answer: http://stackoverflow.com/a/24987576
has comment: http://stackoverflow.com/comment/38843918
has comment: http://stackoverflow.com/comment/38843763
favorite count: 0
possible better answer: http://stackoverflow.com/a/25366592
has comment: http://stackoverflow.com/comment/38843813
has comment: http://stackoverflow.com/comment/38843870
tagged with: spring
has answer: http://stackoverflow.com/a/25366592
tagged with: spring-mvc
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38844171
tagged with: java
has answer: http://stackoverflow.com/a/27070673
tagged with: http
type: Question
has answer: http://stackoverflow.com/a/24987576
score: 5
has body: I have the following test for an HTTP endpoint: public static final String DATA_PARAMETER = "data"; public static final String ID_PARAMETER = "id"; public static final String VIDEO_SVC_PATH = "/video"; public static final String VIDEO_DATA_PATH = VIDEO_SVC_PATH + "/{id}/data"; @Multipart @POST(VIDEO_DATA_PATH) public VideoStatus setVideoData(@Path(ID_PARAMETER) long id, @Part(DATA_PARAMETER) TypedFile videoData); @Test public void testAddVideoData() throws Exception { Video received = videoSvc.addVideo(video); VideoStatus status = videoSvc.setVideoData(received.getId(), new TypedFile(received.getContentType(), testVideoData)); assertEquals(VideoState.READY, status.getState()); Response response = videoSvc.getData(received.getId()); assertEquals(200, response.getStatus()); InputStream videoData = response.getBody().in(); byte[] originalFile = IOUtils.toByteArray(new FileInputStream(testVideoData)); byte[] retrievedFile = IOUtils.toByteArray(videoData); assertTrue(Arrays.equals(originalFile, retrievedFile)); } I'm trying to implement the requirements defined by this test with the following endpoint defined in Swing: @RequestMapping(method = RequestMethod.POST, value = "/video/{id}/data") public void postVideoData(@PathVariable("id") long videoId, @RequestParam("data") MultipartFile videoData) throws IOException { if (videoId &lt;= 0 || videoId &gt; videos.size()) { throw new ResourceNotFoundException("Invalid id: " + videoId); } Video video = videos.get((int)videoId - 1); InputStream in = videoData.getInputStream(); manager.saveVideoData(video, in); } The problem is that I get a "405 Method Not Allowed" error. What am I doing wrong so that my POST method is not being recognized?
has comment: http://stackoverflow.com/comment/38957755

http://stackoverflow.com/comment/38815834
type: QuestionComment
comment on: http://stackoverflow.com/q/24970914
score: 0
has text: where is the required jar present in your project?
type: Comment

http://stackoverflow.com/a/25012232
answers question: http://stackoverflow.com/q/25012037
accepted answer of: http://stackoverflow.com/q/25012037
score: 0
type: AcceptedAnswer
has body: You should only try to handle exceptions if you can do something about them. This is one of these cases where it does not make sense. This should not happen normally, just log the exception and fail gracefully.
type: Answer

http://stackoverflow.com/q/24929175
answer count: 2
tagged with: tomcat
has comment: http://stackoverflow.com/comment/38736821
score: 0
has answer: http://stackoverflow.com/a/27936493
has comment: http://stackoverflow.com/comment/38736963
has body: I want to start tomcat server programmatically in JAVA. Please help me
has title: How to start Tomcat Server programmatically in Java
favorite count: 0
linked to: http://stackoverflow.com/q/5256002
has comment: http://stackoverflow.com/comment/38737041
upvote count: 4
has comment: http://stackoverflow.com/comment/38736848
downvote count: 4
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/27936493
has answer: http://stackoverflow.com/a/24929540
tagged with: java
accepted answer: http://stackoverflow.com/a/24929540
type: Question

http://stackoverflow.com/a/25122258
answers question: http://stackoverflow.com/q/25060137
accepted answer of: http://stackoverflow.com/q/25060137
has body: Alright, I figured one way to do this out myself. You don't set the @XMLRootElement-Annotation on the abstract super class, but instead on every concrete sub class (in this example, not on XXXAPICall but on FooBeanCall).
type: AcceptedAnswer
score: 0
type: Answer

http://stackoverflow.com/comment/38733205
comment on: http://stackoverflow.com/a/24926073
score: 0
type: AnswerComment
type: Comment
has text: I don't want to take credit for someone else's answer, so here's a link to the same question - http://stackoverflow.com/questions/11255353/java-best-way-to-grab-all-strings-between-two-strings-regex

http://stackoverflow.com/comment/38813349
has text: @T.J.Crowder: No problem at all. You may well have managed to improve the JS as you went along. I'm very clearly not a JS coder :)
score: 3
type: AnswerComment
comment on: http://stackoverflow.com/a/24968688
type: Comment

http://stackoverflow.com/a/24968616
answers question: http://stackoverflow.com/q/24968466
has comment: http://stackoverflow.com/comment/38814488
score: 4
downvote count: 1
has comment: http://stackoverflow.com/comment/38811475
has body: Byte array cannot directly convert to string, and neither do the reverse direction. import javax.crypto.Cipher; import javax.crypto.spec.SecretKeySpec; import javax.xml.bind.DatatypeConverter; public class stackoverflow_test { private byte[] encrypted; private String encryptedtext; private String decrypted; public String Encrypt(String pInput) { try { String Input = pInput; String key = "Bar12345Bar12345Bar12345Bar12345"; SecretKeySpec aesKey = new SecretKeySpec(key.getBytes(), "AES"); Cipher cipher = Cipher.getInstance("AES"); cipher.init(Cipher.ENCRYPT_MODE, aesKey); byte[] encrypted = cipher.doFinal(Input.getBytes()); //encryptedtext = new String(encrypted); encryptedtext = DatatypeConverter.printBase64Binary(encrypted); System.err.println("encrypted:" + encryptedtext); } catch (Exception e) { e.printStackTrace(); } return encryptedtext; } public String Decrypt(String pInput) { try { String Input = pInput; String key = "Bar12345Bar12345Bar12345Bar12345"; SecretKeySpec aesKey = new SecretKeySpec(key.getBytes(), "AES"); Cipher cipher = Cipher.getInstance("AES"); cipher.init(Cipher.DECRYPT_MODE, aesKey); encrypted = DatatypeConverter.parseBase64Binary(encryptedtext); decrypted = new String(cipher.doFinal(encrypted)); System.err.println("decrypted: " + decrypted); } catch (Exception e) { e.printStackTrace(); } return pInput; } public static void main(String[] ag){ stackoverflow_test test = new stackoverflow_test(); String a = test.Encrypt("Byte cannot directly convert to string"); String b = test.Decrypt(a); } } Result encrypted:UmH+3eUagjrRDblxSStArnaktoxTLX+7qvPdwiTO7VggYmYtuXu/Ygww8ZG5SrDz decrypted: Byte cannot directly convert to string
has comment: http://stackoverflow.com/comment/38811347
has comment: http://stackoverflow.com/comment/38811623
type: Answer
has comment: http://stackoverflow.com/comment/38823519
upvote count: 5
has comment: http://stackoverflow.com/comment/38814443
has comment: http://stackoverflow.com/comment/38816666
has comment: http://stackoverflow.com/comment/38811562

http://stackoverflow.com/q/24971598
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/24980638
accepted answer: http://stackoverflow.com/a/24980638
tagged with: google-drive-api
type: AnsweredQuestion
upvote count: 2
type: Question
tagged with: java
has body: I'm trying to make a cross-platform Java application to interact with a user's files on Drive. To this end, I've been trying to make sense of the documentation I've been reading. I've downloaded and installed the Google Java Client Library and the Drive API Client Library for Java, and was able to make the Quickstart command-line application work, so the system setup should be OK. Now, I'm trying to get a GUI application to work. However, it seems most of the examples I've seen assume either Web (client or server side), Android, or iOS as the platform. The few bits I find that seem to say that I should be able to use this in an installed application all seem to expect the javax.servlet.http.HttpServletRequest class to be available, but from what I've been able to gather, this is a server-side Java EE class. So my questions are: Are the Java Google Drive and Oauth2 APIs able to be used in a stand-alone application? If so, am I on the right track? Or is there other documentation that I haven't found yet?
tagged with: google-oauth
score: 2
has title: Authenticating to Google Drive with Java and Oauth2

http://stackoverflow.com/a/25046539
upvote count: 8
type: Answer
downvote count: 2
score: 6
accepted answer of: http://stackoverflow.com/q/25046166
has comment: http://stackoverflow.com/comment/38958940
answers question: http://stackoverflow.com/q/25046166
has comment: http://stackoverflow.com/comment/38959112
has body: There are a few ways to approach this. You can roll your own - that has the highest likelihood of getting something subtle wrong. You can have Eclipse generate your equals and hashCode methods for you - that leaves a lot of code in place, subject to inadvertent edits, and subject to failure to update when the class acquires a new field. You can use EqualsBuilder; it avoids the aforementioned problems. Best of all, at least in my experience, you can use lombok's EqualsAndHashCode annotation.
has comment: http://stackoverflow.com/comment/38958798
type: AcceptedAnswer

http://stackoverflow.com/a/24938583
score: 1
has comment: http://stackoverflow.com/comment/38754894
upvote count: 1
type: AcceptedAnswer
type: Answer
has body: It's happening because replaceAll expects a regex. You should probably use replace instead (which still replaces all occurences), since you only want to match a single character. So using versionName = versionName.replace('.','_'); on v1.0.4 will give you v1_0_4 as a result.
answers question: http://stackoverflow.com/q/24938546
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24938546
has comment: http://stackoverflow.com/comment/38755033

http://stackoverflow.com/comment/38721434
type: Comment
has text: oh i see what you mean about my inner loop, so if i set my in = outNew , that would take care of the inefficiency right? What is wrong with the outer loop?
comment on: http://stackoverflow.com/a/24920475
type: AnswerComment
score: 0

http://stackoverflow.com/q/25049770
has answer: http://stackoverflow.com/a/25049803
tagged with: reference
score: 0
tagged with: garbage-collection
has comment: http://stackoverflow.com/comment/38964775
type: Question
has body: So in Java if I have two objects of the same type and I set one of them to the other one(both have the same reference) will the garbage collector be called? ClassName obj1 = new ClassName(); ClassName obj2 = new ClassName(); obj1 = obj2; Will this call garbage collector? The reason I am asking is because I am making a game for android and I can't have the garbage collector being called while the game is running, as I want the best performance. I know that the "new" keyword will call garbage collection but I don't know if this will. Thanks!
tagged with: java
has title: Changing reference of object and garbage collector
linked to: http://stackoverflow.com/q/2414105
answer count: 3
has answer: http://stackoverflow.com/a/25049793
has answer: http://stackoverflow.com/a/25049797
type: UnansweredQuestion

http://stackoverflow.com/q/24927438
tagged with: apache-poi
tagged with: java
has body: I want to insert new rows while writing in Excel sheet. Here is my code: public static void addValuesInWorkbook(String pathAndFileName, String sheetName, int rowNum, String valuesString,String delimeter) { if(pathAndFileName.length() &gt; 0 &amp;&amp; sheetName.length() &gt; 0 &amp;&amp; rowNum &gt;= 0 &amp;&amp; valuesString.length() &gt; 0 &amp;&amp; delimeter.length() &gt; 0) { String[] colValues= null; if("|".equals(delimeter)) colValues = valuesString.split("\\|"); else colValues = valuesString.split(delimeter); int cellnum = 0; FileInputStream fsIP; try { fsIP = new FileInputStream(new File(pathAndFileName)); //Read the spreadsheet that needs to be updated if(rowNum &gt; 0) { rowNum--; //As row indexing starts from 0 } HSSFWorkbook wb = new HSSFWorkbook(fsIP); //Access the workbook HSSFSheet sheet = wb.getSheet(sheetName); HSSFRow row = sheet.getRow(((rowNum&gt;0)?rowNum:0)); HSSFCell cell=null; for(String colValue:colValues) { if(row!=null){ cell = row.getCell(cellnum); if(cell==null) cell = row.createCell(cellnum); } else if (row == null) { row =sheet.createRow(rowNum); //Create a row if it does not exist cell = row.createCell(cellnum); } cell.setCellValue(colValue); cellnum++; } fsIP.close(); //Close the InputStream FileOutputStream output_file =new FileOutputStream(new File(pathAndFileName)); //Open FileOutputStream to write updates wb.write(output_file); //write changes output_file.close(); //close the stream } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } Values are getting inserted with headers(column names ) but whenever new rows are inserted it replaces the older row values. Please help.
has answer: http://stackoverflow.com/a/24927546
type: Question
upvote count: 4
score: 4
has comment: http://stackoverflow.com/comment/38747056
downvote count: 0
answer count: 1
has title: how to insert new rows with values in the same sheet of an excel file in java
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/a/27565637
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25043162
has comment: http://stackoverflow.com/comment/43561146
has body: The packaging of this library is extremely weird. The jar file contains two different FileDrop classes, one in the default package and another in the net.iharder.dnd package, which seems to be a newer version. It also contains two source files (Example.java and FileDrop.java), the second of which seems to be the source code of the old version of the class (the one in the default package). The CVS repository at http://iharder.cvs.sourceforge.net/viewvc/iharder/filedrop/net/iharder/dnd/ seems to contain the new version of the code, so you can do a CVS checkout and attach the iharder/filedrop directory from the checkout as sources to the library.
upvote count: 2
type: AcceptedAnswer
type: Answer
score: 2
answers question: http://stackoverflow.com/q/25043162

http://stackoverflow.com/q/24931927
has answer: http://stackoverflow.com/a/32394716
accepted answer: http://stackoverflow.com/a/24932176
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24932023
has comment: http://stackoverflow.com/comment/38742075
has title: Add IMEI number in android application?
score: 1
tagged with: java
possible better answer: http://stackoverflow.com/a/24932023
type: Question
upvote count: 1
has body: I have to add an IMEI number in this mail body part. I tried on this method, but i can't. TelephonyManager telephonyManager =(TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE); telephonyManager.getDeviceId(); How can I get and print in body part IMEI number ? public void sendMail(String body, String sender, String recipients, String scilNo) throws Exception { try { File folder = new File(Environment.getExternalStorageDirectory().toString() + "/TEB/Log"); folder.mkdirs(); String extStorageDirectory = folder.toString(); SimpleDateFormat sdfDate = new SimpleDateFormat("dd-MM-yyyy__HH-mm-ss"); now = new Date(); String strDate = sdfDate.format(now); File file = new File(extStorageDirectory, strDate + ".txt"); file.createNewFile(); String cmd = "logcat -d -v long -f " + file.getAbsolutePath() + " *:V"; Runtime.getRuntime().exec(cmd); DataSource source = new FileDataSource(file); MimeBodyPart messageBodyPart = new MimeBodyPart(); messageBodyPart.setDataHandler(new DataHandler(source)); messageBodyPart.setFileName(file.getName()); StringBuilder sb = new StringBuilder(); sb.append(String.format("%10s: %s\n", "Gönderen", scilNo)); sb.append(String.format("%10s: %s\n", "Mesaj", body )); DataHandler handler = new DataHandler(new ByteArrayDataSource(sb.toString().getBytes(), "text/plain")); MimeBodyPart messageBodyPart2 = new MimeBodyPart(); messageBodyPart2.setDataHandler(handler); Multipart multipart = new MimeMultipart(); multipart.addBodyPart(messageBodyPart); multipart.addBodyPart(messageBodyPart2); final MimeMessage message = new MimeMessage(session); message.setContent(multipart); message.setSender(new InternetAddress(sender)); message.setSubject("Hata Bildirim Mesajı"); if (recipients.indexOf(',') &gt; 0) { message.setRecipients(Message.RecipientType.TO, InternetAddress.parse(recipients)); } else { message.setRecipient(Message.RecipientType.TO, new InternetAddress(recipients)); } Thread mySend = new Thread(new Runnable() { @Override public void run() { try { T…
favorite count: 0
linked to: http://stackoverflow.com/q/1972381
answer count: 3
tagged with: android
has comment: http://stackoverflow.com/comment/38742398
has comment: http://stackoverflow.com/comment/38742158
downvote count: 0
has comment: http://stackoverflow.com/comment/38742053
has comment: http://stackoverflow.com/comment/38823634
tagged with: imei
has answer: http://stackoverflow.com/a/24932176

http://stackoverflow.com/q/24992815
tagged with: git
has comment: http://stackoverflow.com/comment/38858587
type: Question
tagged with: jgit
tagged with: version-control
tagged with: ant
has title: git-checkout ant task (jgit) detached branch issue
score: 0
has comment: http://stackoverflow.com/comment/38858135
has comment: http://stackoverflow.com/comment/38857666
has comment: http://stackoverflow.com/comment/38859225
has comment: http://stackoverflow.com/comment/38874307
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38858402
answer count: 0
has body: I am fairly new to git, and I have a problem. I have created couple branches on my git repository and whenever I use git-checkout ant task to move to a certain branch: &lt;git-checkout src="./myrepo" branch="origin/mybranch" /&gt; it shows the correct content of that branch in my repository but when I run git branch from the command line it says that its "(detached from origin/mybranch)". After checking out I want to add some files to it, commit and push to remote with some custom ant tasks I wrote, but I'm not able to push because the branch I'm on is detached. How should I fix this? Thank you for answers
tagged with: java
has comment: http://stackoverflow.com/comment/38876161

http://stackoverflow.com/a/45005834
has comment: http://stackoverflow.com/comment/76985528
has body: Please see if your bnd file contains launch descriptions. Usually, the launch descriptions are defined in a different file called .bndrun file. (A bnd.bnd file can actually also act as a .bndrun file.) The bndrun file inherits properties from the workspace, not the profile. In such scenarios - you will have to click the run button from the .bndrun file
type: Answer
has comment: http://stackoverflow.com/comment/76988101
answers question: http://stackoverflow.com/q/25016396
score: 0

http://stackoverflow.com/a/25080204
upvote count: 22
type: AcceptedAnswer
downvote count: 0
has body: welle is partially correct. You can use TextAttributes to obtain a font: Map&lt;TextAttribute, Object&gt; attributes = new HashMap&lt;&gt;(); attributes.put(TextAttribute.FAMILY, Font.DIALOG); attributes.put(TextAttribute.WEIGHT, TextAttribute.WEIGHT_SEMIBOLD); attributes.put(TextAttribute.SIZE, 12); label.setFont(Font.getFont(attributes)); A better approach is to derive your font from the font installed on the Swing component by the look-and-feel: Font font = label.getFont(); font = font.deriveFont( Collections.singletonMap( TextAttribute.WEIGHT, TextAttribute.WEIGHT_SEMIBOLD)); label.setFont(font); That will preserve the font's family and size, which users may have set in their desktop preferences for readability reasons.
type: Answer
has comment: http://stackoverflow.com/comment/65855454
has comment: http://stackoverflow.com/comment/123025161
answers question: http://stackoverflow.com/q/25054203
score: 22
accepted answer of: http://stackoverflow.com/q/25054203

http://stackoverflow.com/a/28249015
has body: [Retraction] Here is a wrong Answer. I mistakenly thought the cited method answers the Question, but it does not. Consider this a retraction; rather than delete this Answer I'll leave it so that others avoid making my mistake. VaadinSession.getAllSessions() With Vaadin 7.2 came the addition of a static method, VaadinSession.getAllSessions. For history, see Ticket # 13053. That method returns a Collection of VaadinSession objects attached to a single HttpSession. This method tells you how many VaadinSession objects are running for a single user’s HttpSession, but does not tell you how many overall users are on your Vaadin app server.
has comment: http://stackoverflow.com/comment/46076070
upvote count: 8
type: Answer
score: 8
answers question: http://stackoverflow.com/q/24995677
downvote count: 0

http://stackoverflow.com/comment/54423620
type: Comment
comment on: http://stackoverflow.com/a/25248933
has text: The answer to this question isn't NO. So why is this the accepted answer?
type: AnswerComment
score: 0

http://stackoverflow.com/comment/38720671
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24919523
has text: and fixed! I had to add "abstract" in front of the types in the interface. Thanks so much for the help!

http://stackoverflow.com/q/24916781
has answer: http://stackoverflow.com/a/24921581
accepted answer: http://stackoverflow.com/a/24921581
tagged with: thrift
score: 0
has body: Is there a way to get the type of a parameter using the thrift ID? I have data coming in that needs to go to one of 6 different Thrift objects so I'm using reflection to instantiate the appropriate object and set data fields. Class&lt;?&gt; cls = Class.forName(package + table.name); Object o = cls.newInstance(); Method getField = cls.getMethod("fieldForId", int.class); Object field = getField.invoke(o, thriftId); Method setField = cls.getMethod("setFieldValue", field.getClass(), Object.class); setField.invoke(o, field, data); The variable data is a String. This code works great until it comes across a field with a type other than String where I can get ClassCastException. I tried doing this: Method getFieldValue = cls.getMethod("getFieldValue", field.getClass()); System.out.println(getFieldValue.invoke(o, field).getClass.getName()); But for String, getFieldValue returns null if they are blank and you can't get the class. I could assume that all null values are Strings, but that seems dangerous considering Lists, Maps, etc are probably returned as null as well. I also tried getting the Class of the field but it just comes back as the Enum (_Fields) which is expected.
has comment: http://stackoverflow.com/comment/38715121
answer count: 1
has comment: http://stackoverflow.com/comment/38715162
type: AnsweredQuestion
has title: Get Thrift Field Type from ID
tagged with: java
has comment: http://stackoverflow.com/comment/38715381
type: Question
has comment: http://stackoverflow.com/comment/38715211

http://stackoverflow.com/a/24914627
upvote count: 3
type: Answer
has body: There are two attributes to a thread-safe operation Visibility Atomicity To have a completely thread-safe operation it needs to satisfy both requirements. In your example it is safe of any data races (ie Visibility) (1) but is not atomic (2). Chances are, the author wanted to illustrate that the code above is safe for publication and neglected to point out (or maybe you hadn't read) that it was not atomic. Could anyone tell me why this piece of code is considered as thread safe and why i am wrong ? Your inclination here is right and your questioning the safety of this class is legitimate.
score: 3
downvote count: 0
answers question: http://stackoverflow.com/q/24910826

http://stackoverflow.com/q/25028146
favorite count: 0
has comment: http://stackoverflow.com/comment/38923777
answer count: 3
has title: How to remove specific character from a string?
has answer: http://stackoverflow.com/a/25028179
type: UnansweredQuestion
has body: I have a string that saves user login name and I want to remove specific characters from that string,i want to remove "@gmail.com" and just have the name before the @, then save it as a new string? How can I do this?
has answer: http://stackoverflow.com/a/25028247
has comment: http://stackoverflow.com/comment/38923751
score: -5
tagged with: java
downvote count: 5
type: Question
has answer: http://stackoverflow.com/a/25028190
upvote count: 0
tagged with: string

http://stackoverflow.com/comment/38972111
comment on: http://stackoverflow.com/a/25040182
type: AnswerComment
has text: That would of course also work. I suggested the link list as it would always be accessed sequentially though.
score: 0
type: Comment

http://stackoverflow.com/a/25030484
answers question: http://stackoverflow.com/q/24918252
upvote count: 1
has body: It not only depends on CPU, but also on the JVM, operating system etc. One thing you might be sure: don't assume anything if it comes to thread synchronization.
downvote count: 0
type: Answer
score: 1

http://stackoverflow.com/comment/38843805
comment on: http://stackoverflow.com/q/24985751
has text: This is a basic trigonometry problem -- really has nothing to do with programming.
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/24969919
tagged with: primefaces
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/24510729
has body: I have working on a project that is same as primefaces project.(custom component in jsf) I create component class and renderer class and any thing I need to make it. my components correctly work in my web application. now i want to make jar it with maven .i using maven 3.0.5 and intllij IDE 13. can you help me by saying me the steps of creation jar file from custom component in jsf 2.1.6? i see this Error in cmd: thank you
tagged with: jsf-2
score: 0
has title: making jar the custom components in jsf with maven
answer count: 1
has comment: http://stackoverflow.com/comment/38815838
has answer: http://stackoverflow.com/a/24970236
type: UnansweredQuestion
tagged with: maven
tagged with: jsf

http://stackoverflow.com/q/25002078
upvote count: 2
has body: I'm rendering a test cube in java (using the lwjgl) and opengl. The cube itself is a simple 10x10x10 drawn with the following vertex data: float[] vertexData = {length/2, length/2, length/2, -length/2, length/2, length/2, -length/2, length/2, -length/2, length/2, length/2, -length/2, length/2, -length/2, length/2, -length/2, -length/2, length/2, -length/2, -length/2, -length/2, length/2, -length/2, -length/2}; short[] indexData = {0, 4, 1, 1, 4, 5, 1, 5, 2, 2, 5, 6, 2, 6, 3, 3, 7, 6, 3, 7, 0, 0, 7, 4, 3, 0, 2, 2, 0, 1, 4, 7, 6, 5, 4, 6}; The variable length is set to 10. (I have omitted my color data for simplicity, but as your about too see it just contains 1,0,0 repeated). My issue is thus: upon drawing instead of a 10x10x10 I get an approx 4.7x4.7x4.7. I have run sevral tests (ie: drawing geometry using glBegin as well as placing two cubes with there centers 10 pixels appart too see if they touched they did not) I have packaged VBO in a class of my own creation, the contents of which is below: public class BasicVBO { IntBuffer ib = BufferUtils.createIntBuffer(3); int vHandle = ib.get(0); int cHandle = ib.get(1); int iHandle = ib.get(2); float[] vertexData; float[] colorData; short[] indexData; public BasicVBO(float[] vertexArray, float[] textArray, short[] indexArray){ vertexData = vertexArray; colorData = textArray; indexData = indexArray; FloatBuffer vBuffer = BufferUtils.createFloatBuffer(vertexArray.length); FloatBuffer cBuffer = BufferUtils.createFloatBuffer(colorData.length); ShortBuffer iBuffer = BufferUtils.createShortBuffer(indexArray.length); glGenBuffers(ib); vHandle = ib.get(0); cHandle = ib.get(1); iHandle = ib.get(2); vBuffer.put(vertexData); vBuffer.flip(); cBuffer.put(colorData); cBuffer.flip(); iBuffer.put(indexData); iBuffer.flip(); glEnableClientState(GL_VERTEX_ARRAY); glEnableClientState(GL_COLOR_ARRAY); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER_ARB, iHandle); glBufferData(GL_ELEMENT_ARRAY_BUFFER_ARB, iBuffer, GL_DYNAMIC_DRAW_ARB); glBindBuffer(GL_…
tagged with: game-engine
favorite count: 0
has comment: http://stackoverflow.com/comment/38876484
tagged with: vbo
has comment: http://stackoverflow.com/comment/38877173
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38903357
has title: Cube Drawn in Java using a VBO does not match geometry
score: 2
answer count: 0
downvote count: 0
tagged with: lwjgl
type: Question
has comment: http://stackoverflow.com/comment/38877286
has comment: http://stackoverflow.com/comment/38877416
tagged with: opengl
tagged with: java
has comment: http://stackoverflow.com/comment/38876634
has comment: http://stackoverflow.com/comment/38876743

http://stackoverflow.com/a/25013271
answers question: http://stackoverflow.com/q/25013119
upvote count: 1
has body: Your method is extremely inefficient, nevertheless, here is how you can fix it: for (int primeTest2 = 101; primeTest2 &lt;= 200; primeTest2++) { boolean prime = true; for (int arrayCounter2 = 0; arrayCounter2 &lt; Prime1.size(); arrayCounter2++) { if (primeTest2 % Prime1.get(arrayCounter2) == 0) { prime = false; break; } } if (prime) Prime2.add(primeTest2); } BTW, for the first set of prime numbers, it is sufficient to use 2, 3, 5, 7, 11, 13.
type: Answer
downvote count: 0
score: 1

http://stackoverflow.com/comment/38783218
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24953321
has text: @DarshanLila: Edited the question. Can we make a created file, as shared resource?

http://stackoverflow.com/q/24955173
has answer: http://stackoverflow.com/a/25208313
has comment: http://stackoverflow.com/comment/39243532
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/25203295
has answer: http://stackoverflow.com/a/44978366
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/39060265
answer count: 10
score: 11
has answer: http://stackoverflow.com/a/25200659
has comment: http://stackoverflow.com/comment/39132982
has answer: http://stackoverflow.com/a/54974680
has title: How to remove specific space between parent and child in an ExpandableListView
tagged with: expandablelistview
upvote count: 11
linked to: http://stackoverflow.com/q/13679064
has comment: http://stackoverflow.com/comment/39256229
has answer: http://stackoverflow.com/a/34921064
tagged with: java
has answer: http://stackoverflow.com/a/25200752
has answer: http://stackoverflow.com/a/26856956
has comment: http://stackoverflow.com/comment/39133458
type: Question
has body: Can you help me identify why there is a space between the group and the child? In my case I want spaces between all groups and the child should be right below the group with no space (but of course space to the next group. My problem looks like this: I have set the Group divider to this drawable (expandable_list_group_divider): &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;shape xmlns:android="http://schemas.android.com/apk/res/android"&gt; &lt;size android:height="10dp"/&gt; &lt;/shape&gt; And the child divider to this (@drawable/expandable_list_child_divider): &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;shape xmlns:android="http://schemas.android.com/apk/res/android"&gt; &lt;size android:height="0dp"/&gt; &lt;/shape&gt; I have defined the layout like this in the xml(it is a compund control): &lt;com.jws.MyExpandableListView android:id="@+id/expList" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="5dp" android:layout_marginLeft="15dp" android:layout_marginRight="15dp" android:scrollbars="none" android:divider="@drawable/expandable_list_group_divider" android:childDivider="@drawable/expandable_list_child_divider"/&gt; The custom view class: public class MyExpandableListView extends ExpandableListView { protected ArrayList&lt;Departure&gt; departures; public MyExpandableListView(Context context, AttributeSet attrs) { super(context, attrs); setGroupIndicator(null); setChildIndicator(null); setHorizontalFadingEdgeEnabled(true); setVerticalFadingEdgeEnabled(true); setFadingEdgeLength(60); departures = new ArrayList&lt;Departure&gt;(); this.setAdapter(new MyExpandableListAdapter(context, this, departures)); } } And finally the expandable list adapter public class DeparturesExpandableListAdapter extends BaseExpandableListAdapter { private final int DIVIDER_HEIGHT = 20; private LayoutInflater inflater; private ArrayList&lt;Departure&gt; departures; private Context context; private ExpandableListView expListView; pu…
has comment: http://stackoverflow.com/comment/39062510
has answer: http://stackoverflow.com/a/43496523
has answer: http://stackoverflow.com/a/25113632
has comment: http://stackoverflow.com/comment/39093125
has comment: http://stackoverflow.com/comment/39093406

http://stackoverflow.com/comment/38712913
type: AnswerComment
comment on: http://stackoverflow.com/a/24915766
score: 0
type: Comment
has text: @user3748486 Not really, since they live outside of any method or static block. Please consider a quick Java tutorial before going too much further, then check out the Log4J docs. If you put them in, say, a `public void static main(String[] args) { ... }` method and run that logging will work however you've configured it to.

http://stackoverflow.com/q/24915008
tagged with: java
accepted answer: http://stackoverflow.com/a/24917761
type: Question
has title: How to handle multiple SOAP requests in the same envelope using Java Web Service?
has answer: http://stackoverflow.com/a/24917761
has comment: http://stackoverflow.com/comment/38710609
score: 0
answer count: 1
has body: I currently have a web service with the method: @Override @WebResult(Name="OIPResponse") public Map<String, Object> getOIP(@WebParam(name = "invoice") String invoiceNumber,@WebParam(name = "part") String partNumber) The normal SOAP request I use to call it looks like this: <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:oip="http://oip.mycompany.com/"> <soapenv:Header/> <soapenv:Body> <oip:getOIP> 41587182 9ZF2A5-570 </oip:getOIP> </soapenv:Body> </soapenv:Envelope> and the response is something like this: <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <ns2:getOIPResponse xmlns:ns2="http://oip.mycompany.com/"> ERR_CODE SELLING_OU null ... </ns2:getOIPResponse> </soap:Body> </soap:Envelope> I've tested this and it works fine. Now I am wondering if there is a way to include multiple requests in the same SOAP envelope like this: <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:oip="http://oip.mycompany.com/"> <soapenv:Header/> <soapenv:Body> <oip:getOIP> 41587182 9ZF2A5-570 </oip:getOIP> <oip:getOIP> 41587183 9ZF2A5-570 </oip:getOIP> <oip:getOIP> 41587184 9ZF2A5-570 </oip:getOIP> <oip:getOIP> 41587185 9ZF2A5-570 </oip:getOIP> </soapenv:Body> </soapenv:Envelope> and get back something like this: <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <ns2:getOIPResponse xmlns:ns2="http://oip.mycompany.com/"> ... ... ... ... </ns2:getOIPResponse> </soap:Body> </soap:Envelope> Is there any way to do this?
tagged with: soap
tagged with: web-services
type: AnsweredQuestion

http://stackoverflow.com/comment/38888010
type: QuestionComment
score: 0
has text: Look back to Java 5, for example, the API is pretty bland, very basic functionality which could be provided to just about all platforms. Jav 6 introduced the concept of the `SystemTray`, but not all platforms have a concept of a "System Tray". It also introduced transparent/translucent/shaped windows, again, a concept that is not available to all platforms, so all of sudden we have a graying of this abstract layer, where some features "might" work, "some" of the time. `Desktop` is another example of functionality we would "like" but may not be possible on all platforms...
comment on: http://stackoverflow.com/q/25009276
type: Comment

http://stackoverflow.com/comment/38706319
comment on: http://stackoverflow.com/q/24910955
score: 0
has text: Thank you for responding. I am going through the logs one by one. I have a multi-module project. I think I should run "mvn clean package" as there are warnings that state many dependencies could not be resolved. I suspect that this is the root of the problem.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24963352
has comment: http://stackoverflow.com/comment/38801808
has comment: http://stackoverflow.com/comment/38802022
has comment: http://stackoverflow.com/comment/38802076
possible better answer: http://stackoverflow.com/a/24963624
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24963624
tagged with: java
has answer: http://stackoverflow.com/a/24963553
has body: I am creating a program where I am importing a .dat file and printing the values on the command prompt in order it is read. No problems there. The only thing is I cannot figure out the code to only print certain variables once. import java.io.*; import java.util.Scanner; public class program4 { public static void main(String [] args) throws IOException { double [] values; //creating array called values values = new double [40]; //establishing array that has 40 cells int k; //creating counter integer Scanner InputFile = new Scanner( new FileReader("temp.dat")); k = 0; while (InputFile.hasNextDouble()) //read values from file using ascending while loop { values[k] = InputFile.nextDouble(); k++; } for (k = 0 ; k &lt; values.length ; k++) System.out.println(values[k]); InputFile.close(); } } Where is the best place to initialize the code for getting rid of the duplicates that the .dat file contains?
upvote count: 1
has comment: http://stackoverflow.com/comment/38801689
downvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/24963553
tagged with: arrays
has comment: http://stackoverflow.com/comment/38801947
linked to: http://stackoverflow.com/q/16266611
has answer: http://stackoverflow.com/a/24963899
linked to: http://stackoverflow.com/q/13727030
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/38801646
has comment: http://stackoverflow.com/comment/38801674
has comment: http://stackoverflow.com/comment/38801726
has title: How to print a duplicate once in an array WITHOUT map or arraylist
favorite count: 0
has comment: http://stackoverflow.com/comment/38801879
has comment: http://stackoverflow.com/comment/38801630

http://stackoverflow.com/a/24997653
type: AcceptedAnswer
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/24989212
has body: I've found the solution: the parameter index of the renderer's getListCellRendererComponent is -1 when the inline control is drawn.
accepted answer of: http://stackoverflow.com/q/24989212
upvote count: 1

http://stackoverflow.com/q/24969246
has comment: http://stackoverflow.com/comment/38812622
possible better answer: http://stackoverflow.com/a/24969394
has answer: http://stackoverflow.com/a/24969394
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24969426
has body: I am writing an API which will help others write custom "plugin" classes for my current program. These plugin classes can come in three possible forms. extending JPanel implementing Paintable a combination of the above The Paintable interface is simply one method: paint(Graphics2D g). I will then create new instances of these loaded classes. If the object is found to be a JPanel (via instanceof), create a new button on a JFrame and have it open this JPanel. If the object is found to be a Paintable, add it to an ArrayList. However, there is a problem. I will be loading these classes from a different folder using a URLClassLoader. In this folder, there will be classes extending JPanel that are not meant to be plugins and thus not meant to be loaded. So my question is: What would be the best way to prompt users to "mark" their classes as plugins? and how would they "mark" it? Keep in mind the three possibilities these plugins can show up as. Simply creating an empty class named Plugin extending JPanel and extending that to all plugins seems wasteful for those not extending JPanel.
tagged with: java
type: Question
has title: Marking user-made classes as "plugins"
score: 0
answer count: 2
tagged with: api
has answer: http://stackoverflow.com/a/24969426
tagged with: interface

http://stackoverflow.com/q/24985231
answer count: 1
has answer: http://stackoverflow.com/a/24985382
tagged with: serialization
has body: I want to modify the client handler to use Foo instead of Datagram -- what changes are required in the client itself? Surely it's not necessary to strictly keep to datagrams to send and receive with Netty? The Factorial example uses BigInteger, so, surely, it's possible to use POJO's. Any and all attempts to create a class like: class FooClientHandler extends SimpleChannelInboundHandler&lt;Foo&gt; are just non-starters for me, it literally won't send or receive with a server. (Yes, both client and server use similar handlers, generic classes with Foo.) So, I'm coming at this now from working code. What's the key distinction between the factorial handler and the the datagram handler below? Or, is the primary distinction in how it's used in the client? client: package net.bounceme.dur.netty; import io.netty.bootstrap.Bootstrap; import io.netty.buffer.Unpooled; import io.netty.channel.Channel; import io.netty.channel.ChannelOption; import io.netty.channel.EventLoopGroup; import io.netty.channel.nio.NioEventLoopGroup; import io.netty.channel.socket.DatagramPacket; import io.netty.channel.socket.nio.NioDatagramChannel; import io.netty.util.CharsetUtil; import java.net.InetSocketAddress; import java.util.logging.Logger; import net.bounceme.dur.client.gui.MyProps; public final class Client { private static final Logger log = Logger.getLogger(Client.class.getName()); public void connect() throws InterruptedException { MyProps p = new MyProps(); String host = p.getHost(); int port = p.getServerPort(); pingPongDatagram(host, port); } public void pingPongDatagram(String host, int port) throws InterruptedException { EventLoopGroup group = new NioEventLoopGroup(); try { Bootstrap b = new Bootstrap(); b.group(group) .channel(NioDatagramChannel.class) .option(ChannelOption.SO_BROADCAST, true) .handler(new DatagramClientHandler()); Channel ch = b.bind(0).sync().channel(); ch.writeAndFlush(new DatagramPacket( Unpooled.copiedBuffer("QOTM?", CharsetUtil.UTF_8), new InetSocketAddress(h…
tagged with: sockets
score: 0
type: UnansweredQuestion
tagged with: netty
type: Question
tagged with: datagram
tagged with: java
has title: change client and handler from DatagramPacket to POJO

http://stackoverflow.com/q/24942045
score: 1
has answer: http://stackoverflow.com/a/26741502
favorite count: 0
type: Question
tagged with: serial-port
tagged with: java
upvote count: 1
has body: I'm using Proclipsing (processing in Eclipse) but am getting an error when I try and open a port (printing the serial list works fine). I have a feeling some sort of native library is not connected but I'm baffled as to how to do so in Eclipse (and where it link to). Here's my code: import processing.core.PApplet; import processing.serial.Serial; public class visualization extends PApplet { public Serial usb = null; public void setup() { println(Serial.list()); println(Serial.list()[5]); usb = new Serial(this, Serial.list()[5], 115200); } public void draw() { } } and the error it throws is: Exception in thread "Animation Thread" java.lang.UnsatisfiedLinkError: jssc.SerialNativeInterface.openPort(Ljava/lang/String;Z)J at jssc.SerialNativeInterface.openPort(Native Method) at jssc.SerialPort.openPort(SerialPort.java:158) at processing.serial.Serial.&lt;init&gt;(Unknown Source) at processing.serial.Serial.&lt;init&gt;(Unknown Source) at bioauthvisualization3.BioauthVisualization3.setup(BioauthVisualization3.java:15) at processing.core.PApplet.handleDraw(PApplet.java:2361) at processing.core.PGraphicsJava2D.requestDraw(PGraphicsJava2D.java:240) at processing.core.PApplet.run(PApplet.java:2256) at java.lang.Thread.run(Thread.java:745)
answer count: 1
tagged with: processing
type: UnansweredQuestion
tagged with: eclipse
has title: UnsatsifiedLinkError on JSSC Serial Interface (Processing)
downvote count: 0

http://stackoverflow.com/comment/38888352
has text: My comment didn't get through, yesterday. I tried with your said answer but it failed. so i used firepath and tried to decipher that. Also am using a framework, its tough to put all those LOCs here. Also its not the problem of code. It works for rest of the things.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24989523

http://stackoverflow.com/comment/38928367
score: 0
type: QuestionComment
type: Comment
has text: What is the issue with `^[_A-Za-z0-9-\\+]+(\\.[_A-Za-z0-9-]+)*@[A-Za-z0-9-]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$;`
comment on: http://stackoverflow.com/q/25030857

http://stackoverflow.com/comment/38889976
score: 0
type: Comment
type: QuestionComment
has text: see [this](http://osdir.com/ml/java-htmlunit-general/2009-09/msg00034.html)
comment on: http://stackoverflow.com/q/24995989

http://stackoverflow.com/q/25016604
tagged with: java
has answer: http://stackoverflow.com/a/26368966
upvote count: 1
tagged with: eclipse
type: Question
possible better answer: http://stackoverflow.com/a/25017444
downvote count: 0
has answer: http://stackoverflow.com/a/25017444
tagged with: ubuntu
has answer: http://stackoverflow.com/a/25016932
tagged with: sdk
answer count: 3
accepted answer: http://stackoverflow.com/a/26368966
tagged with: android
has title: Eclipse crashes when creating a new android project
favorite count: 0
has comment: http://stackoverflow.com/comment/38902229
linked to: http://stackoverflow.com/q/16383992
type: AnsweredQuestion
has body: I'm starting with Android Programming at the moment. I'm using die Android SDK and Eclipse. I downloaded the Bundle from the developer.android.com . At first it seems good, but when finishing the wizard for a new Android Project, Eclipse crashes. The programm returns the following error: I already tried to run "ulimit -c unlimited", with no effect. I'm running Kubuntu 14.04 (Linux/Debian/Ubuntu) and Java 1.7.0_55. Any help?
score: 1

http://stackoverflow.com/q/25005906
has comment: http://stackoverflow.com/comment/38881777
tagged with: java
linked to: http://stackoverflow.com/q/19228862
type: Question
upvote count: 4
accepted answer: http://stackoverflow.com/a/25008057
tagged with: ssl
score: 4
has body: I have an issue when switching my application from Java 7 to Java 8. After changing the JDK I start getting this SSLPeerUnverified Exception. Changing back to Java7, there is no exception. I found this question: SSL connection failing for Java 7 which implies that this may be related to a server side issue. Our server is indeed running on an Ubuntu machine, but it is running Java8 as well (sun Java8) Not sure what else would be helpful to post. I can provide code samples if needed/useful. I didn't incude them now because it appears as though the code is not the issue. Edit - link to my extension of SSLSocketFactory: http://pastebin.com/2j6HDHE7 Edit2 - Http client code: private HttpClient getHttpClient() throws GeneralSecurityException, IOException { final KeyStore trustStore = KeyStore.getInstance(KeyStore.getDefaultType()); trustStore.load(CommandChannel.class.getResourceAsStream("myKeystore"), "myPassword".toCharArray()); final SSLSocketFactory sslSocketFactory = new TrustingSSLSocketFactory(trustStore); final SchemeRegistry registry = new SchemeRegistry(); registry.register(new Scheme("http", 80, PlainSocketFactory.getSocketFactory())); registry.register(new Scheme("https", 443, sslSocketFactory)); final HttpParams params = new BasicHttpParams(); HttpProtocolParamBean paramsBean = new HttpProtocolParamBean(params); paramsBean.setVersion(HttpVersion.HTTP_1_1); paramsBean.setContentCharset("UTF_8"); final ClientConnectionManager ccm = new BasicClientConnectionManager(registry); final DefaultHttpClient httpClient = new DefaultHttpClient(ccm, params); return httpClient; } Including the SSL-debug information from java8 &amp; java7 below. Java 8 SSL debug trace: %% No cached client session *** ClientHello, TLSv1.2 RandomCookie: GMT: 1389745002 bytes = { 220, 201, 110, 4, 38, 166, 25, 166, 235, 253, 71, 242, 226, 124, 22, 149, 28, 207, 242, 25, 201, 123, 218, 56, 207, 67, 195, 17 } Session ID: {} Cipher Suites: [TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256, TLS_ECDHE_RSA_WI…
has comment: http://stackoverflow.com/comment/38882616
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/38882566
favorite count: 0
has comment: http://stackoverflow.com/comment/38882090
has comment: http://stackoverflow.com/comment/38882249
has comment: http://stackoverflow.com/comment/38882146
has answer: http://stackoverflow.com/a/25008057
tagged with: java-8
has title: Java 8 javax.net.ssl.SSLPeerUnverifiedException: peer not authenticated, but not Java 7
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38882542

http://stackoverflow.com/q/24934351
score: 0
has body: I want to debug my struts2 application. How to show the current view (jsp page location with name) of current action in my eclipse console ?
has title: in struts2, how to show curent view (jsp page) in console
answer count: 1
type: UnansweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/24934542
type: Question
tagged with: struts2

http://stackoverflow.com/a/24964248
upvote count: 1
has comment: http://stackoverflow.com/comment/38822975
downvote count: 0
answers question: http://stackoverflow.com/q/24963745
type: Answer
score: 1
has body: You have to traverse through the appfilter.xml file in icon pack and set drawable for the curresponding package name defined in the appfilter.xml file ... use XmlPullParser class to manipulate xml data.... here is a basic idea... Resources resources = packageManager.getResourcesForApplication(packageName); int xmlResId = resources.getIdentifier("appfilter", "xml", packageName); if (xmlResId != 0) { XmlPullParser xpp = resources.getXml(xmlResId); // manipulate data using xpp } Some old icon packs has a different xml structure some has appfilter.xml in asset folder ...

http://stackoverflow.com/comment/42122466
comment on: http://stackoverflow.com/q/24982720
type: Comment
has text: @HeinBlöd I think I did, but I don't remember now. I scrapped the project later for something else.
score: 0
type: QuestionComment

http://stackoverflow.com/comment/38789656
comment on: http://stackoverflow.com/a/24956660
type: AnswerComment
has text: You could try `beschreibung = beschreibung.replace("ü", "ü") ` too.
score: 0
type: Comment

http://stackoverflow.com/comment/38930898
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25029157
has text: Don`t know exactly but it worked . contentStream.moveTo(0,0); contentStream.beginText(); contentStream.setFont(PDType1Font.HELVETICA_BOLD, 12); contentStream.moveTextPositionByAmount(xValue,yValue); contentStream.setNonStrokingColor(color); contentStream.drawString(comment); contentStream.endText(); contentStream.close();
score: 0

http://stackoverflow.com/comment/38789212
type: QuestionComment
comment on: http://stackoverflow.com/q/24957033
type: Comment
has text: Read this: [The Java Tutorials: Object Oriented Programming concepts](http://docs.oracle.com/javase/tutorial/java/concepts/index.html)... and also read [this article](http://whathaveyoutried.com)
score: 0

http://stackoverflow.com/comment/38772735
type: Comment
score: 0
has text: there's an error on `String item = itemsList.getString(i); // item at index i` that the itemList variable cannot be resolved.
type: AnswerComment
comment on: http://stackoverflow.com/a/24947520

http://stackoverflow.com/comment/38763989
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24939398
has text: I am using rabbitmq in a cluster with 3 nodes, so reconnect works fine then. I broke up the connection via an iptables command.
score: 0

http://stackoverflow.com/a/24962681
has comment: http://stackoverflow.com/comment/38801450
has body: When you use == with two references, you are comparing whether the references are the same, not whether the contents of the objects referenced are the same. This is made more complicated with auto-boxing caches. e.g. Longs between -128 and 127 are cached so you will get the same object every time. e.g. Long x = 100, y = 100; System.out.println(x == y); // true, references are the same. Long a = 200, b = 200; // values not cached. System.out.println(a == b); // false, references are not the same. System.out.println(a.equals(b)); // true, the objects referenced are equal Comparing the intValue() is dangerous due to the risk of overflow. Long c = -1, d = Long.MAX_VALUE; System.out.println(c.equals(d)); // false System.out.println(c.longValue() == d.longValue()); // false System.out.println(c.intValue() == d.intValue()); // true, lower 32-bits are the same.
upvote count: 12
has comment: http://stackoverflow.com/comment/38800356
score: 12
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/24962630
type: Answer
accepted answer of: http://stackoverflow.com/q/24962630

http://stackoverflow.com/a/24920576
has comment: http://stackoverflow.com/comment/38721693
downvote count: 1
has comment: http://stackoverflow.com/comment/38721771
answers question: http://stackoverflow.com/q/24920497
has comment: http://stackoverflow.com/comment/38721379
has body: perhaps you can hold all the animal's attributes in a map: public class Dog { final public Map&lt;String,String&gt; attributes = new HashMap&lt;&gt;(); } Then final Dog dog = new Dog(); dog.attributes.put("type", "German Shepherd"); dog.attributes.put("name", "Jim"); dog.attributes.put("color", "Brown"); load whatever attributes the user provides into the map. when you need to output/display your dog, dump the map values.
has comment: http://stackoverflow.com/comment/38721408
has comment: http://stackoverflow.com/comment/38721563
type: Answer
has comment: http://stackoverflow.com/comment/38721533
score: 2
has comment: http://stackoverflow.com/comment/38721615
upvote count: 3
has comment: http://stackoverflow.com/comment/38721452

http://stackoverflow.com/q/24990215
tagged with: eclipse
has answer: http://stackoverflow.com/a/25006670
answer count: 1
tagged with: jpa
downvote count: 0
favorite count: 0
has body: I wanted to configure the persistence provider for a dynamic web project which I made insided eclipse luna EE edition. I googled eclipse add persistence provider and found nice only one step by step tutorial for this. Unfortunately, it only tells me how to create a new JPA project and set the persistence provider. How do I do this for a dynamic web project which has already been created ? Thank you.
type: UnansweredQuestion
upvote count: 4
tagged with: java
has title: Configure the JPA provider for a dynamic web project
type: Question
score: 4

animation
tags question: http://stackoverflow.com/q/24919441
tags question: http://stackoverflow.com/q/25046702
tags question: http://stackoverflow.com/q/24917350
tags question: http://stackoverflow.com/q/24938245
type: Tag
tag name: animation
tags question: http://stackoverflow.com/q/24912419
tags question: http://stackoverflow.com/q/24939745

http://stackoverflow.com/q/24966111
has title: Sort list based on separate list
upvote count: 3
tagged with: java
answer count: 3
accepted answer: http://stackoverflow.com/a/24967064
downvote count: 1
has answer: http://stackoverflow.com/a/24966277
tagged with: sorting
has body: I have a list of objects with a method getPriority() which returns the objects priority in a string and a method getName() which returns the objects name (also a string). I have a list, 'priority', which contains strings like 'high' 'medium' and 'low'. I would like to order the list of objects by the position of the getPriority() method in the order list and for objects which have the same priority or no priority then order them alphabetically based on name. For example: List&lt;MyObject&gt; objects = new ArrayList&lt;MyObject&gt;(); objects.add(new MyObject("apple", "low")); objects.add(new MyObject("bacon", "medium")); objects.add(new MyObject("cheese", "low")); objects.add(new MyObject("doughnut", "high")); objects.add(new MyObject("eggs", null)); objects.add(new MyObject("fudge", null)); List&lt;String&gt; priority = new ArrayList&lt;String&gt;(); priority.add("high"); priority.add("medium"); priority.add("low"); would be sorted as: doughnut, bacon, apple, cheese, eggs, fudge. It is important to not use an enum for priority as it needs to be customisable by the end user. It also needs to accept a null priority as priority is taken from a database and the objects still need to be sorted if not found in the database.
has answer: http://stackoverflow.com/a/24967004
possible better answer: http://stackoverflow.com/a/24966277
type: AnsweredQuestion
score: 2
favorite count: 0
has answer: http://stackoverflow.com/a/24967064
type: Question

http://stackoverflow.com/a/24957876
score: 3
upvote count: 3
downvote count: 0
answers question: http://stackoverflow.com/q/24957813
has body: You need to create a point to pass into the indexOf method. p.indexOf(new Point(1,2)); But that change by itself will still return -1. See the api doc for indexOf: public int indexOf(Object o) Returns the index of the first occurrence of the specified element in this list, or -1 if this list does not contain the element. More formally, returns the lowest index i such that (o==null ? get(i)==null : o.equals(get(i))), or -1 if there is no such index. It's using equals to decide whether it's found a match. You haven't overridden the equals method on your point class, so it's using the default implementation in java.lang.Object, which compares the references, and only returns true if the two references point to the same object. Override equals and hashcode on your point class, like: @Override public boolean equals(Object other) { if (!(other instanceof point)) { return false; } point otherPoint = (point)other; return otherPoint.x == this.x &amp;&amp; otherPoint.y == this.y; } @Override public int hashCode() { return x + y; // same values should hash to the same number } and that way two different instances of the class can be compared by value.
type: Answer

http://stackoverflow.com/q/25016172
tagged with: serialization
has comment: http://stackoverflow.com/comment/38900966
has comment: http://stackoverflow.com/comment/38901885
accepted answer: http://stackoverflow.com/a/25024222
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38904075
has comment: http://stackoverflow.com/comment/38904178
tagged with: java
has comment: http://stackoverflow.com/comment/38902200
has body: Java - Serialization - Grabbing number of objects in file I'm trying to retrieve my objects from my serialized file and re-add them to my file. There seems to be an issue, no exception is being thrown but nothing is being printed in my console when running my method. Before continuing here is my code: public boolean openCollection(){ try { FileInputStream e = new FileInputStream("profiles.ser"); ObjectInputStream inputStream = new ObjectInputStream(e); List<Profile> profiles = (List<Profile>) inputStream.readObject(); //De-obscure for(Profile p : profiles){ String unObcName = deobscure(p.getName()); //Original name String unObcSurname = deobscure(p.getSurname()); //Original surname String unObcUsername = deobscure(p.getUsername()); //Original username String unObcPassword = deobscure(p.getPassword()); //Original password p.setName(unObcName); p.setSurname(unObcSurname); p.setUsername(unObcUsername); p.setPassword(unObcPassword); //Debugging System.out.println("DE-OBSCURE - Profile name: " + p.getName() +"\n"+ "Profile surname: " + p.getSurname() +"\n"+ "Profile username: " + p.getUsername() +"\n"+ "Profile password: " + p.getPassword()); this.profiles.add(p); } } catch (FileNotFoundException var3) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { JOptionPane.showMessageDialog(null, "No profiles found, please create a profile!"); final CreateProfile createProfile = new CreateProfile(); createProfile.setVisible(true); } }); return false; } catch (IOException var4) { var4.printStackTrace(); JOptionPane.showMessageDialog(null, "IO Exception"); return false; } catch (ClassNotFoundException var5) { var5.printStackTrace(); JOptionPane.showMessageDialog(null, "Required class not found"); return false; } return true; } This is the serialization method public void saveCollection(){ //Obscure the data List<Profile> saveProfiles = new ArrayList<>(); for(Profile p : profiles){ String obcName = obscure(p.getName()); String obcSurname = obscure(p.getSurna…
type: Question
has comment: http://stackoverflow.com/comment/38901728
has comment: http://stackoverflow.com/comment/38900719
answer count: 1
has title: Java - Serialization - Grabbing number of objects
has comment: http://stackoverflow.com/comment/38902556
score: 0
has answer: http://stackoverflow.com/a/25024222
has comment: http://stackoverflow.com/comment/38903625
linked to: http://stackoverflow.com/q/24825958

http://stackoverflow.com/comment/38824157
has text: yep, they should use the method described here: http://stackoverflow.com/questions/1088216/whats-wrong-with-using-to-compare-floats-in-java
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24975522

http://stackoverflow.com/comment/38743719
type: Comment
comment on: http://stackoverflow.com/a/24931330
has text: @DanyloEsterman A lot of the style bits are just hints. The OS might respect them or it might now.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/38734377
type: AnswerComment
comment on: http://stackoverflow.com/a/24926073
has text: thx that is perfect. one last question: now i have 2 patterns (p,l), and i what them in the same matcher(m) because of the order: Pattern p = Pattern.compile(Pattern.quote(pattern1) + "(.*?)" + > > Pattern.quote(pattern2)); Pattern l = Pattern.compile(Pattern.quote(pattern3) + "(.*?)" + > > Pattern.quote(pattern4)); Matcher m = p.matcher(res.toString()); while (m.find()) { System.out.println(m.group(1)); } How do i get both patterns in m?
type: Comment
score: 0

http://stackoverflow.com/q/24931677
has comment: http://stackoverflow.com/comment/38742486
score: -2
has comment: http://stackoverflow.com/comment/38742093
has comment: http://stackoverflow.com/comment/38742408
has comment: http://stackoverflow.com/comment/38741597
tagged with: nullpointerexception
answer count: 3
has comment: http://stackoverflow.com/comment/38741579
has comment: http://stackoverflow.com/comment/38741823
favorite count: 0
has comment: http://stackoverflow.com/comment/38761846
has answer: http://stackoverflow.com/a/24931849
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38742241
tagged with: linked-list
tagged with: java
downvote count: 3
upvote count: 1
has title: Error at Linked list (java)
has answer: http://stackoverflow.com/a/24932648
has body: I created my own linked list, but when I tried to run it there is an error: Exception in thread "main" java.lang.NullPointerException at List.add(List.java:8) //if(t.val ==null) at main.main(main.java:38) //linput.add(inputLine.split(" ")[i]); Here is my List class: class List{ String val; List next=null; private List t; public void add(String word){ if(t.val ==null) t.val=word; else while(!t.next.val.equals(null)) { t=t.next; if(t.next.val.equals(null)) { t.next.val=word; break; } } } public int get(String word) { int i=0; if(t.val.equals(word)) i=0; else while(!t.next.val.equals(word)) { t=t.next; i++; if(t.next.val.equals(word)) { i++; } } return i; } public String indexOf(int i) { int counter=0; while(counter&lt;i) { t=t.next; counter++; } return t.val; } } And here is my main function : static public void main(String[] args) { List linput = new List(); String inputLine = "Hey look at me."; for(int i = 0 ; i &lt; inputLine.split(" ").length ; i++) { linput.add(inputLine.split(" ")[i]); } System.out.println(linput.indexOf(0)+" "+linput.indexOf(1)+" "+linput.indexOf(2)); } I initialized t but next time there is an error like this: private List t =new List(); Exception in thread "main" java.lang.StackOverflowError at List.&lt;init&gt;(List.java:5) at List.&lt;init&gt;(List.java:5) at List.&lt;init&gt;(List.java:5) Sorry. I can't give my full code, because the rest of my code is working well (reading from txt etc....).
type: Question
has answer: http://stackoverflow.com/a/24931853
has comment: http://stackoverflow.com/comment/38742898
has comment: http://stackoverflow.com/comment/38741590

http://stackoverflow.com/q/24944204
has comment: http://stackoverflow.com/comment/38766073
favorite count: 0
has comment: http://stackoverflow.com/comment/38766134
accepted answer: http://stackoverflow.com/a/24944261
has comment: http://stackoverflow.com/comment/38766487
has answer: http://stackoverflow.com/a/24944459
type: AnsweredQuestion
score: 3
tagged with: oop
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/38766296
type: Question
has answer: http://stackoverflow.com/a/24944258
downvote count: 0
has comment: http://stackoverflow.com/comment/38766489
has answer: http://stackoverflow.com/a/24944261
possible better answer: http://stackoverflow.com/a/24944258
has title: Better design for initialization within constructor
has body: I have a class that looks something like this which acts as factory for clients based on credentials retrieved from credentials service. It builds clients one time and returns that on every call. public class ClientFactory { private CredentialService credentialService; private ClientA clientA; public ClientFactory(CredentialService credentialService){ this.credentialService = credentialService; //initialization in constructor this.clientA = buildClientA(credentialService.getCredentials()); } public ClientA getClientA(){ return clientA; } /** Build new ClientA using crendentials*/ private ClientA buildClientA(String credentials){ return new ClientA(credentials); } } Issue that I see with this is line 2 in the constructor which basically start using dependency 'credentialService' to initialize other dependencies immediately. If some other developer moves around order of code in constructor, it will start failing. Other option is too change method getClientA() to this. public ClientA getClientA(){ if(clientA == null) { this.clientA = buildClientA(credentialService.getCredentials()); } return clientA; } But it has thread safety issues. Is there a better way to design above class which avoids concerns I highlighted above? Thanks
answer count: 3

http://stackoverflow.com/q/24926970
tagged with: image
has title: Fetch image from Rich Text Field via Https
type: Question
tagged with: c#
downvote count: 0
has comment: http://stackoverflow.com/comment/44611355
has body: I have C# batch which communicate with salesforce objects via SOAP API. I want to fetch an image which is part of the Rich Text Field in salesforce custom object. The rich text field himself is Html text and I can get the url of the image tag, but the problem is that the url himself is Https = Http secure connection: The url of the image tag: https://ngam--kerensen--c.cs17.content.force.com/servlet/rtaImage?eid=a1Vg0000000lTkK&amp;feoid=00N20000003jcie&amp;refid=0EMg00000009N4I As a result of this, I can't get the resource and write it to a file as a local image for later use. This is the C# code for fetching the image: HttpWebRequest request = (HttpWebRequest)WebRequest.Create(uri); HttpWebResponse response = (HttpWebResponse)request.GetResponse(); bool answer = response.ContentType.StartsWith("image", StringComparison.OrdinalIgnoreCase); if ((response.StatusCode == HttpStatusCode.OK || response.StatusCode == HttpStatusCode.Moved || response.StatusCode == HttpStatusCode.Redirect)&amp;&amp; response.ContentType.StartsWith("text/html", StringComparison.OrdinalIgnoreCase)){ // if the remote file was found, download it using (Stream inputStream = response.GetResponseStream()) using (Stream outputStream = File.OpenWrite(filepath)) { byte[] buffer = new byte[8192]; int bytesRead; logger.InfoFormat("Writing to file, filepath:{0}", filepath); do { bytesRead = inputStream.Read(buffer, 0, buffer.Length); logger.InfoFormat("bytesRead: {0} ", bytesRead); outputStream.Write(buffer, 0, bytesRead); } while (bytesRead != 0); //TODO outputStream.Close(); } return true; } } catch (Exception ex) { logger.ErrorFormat("Failed to download {0} to {1} : {2}", uri, filepath, ex.Message); logger.Debug("Failed to download " + uri, ex); } return false; I know that the secure url using java servlet for exposing the image to the world. The problem is that I can't get the image data and always get the following respond: &lt;script&gt; if (this.SfdcApp &amp;&amp; this.SfdcApp.projectOneNavigator)…
favorite count: 0
answer count: 0
upvote count: 2
type: UnansweredQuestion
score: 2
tagged with: java

http://stackoverflow.com/q/25031445
tagged with: jdbc
has body: I found that Statement.getGeneratedKeys() can be used for retrieving the ids of the inserted rows. But I wanted to know is it reliable, if we have multiple JDBC connections performing insert operation simultaneously.
has answer: http://stackoverflow.com/a/25031718
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25031495
has comment: http://stackoverflow.com/comment/38929998
has title: Reliablility of Statement.getGeneratedKeys()
tagged with: java
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/38929358
score: 0
has comment: http://stackoverflow.com/comment/38939796

http://stackoverflow.com/q/24962349
tagged with: image
has answer: http://stackoverflow.com/a/24962628
score: 0
answer count: 1
tagged with: android
has title: How to import images into an Android project?
accepted answer: http://stackoverflow.com/a/24962628
type: AnsweredQuestion
has body: I'm using the Kilobolt Android framework. Using a custom Assets class, I'm loading images by using a BitmapFactory and reading the actual image from an InputStream. Now I'm having problems loading the bitmap from the folder, it keeps giving me an IOException. I tried copying my image file directly to the drawable-xxhdpi folder. I don't understand why this isn't working. My folders look like this: src |--main |---|--java |---|---|--all the fancy java files :D |---|--res |---|---|--drawable-xxhdpi |---|---|---|--fancy images |---|---|--other folders and files... |---|--other folders and files... |--other folders and files...
tagged with: java
type: Question

http://stackoverflow.com/comment/38745396
has text: @JamesKanze: C++ code can use a custom allocator (aggregate allocations and do only a single free later.) That's even faster. Or leave the free out an rely on OS cleanup on exit.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24914525
score: 2

http://stackoverflow.com/q/24910537
score: 12
downvote count: 0
has comment: http://stackoverflow.com/comment/38704198
tagged with: string
favorite count: 0
tagged with: string-literals
has comment: http://stackoverflow.com/comment/38702871
has answer: http://stackoverflow.com/a/24910706
has answer: http://stackoverflow.com/a/24910781
accepted answer: http://stackoverflow.com/a/24910706
has comment: http://stackoverflow.com/comment/38702215
linked to: http://stackoverflow.com/q/14150628
has body: When a String is created using the keyword new it creates a new String object using a constructor that takes a String literal. I'm wondering if the literal get stored in the constant pool before the String constructor is called. The reason I'm asking is that in "OCA Java SE 7 Programmer I Certification Guide", Mala Gupta writes: public static void main(String[] args) { String summer = new String("Summer"); //Line 1: The code creates a new String object with the value "Summer". This object is not placed in the String constant pool. String summer2 = "Summer" //Line 2: The code creates a new String object with the value "Summer" and places it in the String constant pool. } She says on the first line that the String object that is created by new is not stored in the constant pool. This is fine, but what is not clear is if the literal "Summer" that goes in the constructor on the first line is. On the second line she says that the assignment of "Summer" to summer2 stores it in the constant pool, which implies that the literal on the first line was not placed in the pool. My Question Line 1: Does the literal "Summer" in the constructor get placed in the constant pool before the String constructor is called? Line 2: Does "Summer" already exist in the pool at line 2 or is it inserted at this line? Line 2: Is the author wrong when she says that "Summer" is inserted in the pool at line 2?
answer count: 4
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24910804
type: Question
possible better answer: http://stackoverflow.com/a/24910781
upvote count: 12
has comment: http://stackoverflow.com/comment/38702844
tagged with: java
has title: Java String creation and String constant pool
linked to: http://stackoverflow.com/q/11700320
has answer: http://stackoverflow.com/a/24910880

http://stackoverflow.com/comment/38817878
has text: If I read into the inputStream bytes per bytes and I write them in an Object, it should work, Shouldn't it ?
type: Comment
comment on: http://stackoverflow.com/a/24972036
score: 0
type: AnswerComment

http://stackoverflow.com/comment/38828285
has text: No its not like a file and am not storing anything into database its like creating a new pdf document
comment on: http://stackoverflow.com/q/24975362
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24962895
type: AnsweredQuestion
score: 3
tagged with: java
tagged with: jaxb
tagged with: marshalling
has answer: http://stackoverflow.com/a/24962959
downvote count: 0
answer count: 1
favorite count: 0
tagged with: unmarshalling
has body: I have a Java class which contains a List field. public class Machine{ public int ID; public String Name; public String Status; public String Environment; public String Cluster; public List<String> SupportedLocales; } Below is an instance of the class in XML that I am trying to unmarshall. <?xml version="1.0" encoding="utf-8"?> 27 QA14ADMINOPM201 Decom QA14 ADMINOPM NA Global When I unmarshall the Xml though, the resulting object has an empty SupportedLocales list, with no elements. Any reason why this might be happening or suggested fixes? All other fields are being unmarshalled correctly.
accepted answer: http://stackoverflow.com/a/24962959
has title: using JaxB to unmarshall object which contains List<String> field
upvote count: 3
type: Question

http://stackoverflow.com/a/25020214
score: 0
has body: Either there is no selection in lstPerson or firstTxt was never instantiated.
type: Answer
answers question: http://stackoverflow.com/q/25020144

ant
tags question: http://stackoverflow.com/q/25056836
tags question: http://stackoverflow.com/q/25019909
tags question: http://stackoverflow.com/q/24926320
type: Tag
tags question: http://stackoverflow.com/q/24931340
tags question: http://stackoverflow.com/q/24938301
tags question: http://stackoverflow.com/q/24962451
tags question: http://stackoverflow.com/q/24947710
tags question: http://stackoverflow.com/q/25007997
tags question: http://stackoverflow.com/q/25012265
tags question: http://stackoverflow.com/q/24988053
tags question: http://stackoverflow.com/q/25059759
tags question: http://stackoverflow.com/q/24957826
tag name: ant
tags question: http://stackoverflow.com/q/25042203
tags question: http://stackoverflow.com/q/24955305
tags question: http://stackoverflow.com/q/24915142
tags question: http://stackoverflow.com/q/25022892
tags question: http://stackoverflow.com/q/24937540
tags question: http://stackoverflow.com/q/24959904
tags question: http://stackoverflow.com/q/24992815
tags question: http://stackoverflow.com/q/25043691
tags question: http://stackoverflow.com/q/24999791
tags question: http://stackoverflow.com/q/25061162
tags question: http://stackoverflow.com/q/25039864
tags question: http://stackoverflow.com/q/24994408
tags question: http://stackoverflow.com/q/25064695
tags question: http://stackoverflow.com/q/24963789

http://stackoverflow.com/comment/38876161
score: 0
has text: @torek Thank you! Finally, with your help, I was able to understand my prablem and make my task work!
comment on: http://stackoverflow.com/q/24992815
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38980092
has text: I should read javadoc more carefully:) I changed the `GET` method to the `POST` method and it works. Thanks, man.
comment on: http://stackoverflow.com/a/25057446
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/24990948
favorite count: 0
tagged with: struts2
tagged with: model-driven
answer count: 1
tagged with: http://stackoverflow.com/tag/xml
has comment: http://stackoverflow.com/comment/38854264
has body: I am new to Struts 2 framework. I have made a program for understanding modelDriven interceptor. But I am unable to execute it. Following are the list of files and in the end there is a output (error). index.jsp: <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <%@ taglib uri="/struts-tags" prefix="s"%> Insert title here <%-- <jsp:useBean id="ent" class="pack.Entity" scope="session" /> --%> <s:form method="get" action="go"> <s:textfield name="t1" label="Name"></s:textfield> <s:password name="p1" label="Password"></s:password> <s:submit value="accept"></s:submit> </s:form> Entity.java: package actions_pack; public class Entity { private String t1; private String p1; public String getP1() { return p1; } public void setP1(String p1) { this.p1 = p1; } public Entity() { super(); // TODO Auto-generated constructor stub } public String getT1() { return t1; } public void setT1(String t1) { this.t1 = t1; } } GoAction.java: package actions_pack; import javax.servlet.ServletRequest; import javax.servlet.http.HttpSession; import org.apache.struts2.ServletActionContext; import com.opensymphony.xwork2.ActionContext; import com.opensymphony.xwork2.ActionInvocation; import com.opensymphony.xwork2.ActionSupport; import com.opensymphony.xwork2.ModelDriven; import com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor; import com.opensymphony.xwork2.util.ValueStack; public class GoAction implements ModelDriven<Entity> { private Entity en; public Entity getEn() { return en; } public void setEn(Entity en) { this.en = en; } public String execute(){ System.out.println("inside action"); if(en.getT1().equalsIgnoreCase("nitin")){ return "success"; } else{ return "failure"; } } @Override public Entity getModel() { System.out.println("inside model driven...."); en=new Entity(); return en; } } struts.xml: <?xml version="1.0" encoding="UTF-8"?> <result-type name="dispatcher" class="org.apache.struts2.dispatcher.ServletDispatcherResult" default=…
has answer: http://stackoverflow.com/a/24991661
score: 0
upvote count: 1
downvote count: 1
has title: Unable to execute Struts 2 program with ModelDriven interceptor
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/38855026
type: Question
accepted answer: http://stackoverflow.com/a/24991661
tagged with: jsp
has comment: http://stackoverflow.com/comment/38855336
has comment: http://stackoverflow.com/comment/38854015

http://stackoverflow.com/comment/38958381
type: Comment
comment on: http://stackoverflow.com/a/25046455
type: AnswerComment
score: 0
has text: This answers it http://stackoverflow.com/questions/5712100/interview-java-equals/5712112#5712112

http://stackoverflow.com/comment/38764180
has text: I never thought about multithreads. But it definitely makes sense. I'll investigate
comment on: http://stackoverflow.com/q/24943122
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38977745
type: Comment
comment on: http://stackoverflow.com/q/25056772
type: QuestionComment
has text: yes as suggested in my post as well. follow the links.
score: 0

http://stackoverflow.com/comment/39441192
type: AnswerComment
has text: Ahh, been struggling with this issue for the past few days too. Just upgraded my install to 6.3 and followed the guide you posted. JConsole appears to be working fine now! Thanks.
type: Comment
comment on: http://stackoverflow.com/a/25305169
score: 0

http://stackoverflow.com/comment/38784549
type: Comment
type: QuestionComment
has text: @nobalG: it´s a linearLayout, layout_centerHorizontal=true is a relativeLayout attribute.
comment on: http://stackoverflow.com/q/24954418
score: 0

http://stackoverflow.com/a/24942255
accepted answer of: http://stackoverflow.com/q/24942105
type: Answer
has body: Your tiles def is pointing to the WEB_INF folder when it should be pointing to the WEB-INF folder (dash instead of underscore) so spring doesn't know where to look within the app and is just making a normal http request, which is getting caught by the wildcard match.
answers question: http://stackoverflow.com/q/24942105
downvote count: 0
score: 3
upvote count: 3
type: AcceptedAnswer

http://stackoverflow.com/q/24973334
tagged with: rows
score: 0
accepted answer: http://stackoverflow.com/a/24977497
answer count: 1
has title: Dynamic TableView populating.Error-"duplicate children added".When adding rows from database.Works with single row,fail multiple
linked to: http://stackoverflow.com/q/24436196
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38827785
tagged with: java
tagged with: javafx
has body: I have controller that enable showing result from database in tableView.Problem that i have it only works with single row data.If i execute query that have result set which include multiple rows it fails to populate table. Error that i get: Exception in thread "JavaFX Application Thread" java.lang.IllegalArgumentException: Children: duplicate children added: parent = TableRow@7575a6e7[styleClass=cell indexed-cell table-row-cell]'null' at javafx.scene.Parent$2.onProposedChange(Parent.java:458) at com.sun.javafx.collections.VetoableListDecorator.setAll(VetoableListDecorator.java:115) at com.sun.javafx.scene.control.skin.TableRowSkinBase.updateCells(TableRowSkinBase.java:507) at com.sun.javafx.scene.control.skin.TableRowSkinBase.init(TableRowSkinBase.java:146) at com.sun.javafx.scene.control.skin.TableRowSkin.&lt;init&gt;(TableRowSkin.java:57) at javafx.scene.control.TableRow.createDefaultSkin(TableRow.java:217) at javafx.scene.control.Control.impl_processCSS(Control.java:876) at javafx.scene.Node.processCSS(Node.java:8732) at javafx.scene.Node.processCSS(Node.java:8725) at javafx.scene.Node.processCSS(Node.java:8725) at javafx.scene.Node.processCSS(Node.java:8725) at javafx.scene.Node.processCSS(Node.java:8725) at javafx.scene.Node.processCSS(Node.java:8725) at javafx.scene.Node.processCSS(Node.java:8725) at javafx.scene.Node.processCSS(Node.java:8725) at javafx.scene.Node.processCSS(Node.java:8725) at javafx.scene.Node.processCSS(Node.java:8725) at javafx.scene.Node.processCSS(Node.java:8725) at javafx.scene.Node.processCSS(Node.java:8725) at javafx.scene.Node.processCSS(Node.java:8725) at javafx.scene.Node.processCSS(Node.java:8725) at javafx.scene.Node.applyCss(Node.java:8825) at javafx.scene.Node.impl_processCSS(Node.java:8746) at com.sun.javafx.scene.control.skin.VirtualFlow.setCellIndex(VirtualFlow.java:1799) at com.sun.javafx.scene.control.skin.VirtualFlow.getCell(VirtualFlow.java:1689) at com.sun.javafx.scene.control.skin.VirtualFlow.getCellLength(VirtualFlow.…
type: Question
has comment: http://stackoverflow.com/comment/38822340
tagged with: tableview
tagged with: database
has answer: http://stackoverflow.com/a/24977497

http://stackoverflow.com/comment/38940438
has text: The realt problem is that I don't know how take WebServiceContext from my class
type: AnswerComment
comment on: http://stackoverflow.com/a/25036074
type: Comment
score: 0

http://stackoverflow.com/comment/38850634
type: Comment
has text: @alfasin it's alright.
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/24989269

http://stackoverflow.com/comment/38980988
type: QuestionComment
has text: `StringBuilder` is better than `StringBuffer`
score: 1
comment on: http://stackoverflow.com/q/25058861
type: Comment

m2e
type: Tag
tag name: m2e
tags question: http://stackoverflow.com/q/25066290
tags question: http://stackoverflow.com/q/24972091

http://stackoverflow.com/a/61535146
has comment: http://stackoverflow.com/comment/133602029
has body: Solution for pulling Map using @Value from application.yml property coded as multiline application.yml other-prop: just for demo my-map-property-name: "{\ key1: \"ANY String Value here\", \ key2: \"any number of items\" , \ key3: \"Note the Last item does not have comma\" \ }" other-prop2: just for demo 2 Here the value for our map property "my-map-property-name" is stored in JSON format inside a string and we have achived multiline using \ at end of line myJavaClass.java import org.springframework.beans.factory.annotation.Value; public class myJavaClass { @Value("#{${my-map-property-name}}") private Map&lt;String,String&gt; myMap; public void someRandomMethod (){ if(myMap.containsKey("key1")) { //todo... } } } More explanation \ in yaml it is Used to break string into multiline \" is escape charater for "(quote) in yaml string {key:value} JSON in yaml which will be converted to Map by @Value #{ } it is SpEL expresion and can be used in @Value to convert json int Map or Array / list Reference Tested in a spring boot project
type: Answer
answers question: http://stackoverflow.com/q/24917194
downvote count: 0
score: 19
upvote count: 19

apache
tags question: http://stackoverflow.com/q/24981592
tag name: apache
tags question: http://stackoverflow.com/q/25059196
tags question: http://stackoverflow.com/q/24968305
tags question: http://stackoverflow.com/q/25068097
tags question: http://stackoverflow.com/q/25024663
tags question: http://stackoverflow.com/q/24911591
tags question: http://stackoverflow.com/q/25036601
tags question: http://stackoverflow.com/q/25009090
tags question: http://stackoverflow.com/q/24926473
tags question: http://stackoverflow.com/q/25000414
tags question: http://stackoverflow.com/q/24943304
tags question: http://stackoverflow.com/q/24997381
tags question: http://stackoverflow.com/q/25013629
tags question: http://stackoverflow.com/q/25013988
tags question: http://stackoverflow.com/q/25024446
tags question: http://stackoverflow.com/q/25040890
tags question: http://stackoverflow.com/q/24962664
tags question: http://stackoverflow.com/q/24910942
tags question: http://stackoverflow.com/q/25065572
type: Tag
tags question: http://stackoverflow.com/q/24952989
tags question: http://stackoverflow.com/q/24975343
tags question: http://stackoverflow.com/q/25022892
tags question: http://stackoverflow.com/q/25019495
tags question: http://stackoverflow.com/q/25003272
tags question: http://stackoverflow.com/q/24963450
tags question: http://stackoverflow.com/q/25031405
tags question: http://stackoverflow.com/q/25057591

http://stackoverflow.com/comment/38753759
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24917630
has text: *"the videos he made are from 2012"* And they *still* used AWT? I think it's time to find a new instructor. Next he'll have you learning COBOL.
score: 0

http://stackoverflow.com/q/24994652
has answer: http://stackoverflow.com/a/25012564
has body: I want to use a programmatic constraint definition to redefine the default group: constraintMapping.type(User.class) .defaultGroupSequence(AlwaysCheck.class, User.class) .property("name", ElementType.FIELD) .constraint( new LengthDef().max(1) .groups(AlwaysCheck.class) .message("text")) When I persist the object in the database the check is not happening. The same constraint works when given in annotations: @GroupSequence({AlwaysCheck.class, User.class}) public class User implements Serializable { //... @Length(max = 1, message = "text", groups = {AlwaysCheck.class}) private String name; } How can I express this as a program? SOLUTION ... ... #{validator} UPDATE2 @Gunnar In Spring Context I create bean //... public class LocalValidatorFactoryBeanOverride extends SpringValidatorAdapterOverride implements ValidatorFactory, ApplicationContextAware, InitializingBean { //UPDATE My constraint definition private ConstraintMappingFactory constraintMappingFactory; //.. @SuppressWarnings("unchecked") public void afterPropertiesSet() { @SuppressWarnings("rawtypes") Configuration configuration = (this.providerClass != null ? Validation.byProvider(this.providerClass).configure() : Validation.byDefaultProvider().configure()); MessageInterpolator targetInterpolator = this.messageInterpolator; if (targetInterpolator == null) { targetInterpolator = configuration.getDefaultMessageInterpolator(); } configuration.messageInterpolator(new LocaleContextMessageInterpolator(targetInterpolator)); if (this.traversableResolver != null) { configuration.traversableResolver(this.traversableResolver); } ConstraintValidatorFactory targetConstraintValidatorFactory = this.constraintValidatorFactory; if (targetConstraintValidatorFactory == null && this.applicationContext != null) { targetConstraintValidatorFactory = new SpringConstraintValidatorFactory(this.applicationContext.getAutowireCapableBeanFactory()); } if (targetConstraintValidatorFactory != null) { configuration.constraintValidatorFactory(ta…
score: 2
tagged with: java
tagged with: hibernate
type: Question
tagged with: bean-validation
tagged with: validation
answer count: 1
downvote count: 0
has title: programmatic constraint definition and redefine the default group
favorite count: 0
tagged with: hibernate-validator
upvote count: 2
type: UnansweredQuestion

http://stackoverflow.com/comment/38843522
has text: How do you account for capital letters? Seems like a good use for HashMap
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24985762

http://stackoverflow.com/comment/38705955
comment on: http://stackoverflow.com/a/24912579
type: AnswerComment
type: Comment
has text: I have 2 dependencies: spring-webmcv 4.0.4.RELEASE, and javax.servlet.jsp-api 2.3.1, I can't change the javax version because its in a parent pom which is used by more packages (a lot more).
score: 0

http://stackoverflow.com/comment/38768385
score: 0
type: Comment
type: QuestionComment
has text: Is it assumed that each int has it's own line ?
comment on: http://stackoverflow.com/q/24945420

http://stackoverflow.com/comment/38930438
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/25031950
type: Comment
has text: The whole point of unit testing is that you test functional units ___in isolation___ so that you're not testing dependencies at the same time, and you do that by mocking any dependencies.

http://stackoverflow.com/a/25024968
accepted answer of: http://stackoverflow.com/q/25024894
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25024894
upvote count: 6
has body: The exact way in which this protects you is up to the database, but there are two obvious options: The database driver could perform string interpolation and generate a SQL statement which ensures that all parameters are properly escaped. The database driver could pass the SQL exactly as you've specified it to the database, and pass the values for the parameters through an entirely separate channel, which doesn't need any escaping, because it just contains the values. The latter is a more sensible solution in my view, as it allows the database to cache query plans really simply, recognizing that two queries are exactly the same other than the parameter values. I'd expect any modern database to support this in its native communication protocol.
type: Answer
score: 6
downvote count: 0

http://stackoverflow.com/q/24934281
downvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/24939706
type: Question
upvote count: 2
tagged with: nio
has body: When running this code, "aclAttr" is alway null on Linux (OpenSuSE 13.3) while "view" is fine. On Windows 7 "aclAttr" is fine. Any idea to get the code to work on Linux? FileSystem fs = FileSystems.getDefault(); Path path=fs.getPath(filename); AclFileAttributeView aclAttr = Files.getFileAttributeView(path, AclFileAttributeView.class); LOGGER.info("Attr={}", aclAttr); FileOwnerAttributeView view = Files.getFileAttributeView(path,FileOwnerAttributeView.class); LOGGER.info("View={}", view);
answer count: 1
favorite count: 0
has title: "AclFileAttributeView aclAttr" always null on OpenSuSE Linux
type: UnansweredQuestion
score: 2

http://stackoverflow.com/comment/38944649
type: QuestionComment
has text: `that would require me to cast the context we are accepting as a parameter to an Activity` - why are you not using your Activity's own context?
comment on: http://stackoverflow.com/q/25038910
score: 0
type: Comment

http://stackoverflow.com/q/25046702
has answer: http://stackoverflow.com/a/25046883
has comment: http://stackoverflow.com/comment/38958995
has comment: http://stackoverflow.com/comment/38958796
has body: So I decided to have my app start with a fade in animation to just make it have a nice and smooth start. Later on I add a slide in animation when the next activity starts and a slide out animation when I return to it. However when the app crashes or the device drops the app from memory but keeps the most recent activity in multitasking, when I go back to the main page it fades in once more. Fade in at start: super.onCreate(savedInstanceState); overridePendingTransition(android.R.anim.fade_in, 0); getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); setContentView(R.layout.activity_main); Slide out for next activity: Intent i = new Intent(MainActivity.this, Next.class); startActivity(i); overridePendingTransition(R.anim.right_slide_in, R.anim.right_slide_out); Slide in to resume: this.finish(); overridePendingTransition (R.anim.right_slide_in, R.anim.right_slide_out); Thanks for any help :)
tagged with: java
type: Question
score: 0
answer count: 1
tagged with: android
tagged with: animation
type: UnansweredQuestion
has title: Fade in Animation for App Start Repeating at Unwanted Times

http://stackoverflow.com/comment/38851069
has text: It strange, I get the axis page directly.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24953178
type: Comment

http://stackoverflow.com/a/24968316
type: Answer
upvote count: 1
score: 1
has body: Which button is called and instantiated when this code runs? Since you used the firstxml.xml as the layout of the activity you are calling the reference of that button from that xml not the button from the secondxml.xml. And in your R.java it will only generate one instance of that id. sample: public static final class id { public static final int button1=0x7f090009; } so when you used that reference of that button it will first find/check the layout's id if it exist if it does not exist then it will throw NPE.
downvote count: 0
answers question: http://stackoverflow.com/q/24968277

http://stackoverflow.com/q/25050735
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38966077
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/38966081
has title: Java Beginning Scanner
has comment: http://stackoverflow.com/comment/38966016
downvote count: 0
answer count: 1
tagged with: string
has comment: http://stackoverflow.com/comment/38966234
favorite count: 0
has comment: http://stackoverflow.com/comment/38966108
has comment: http://stackoverflow.com/comment/38966044
has answer: http://stackoverflow.com/a/25050779
accepted answer: http://stackoverflow.com/a/25050779
has body: I am a novice programmer and I am trying to do projects that I find fun to help me learn more about the language then my school classes have been able to provide. I have wanted to try reversing a string but instead of having the string defined in a string I have added a scanner to be able to allow a user to input what they want. After searching for any help I haven't been able to find my issue that I am having. So far I have this: import java.util.ArrayList; import java.util.Scanner; public class Reverse { static ArrayList&lt;String&gt; newString = new ArrayList(); static int inputLength = 0; static String PlaceHolder = null; static String beReturned = null; static int lengthArray = 0; static String ToBeReversed; static String hold = null; public static void reversal(){ inputLength = ToBeReversed.length(); for (int e = 0; e &lt;= inputLength; e++) { PlaceHolder = ToBeReversed.substring(inputLength -1, inputLength); newString.add(PlaceHolder); } } public static String putTogether() { int lengthcounter = 0; lengthArray = newString.size(); for (int i = 0; i &lt; lengthArray; i++) { beReturned = beReturned + newString.get(lengthcounter); if (lengthcounter &lt; lengthArray) { lengthcounter++; } } return beReturned; } public static void main(String[] args) { Scanner input = new Scanner(System.in); //create a new scanner ToBeReversed = input.nextLine(); Reverse.reversal(); Reverse.putTogether(); } } For any input that I input there is no result. I don't get an Error Message or any form of return... The output is blank. I am just wondering if I made a mistake with the scanner or if it is how I am trying to store the characters/access them from the ArrayList I created. I am trying to not have others give me the answer completely with all the fixes, I hope I can just get a pointer or a hint to where I am messing up. Thank you for your time and help.
upvote count: 2

http://stackoverflow.com/comment/39001407
has text: yes that might be... checking
type: QuestionComment
comment on: http://stackoverflow.com/q/25069301
type: Comment
score: 0

http://stackoverflow.com/a/24918885
has comment: http://stackoverflow.com/comment/38733911
upvote count: 0
has body: Generate String With Offset But No Date and No Time Your question is inaccurate. A java.util.Date has no time zone (assumes to always be in UTC). The JVM's time zone is applied in the object' toString method and in other formatting code that generates a String representation. Therein lies your solution: use a date-time formatter that generates a String containing only the offset from UTC without the date or the time-of-day portions. Avoid java.util.Date &amp; .Calendar Avoid using the bundled java.util.Date and .Calendar classes as they are notoriously troublesome. Instead use either Joda-Time or the new java.time package. Both support time zones as part of a date-time object. Joda-Time Here is how to generate a String representation of a DateTime in Joda-Time 2.3. DateTime dateTime = new DateTime( DateTimeZone.forID( "Asia/Kolkata" ) ); DateTimeFormatter formatter = DateTimeFormat.forPattern( "ZZ" ); String offset = formatter.print( dateTime ); // generates: +05:30 In Joda-Time 2.3 you can ask a DateTime object for its assigned time zone as an object. You may then interrogate the DateTimeZone object. DateTime dateTime = new DateTime( DateTimeZone.forID( "Asia/Kolkata" ) ); DateTimeZone timeZone = dateTime.getZone(); String id = timeZone.getID();
type: Answer
has comment: http://stackoverflow.com/comment/38788734
has comment: http://stackoverflow.com/comment/38741766
downvote count: 1
answers question: http://stackoverflow.com/q/24912908
has comment: http://stackoverflow.com/comment/38769718
score: -1

http://stackoverflow.com/comment/39007111
type: QuestionComment
comment on: http://stackoverflow.com/q/25069432
score: 0
type: Comment
has text: I did that in my code but when I scroll down the buttons automatically get checked

http://stackoverflow.com/comment/38710289
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24914525
has text: @juanchopanza - And a corollary to that is that in JITC-optimized Java getter and setter functions are "free" -- zero cost vs accessing the variables directly.
score: 0

http://stackoverflow.com/comment/38963351
comment on: http://stackoverflow.com/q/25049171
type: Comment
type: QuestionComment
has text: @PM77-1 I might be missing something, but `/` is a valid character to be used in a `String` "\" isn't and would need to be escaped, but under Windows, Java doesn't care if you use `/` or "\" ("\\") for path separators, Linux based OS do
score: 2

http://stackoverflow.com/comment/38744324
comment on: http://stackoverflow.com/a/24932595
type: AnswerComment
score: 0
type: Comment
has text: I've updated the question, it should now be more clear what I meant. Sorry!

http://stackoverflow.com/comment/38903089
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25017351
has text: The fields of your class are null. You must write something like this: TextField dayText = new TextField();
score: 1

http://stackoverflow.com/comment/38783536
score: 0
has text: @isnot2bad no the merged cells go from left to right, if the cells on the lift are different we dont merge the cells
type: Comment
comment on: http://stackoverflow.com/q/24953856
type: QuestionComment

http://stackoverflow.com/comment/38850363
score: 0
has text: Yes, that is what I know
type: Comment
comment on: http://stackoverflow.com/a/24988403
type: AnswerComment

http://stackoverflow.com/comment/38853674
score: 0
comment on: http://stackoverflow.com/q/24991176
type: QuestionComment
type: Comment
has text: But the List is. The values of the keys in the Map are List of String. I may be wrong feel free to correct me.

http://stackoverflow.com/a/24971472
has comment: http://stackoverflow.com/comment/38816795
has comment: http://stackoverflow.com/comment/38816722
score: 1
answers question: http://stackoverflow.com/q/24971437
downvote count: 1
has comment: http://stackoverflow.com/comment/38816701
has comment: http://stackoverflow.com/comment/38816583
has comment: http://stackoverflow.com/comment/38816633
has comment: http://stackoverflow.com/comment/38816871
has body: Dashed lines, as presented by Kevin Workman: public void drawDashedLine(Graphics g, int x1, int y1, int x2, int y2){ //creates a copy of the Graphics instance Graphics2D g2d = (Graphics2D) g.create(); Stroke dashed = new BasicStroke(3, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL, 0, new float[]{9}, 0); g2d.setStroke(dashed); g2d.drawLine(x1, y1, x2, y2); //gets rid of the copy g2d.dispose(); } You can create dashed lines like using this. Wavy Lines, as presented by Tiger: import java.awt.geom.*; import java.awt.*; import javax.swing.*; public class CurveDraw extends JFrame { public static void main(String[] args) { CurveDraw frame = new CurveDraw(); frame.setVisible(true); } public CurveDraw() { setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setSize(400,400); } public void paint(Graphics g) { QuadCurve2D.Double curve = new QuadCurve2D.Double(50,100,100,170,150,100); ((Graphics2D)g).draw(curve); } } Docs.oracle to learn more about Swing wavy line Curvy line Docs.oracle to learn more about Swing
has comment: http://stackoverflow.com/comment/38816540
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/38816591
has comment: http://stackoverflow.com/comment/38816724

http://stackoverflow.com/a/25454785
upvote count: 5
answers question: http://stackoverflow.com/q/25065336
has body: I'd add a comment, but my rep isn't high enough... Anyway, deleting .android folder worked for me. Your wording suggests you deleted then restarted Eclipse. Try: Stop/Exit out of Eclipse Delete .android Restart Eclipse
score: 4
has comment: http://stackoverflow.com/comment/59508340
type: Answer
downvote count: 1

http://stackoverflow.com/a/27381259
answers question: http://stackoverflow.com/q/25011888
has comment: http://stackoverflow.com/comment/45045759
score: 0
type: Answer
has body: It doesn't work either. responseLength is always 0. It should not be. That command is absolutely correct Read Card ID command: {(byte)0xFF, (byte)0xCA, (byte)0x00, (byte)0x00, (byte)0x04 and it works perfectly in Windows Java Example with the same ACR122 usb reader: // Transmit APDU byte[] command = {(byte)0xFF, (byte)0xCA, (byte)0x00, (byte)0x00, (byte)0x04}; byte[] response = new byte[100]; int responseLength = 0; try { responseLength = mReader.transmit(0, command, command.length, response, response.length); } catch (ReaderException e) { // TODO Auto-generated catch block e.printStackTrace(); } TextView tv = (TextView)findViewById(R.id.main_text_view_response); tv.setText( "resp: "+Integer.toString(responseLength) + ": "+ Integer.toString( response[0] ) );

http://stackoverflow.com/comment/38789331
score: 0
type: Comment
comment on: http://stackoverflow.com/q/24956971
type: QuestionComment
has text: I think both works? What is the issue?

http://stackoverflow.com/comment/38770245
type: Comment
comment on: http://stackoverflow.com/a/24946442
has text: Just one question, if you are using fragments, why are you calling the function in the activity??, do you try call loadPlayers in the fragment onCreateView() function?
score: 0
type: AnswerComment

http://stackoverflow.com/comment/38796824
score: 0
type: AnswerComment
type: Comment
has text: @bad_alloc You need to call updateComponentTreeUI for any components that currently exist at the time you change the look and feel. That is the only time you need to call it. If you create new components after having changed the look and feel, then the new components will already have the correct look and feel setting.
comment on: http://stackoverflow.com/a/24960454

http://stackoverflow.com/a/24999294
score: 3
has comment: http://stackoverflow.com/comment/38869420
type: Answer
has comment: http://stackoverflow.com/comment/38869759
upvote count: 3
has comment: http://stackoverflow.com/comment/38868891
has comment: http://stackoverflow.com/comment/38869238
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24999198
has body: Using openCSV, you could use this code: CSVReader reader = new CSVReader(new FileReader("yourfile.csv"), ';'); That will open the .csv file, read it in, and use a ; as the delimiter. A similar example can be found on the openCSV home page. Once you have the file read in, you can use the data with something like the following: String [] nextLine; // Read from the csv sequentially until all the lines have been read. while ((nextLine = reader.readNext()) != null) { // nextLine[] is an array of values from the line System.out.println(nextLine[0] + nextLine[1] + "etc..."); } Where nextLine is a line from the file, and nextLine[0] will be the first element of the line, nextLine[1] will be the second, etc. Edit: In your comment below, you mentioned that you don't know how many elements will be in each row. You can handle that by using nextLine.length and figuring out how many elements are in that row. For example, change the above code to something like: String [] nextLine; while ((nextLine = reader.readNext()) != null) { if(nextLine.length == 1) { // Do something with the first element, nextLine[0] System.out.println(nextLine[0]); } else if(nextLine.length == 2) { // Do something with both nextLine[0] and nextLine[1] System.out.println(nextLine[0] + ", " + nextLine[1]); } // Continue depending on how you want to handle the different rows. }
answers question: http://stackoverflow.com/q/24999198

http://stackoverflow.com/comment/38919530
score: 0
type: QuestionComment
type: Comment
has text: one moment please ....
comment on: http://stackoverflow.com/q/25025666

http://stackoverflow.com/q/24966336
answer count: 2
tagged with: android
upvote count: 6
tagged with: java
has answer: http://stackoverflow.com/a/24966513
has comment: http://stackoverflow.com/comment/38807107
tagged with: eclipse
has comment: http://stackoverflow.com/comment/51063226
downvote count: 10
tagged with: intellij-idea
has body: Recently I've been doing some android programming using Java and the Netbeans IDE (I have experience with Turbo Delphi, python and some c#), I have gotten to the stage of GUI's, for loops, switch statements, arrays and using some of the libraries (mainly from the course I am taking right now at my high school). I have been taught that ALL java programs need a 'main' method and this is under public static void main( String[ ] args ) {}. However when using android studio (which uses the IntelliJ IDE), the base code looks different and has no 'main method'. How does this work?
score: -4
has comment: http://stackoverflow.com/comment/38807331
has comment: http://stackoverflow.com/comment/38807044
has answer: http://stackoverflow.com/a/24966489
accepted answer: http://stackoverflow.com/a/24966513
type: AnsweredQuestion
favorite count: 0
tagged with: android-studio
possible better answer: http://stackoverflow.com/a/24966489
has comment: http://stackoverflow.com/comment/38815815
has title: Relatively new to Java programming but confused with 'Android studio'
type: Question

http://stackoverflow.com/comment/38902321
comment on: http://stackoverflow.com/a/25016733
score: 0
type: Comment
type: AnswerComment
has text: Ohhh, okay I see what your saying now, so I should change all my parameters coming in as Strings, then when I put it in the String array, they will change automatically.

http://stackoverflow.com/comment/38972796
score: 0
comment on: http://stackoverflow.com/q/25053642
type: QuestionComment
type: Comment
has text: Since you can access your webapp there must be an open port for HTTP connections. Usually port 80.

http://stackoverflow.com/comment/38794608
type: Comment
type: QuestionComment
has text: I was talking about, why I need to follow the naming convention even after I define my XML annotations on getters (in jersey rest), not about JAVA getters and setters in general.Thanks for your answer anyways
comment on: http://stackoverflow.com/q/24924942
score: 0

http://stackoverflow.com/a/24945091
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/24945065
accepted answer of: http://stackoverflow.com/q/24945065
score: 1
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/38768023
has comment: http://stackoverflow.com/comment/38767626
has body: There are problems with your character encoding. You need to make sure the character encoding you are using for the JSON supports the language you are using and that both ends of the link are using the same encoding.
has comment: http://stackoverflow.com/comment/38767648

http://stackoverflow.com/comment/38711364
type: Comment
score: 1
has text: following is the reference http://forum.spring.io/forum/spring-projects/data/48130-simplejdbctemplate-batchupdate-method
comment on: http://stackoverflow.com/a/24915387
type: AnswerComment

http://stackoverflow.com/comment/38944526
score: 1
comment on: http://stackoverflow.com/q/25039336
has text: You should still be able to check the hash using the same code shown in Example #1 here: http://us3.php.net/manual/en/function.crypt.php
type: Comment
type: QuestionComment

http://stackoverflow.com/a/30102592
score: 0
answers question: http://stackoverflow.com/q/24950909
type: Answer
has body: Is the class named 'Dog.java' in your classpath?

http://stackoverflow.com/comment/116543441
comment on: http://stackoverflow.com/a/65762810
type: Comment
has text: that's exactly what i need
score: 2
type: AnswerComment

http://stackoverflow.com/q/24924088
tagged with: javaw
type: Question
accepted answer: http://stackoverflow.com/a/24924509
downvote count: 0
answer count: 1
tagged with: jar
has comment: http://stackoverflow.com/comment/38727967
score: 1
has comment: http://stackoverflow.com/comment/38728382
favorite count: 0
has comment: http://stackoverflow.com/comment/38727990
has body: I have a .jar file that I would like to open via double clicking it and not the command line. When I double click it however it opens with Javaw.exe, I would like it to open with Java.exe when I double click it. Note: I do not want to change the default program it opens with (Java TM Platform SE binary) because I still want my other .jar files to open with Javaw.exe. Thanks
has comment: http://stackoverflow.com/comment/38727697
upvote count: 1
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/24924509
has title: open .Jar file with java and not javaw via Double Click

http://stackoverflow.com/a/24947073
has body: From this I think you need to do two things: Fix relations public class Parent { @ManyToOne(optional=true) private Child child; } public class Child { @OneToMany private Set&lt;Parent&gt; parents; } Implements a remove method: void removeChild(Child toRemove) { for (Parent p : toRemove.getParents()) { p.setChild(null); em.merge(p); } em.delete(toRemove); }
accepted answer of: http://stackoverflow.com/q/24945415
answers question: http://stackoverflow.com/q/24945415
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 2
upvote count: 2

http://stackoverflow.com/q/25008599
has title: Nested if, else if, without brackets
tagged with: java
type: Question
upvote count: 2
answer count: 2
downvote count: 2
has comment: http://stackoverflow.com/comment/38886411
has answer: http://stackoverflow.com/a/25008653
has body: My code used to be: for(int i=1; i&lt;par.length(); i++) { if( '}'==(par.charAt(i)) ) if(parStack.pop()!='{') return false; else if( ')'==(par.charAt(i)) ) if(parStack.pop()!='(') return false; else if( ']'==(par.charAt(i)) ) if(parStack.pop()!='[') return false; else if ( '{'==(par.charAt(i)) || '['==(par.charAt(i)) || '('==(par.charAt(i))) parStack.push(par.charAt(i)); } And it did not work properly, unfortunately. Because of the nature of the error (only worked for {} brackets starting/ending), I realized that the else was redundant (since the method would return false anyways), so I removed it, and the code looked like this: for(int i=1; i&lt;par.length(); i++) { if( '}'==(par.charAt(i)) ) if(parStack.pop()!='{') return false; if( ')'==(par.charAt(i)) ) if(parStack.pop()!='(') return false; if( ']'==(par.charAt(i)) ) if(parStack.pop()!='[') return false; if ( '{'==(par.charAt(i)) || '['==(par.charAt(i)) || '('==(par.charAt(i))) parStack.push(par.charAt(i)); } The code then worked just fine. I was wondering why this error was caused though? I thought brackets would not be necessary for the code above since it was all single statements.
score: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/38886429
possible better answer: http://stackoverflow.com/a/25008653
has comment: http://stackoverflow.com/comment/38886424
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25008655
accepted answer: http://stackoverflow.com/a/25008655

http://stackoverflow.com/q/25032827
answer count: 1
favorite count: 0
tagged with: sockets
tagged with: multithreading
accepted answer: http://stackoverflow.com/a/25032957
linked to: http://stackoverflow.com/q/25030128
has body: I want to create server which is able to be connected with multiple clients, but I always get 'Socket Closed' exception or read NULL value from input streams, previously I thought it was caused by closing socket connection in a wrong way, so I post this topic, but now seems it's not the problem. Server Method //here I use thread pool to solve concurrency issue public static void main(String[] args) { try{ ExecutorService service = Executors.newFixedThreadPool(4); ServerSocket serverSocket = new ServerSocket(); while (true) { //keep listening Socket socket = serverSocket.accept(); service.execute(new HandlerThread(socket)); } }catch(Exception ex){ ex.printStackTrace(); } } HandlerThread Class public class HandlerThread extends Thread{ private Socket socket; private BufferedReader in; public HandlerThread(Socket socket) throws IOException { this.socket = socket; this.start(); } public void run(){ try { //Caches is a singleton class, which used to store the received data from client Caches caches = Caches.getInstance(); //32 line in = new BufferedReader(new InputStreamReader(socket.getInputStream(), "UTF-8")); String line = in.readLine(); //caches.list is an ArrayList synchronized (caches.globalCaches) { if (null != line) { caches.globalCaches.add(line); } } System.out.println(line); in.close(); socket.close(); } catch (IOException e) { e.printStackTrace(); } } } Client Simulator public class Main { public static void main(String[] args) throws IOException, InterruptedException { for(int i = 0 ; i &lt; 40; i++){ Thread.sleep(2000); test test1 = new test(); test1.start(); } } public static class test extends Thread{ public void run(){ try { Socket socket = new Socket("localhost", 5050); PrintStream out = new PrintStream(socket.getOutputStream()); out.println("Hello Server!"); out.close(); socket.close(); } catch (UnknownHostException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } } } Exception and problems Start server before client simulat…
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38932122
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/25032957
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/38932358
has comment: http://stackoverflow.com/comment/38933008
has comment: http://stackoverflow.com/comment/38932509
downvote count: 0
has comment: http://stackoverflow.com/comment/38933255
has title: Java Socket Exception: Socket Closed and null value

http://stackoverflow.com/comment/38966095
has text: What do you mean by 99% of times? like do you know all the test cases?
comment on: http://stackoverflow.com/q/25050627
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24944649
upvote count: 9
answers question: http://stackoverflow.com/q/24944568
has body: You need to click (actually un-click) one button with symbol of Pi. Characters you see are symbols of tabulations and line breaks (normally invisible).
score: 9
downvote count: 0
type: Answer

http://stackoverflow.com/a/24954985
score: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/38785970
has body: Normally I wouldn't answer such an under researched question but as they say "you don't know, what you don't know" so... A Java object is an instance of a Java class created with the new keyword and stored in the heap space in memory and referred to by it's variable name. MyClass classVariableName = new MyClass(); //Create object of type MyClass and refer to it with the name 'classVariableName' When new is called on a class, the constructor of that class is called on the object being created to allow you some control over creation. For example, setting the default values of member variables. More detailed description here
type: Answer
answers question: http://stackoverflow.com/q/24954926
upvote count: 1

http://stackoverflow.com/a/36724693
answers question: http://stackoverflow.com/q/24995953
has body: If I were you, I'd look for Java to C string and then use standard C string to Go string. I would consider writing a C function that converts Java string into C string and returns that back to Go runtime. C to GoString: b := C.malloc(50) defer C.free(unsafe.Pointer(b)) C.callToCFunction(PChar(b), 50) rs := C.GoString(PChar(b)) return rs, err Java has its own memory management and thus should have its own way of moving data into C. You may ask with Java JNI keywords. You are using Java and Go runtimes in one process. This may have some side-effects.
score: 0
type: Answer

http://stackoverflow.com/comment/38931735
type: AnswerComment
has text: take a look at log4j this might be easyer and has lots oh options ;)
type: Comment
score: 0
comment on: http://stackoverflow.com/a/25014249

http://stackoverflow.com/comment/38707730
comment on: http://stackoverflow.com/q/24913480
score: 0
type: Comment
type: QuestionComment
has text: I would suggest creating a Utility class, but be careful that you don't needlessly throw all your methods in it. Read over this Q/A http://stackoverflow.com/questions/3340032/utility-classes-are-evil

http://stackoverflow.com/comment/38821155
comment on: http://stackoverflow.com/q/24972437
type: Comment
type: QuestionComment
has text: @geonal, yes inside the request body
score: 0

http://stackoverflow.com/comment/38745580
type: Comment
comment on: http://stackoverflow.com/a/24933724
score: 0
type: AnswerComment
has text: thank you. should i post my custom made exception's code here?@NikhilJoshi

http://stackoverflow.com/comment/38878548
score: 0
type: QuestionComment
has text: @Scorpion Thank you. Please, post this as an answer and I'll accept it.
type: Comment
comment on: http://stackoverflow.com/q/25003394

http://stackoverflow.com/comment/38821199
type: QuestionComment
has text: HashSets don't work for arrays. But they do work for ArrayList. So why don't you use `HashSet<ArrayList<Integer>>` instead of `ArrayList<int[]>`?
comment on: http://stackoverflow.com/q/24973394
score: 0
type: Comment

http://stackoverflow.com/comment/38971084
type: QuestionComment
score: 1
has text: possible duplicate. http://stackoverflow.com/questions/1932091/prevent-multiple-login-using-the-same-user-name-and-password?lq=1
comment on: http://stackoverflow.com/q/25052679
type: Comment

http://stackoverflow.com/q/25055508
has comment: http://stackoverflow.com/comment/38974909
has answer: http://stackoverflow.com/a/25055555
has title: How to convert object class to arrayList ? java
has answer: http://stackoverflow.com/a/25055619
answer count: 4
favorite count: 0
type: UnansweredQuestion
has body: I have this code : ArrayList&lt;Integer&gt; users = new ArrayList&lt;Integer&gt;(); Map &lt;String,Object&gt; hashMap = new HashMap &lt;String,Object&gt; (); hashMap.put("users",user); // now I want to get users as array list hashMap.get("users")[i];//error How to users as array ? thank you
has comment: http://stackoverflow.com/comment/38974922
tagged with: java
has answer: http://stackoverflow.com/a/25055599
has comment: http://stackoverflow.com/comment/38974916
downvote count: 18
type: Question
upvote count: 4
has answer: http://stackoverflow.com/a/25055673
linked to: http://stackoverflow.com/q/1026723
has comment: http://stackoverflow.com/comment/38975064
duplicate of: http://stackoverflow.com/q/1026723
score: -14

http://stackoverflow.com/q/24950395
has answer: http://stackoverflow.com/a/26808061
has comment: http://stackoverflow.com/comment/40607144
tagged with: spring-mvc
has title: Issue with @Value and application.properties since moving to Spring Boot 1.1.4.RELEASE
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38779965
tagged with: java
has comment: http://stackoverflow.com/comment/38780317
upvote count: 10
accepted answer: http://stackoverflow.com/a/26808061
type: Question
has comment: http://stackoverflow.com/comment/38778565
tagged with: spring-boot
score: 10
downvote count: 0
has comment: http://stackoverflow.com/comment/38777868
answer count: 1
favorite count: 0
has body: I am having an issue since I moved to version 1.1.4.RELEASE of Spring Boot. My variables that are annotated with @Value are presently not being populated with values despite them being present in the application.properties. Prior to this I was using Spring Boot @ version 1.0.2, and that was working fine. It all started since the upgrade, and I made no code change. SampleApplication.java package org.sample; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.PropertySource; import org.springframework.context.support.PropertySourcesPlaceholderConfigurer; @Configuration @ComponentScan @EnableAutoConfiguration @PropertySource(value = "classpath:application.properties") public class SampleApplication { private static Logger logger = LoggerFactory .getLogger(TaskManagerApplication.class); @Value("${org.sample.sampleProperty}") private static String sampleProperty; public static void main(String[] args) { SpringApplication.run(SampleApplication.class, args); System.out.print("SampleApplication started: " + sampleProperty); } @Bean public static PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer() { return new PropertySourcesPlaceholderConfigurer(); } } application.properties spring.datasource.url: jdbc:mysql://127.0.0.1:3306/mydb spring.datasource.username: root spring.datasource.password: root spring.datasource.driverClassName: com.mysql.jdbc.Driver spring.jpa.show-sql: true #Disable the ddl-auto:create once tables have been created #spring.jpa.hibernate.ddl-auto: create org.sample.sampleProperty=This is a sample property photos.upload.dir=C:/temp/UserPhotos/ # Server port server.port=8081 I have tried to add a PropertySourcesPlaceholderConfigurer bean and e…

http://stackoverflow.com/comment/38924180
type: Comment
comment on: http://stackoverflow.com/a/25024713
score: 0
type: AnswerComment
has text: Thanks, but I have a more complicated one. for example : n3=x2* (n1+n2- n1*n2) +x1* (n1-n2) *(n1-n2), then how to deal with it? here all variables are all 0 or 1.

http://stackoverflow.com/comment/38770684
comment on: http://stackoverflow.com/q/24946253
has text: @njzk2 I understand why that might be an issue, but I was doing practically the same thing with addPlayer. Is it because I was calling it from the fragment that it works there and not in loadPlayer? Is it because I'm calling it with this.loadPlayers that it does not work?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25037453
answers question: http://stackoverflow.com/q/25037403
type: Answer
accepted answer of: http://stackoverflow.com/q/25037403
has body: So how i can achieve this. You can't, basically - not the way you're trying. Each constructor chains to exactly one other constructor, either in the same class or the direct superclass. I suggest you create one "primary" constructor which does all the initialization you need, and then chain to it - potentially indirectly - from all the other constructors. If you're doing non-initialization work in your constructor, that's a design smell in itself, and you should revisit your design. I also strongly recommend that you start following Java naming conventions.
upvote count: 4
downvote count: 0
has comment: http://stackoverflow.com/comment/38942010
score: 4
type: AcceptedAnswer

xamarin.android
type: Tag
tag name: xamarin.android
tags question: http://stackoverflow.com/q/24934235

http://stackoverflow.com/a/25026777
upvote count: 1
answers question: http://stackoverflow.com/q/25026458
has body: From you question, it's difficult to be 100% sure, but, it is generally encouraged to use a Model–view–controller approach to these types of problems. This is, the model defines the "virtual" state, the view represents this state to the user and the controller controls changes to the model initiated from the view... The view is notified, by the model, when it changes, so it can update the state and the view notifies the controller when some part of its view/state has changed and may be reflected in the model. To this end, I would encourage you to define some kind of model, which is normally described by a interface which can be used by the various aspects of your program. Updates to the model don't need to come from the user/UI, but you will need to ensure that you clearly document when notifications might come from a different thread other than the Event Dispatching Thread, so your UI code can take correct actions and synchronise the updates. So, based on you example, your model might have a method call setText (or some such), which triggers some kind of event notification to registered listeners. This instance of the model would be shared amongst the various classes of your application You main UI would be one of these classes listening for a change in the models state, when it detected a change, it would update its state accordingly. This is an example of the observer pattern and you see this in use all over Swing (via it's listener/event API)
accepted answer of: http://stackoverflow.com/q/25026458
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 1

http://stackoverflow.com/q/25022027
downvote count: 12
has body: I would like to know how can I write a program that give me as output the Fibonacci sequence (until N member) in one line? The real obligation of my problem is do this program in one line. I know how can I do it with recursion but in only one line, I haven't any idea how can I do that.
has answer: http://stackoverflow.com/a/25022390
possible better answer: http://stackoverflow.com/a/25022466
has title: How to write Fibonacci in one line?
answer count: 3
has comment: http://stackoverflow.com/comment/38912493
has comment: http://stackoverflow.com/comment/38912433
favorite count: 0
has comment: http://stackoverflow.com/comment/38912402
has comment: http://stackoverflow.com/comment/38912468
has comment: http://stackoverflow.com/comment/38912445
has comment: http://stackoverflow.com/comment/38912510
has answer: http://stackoverflow.com/a/25022339
score: -11
upvote count: 1
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38912342
has comment: http://stackoverflow.com/comment/38912235
tagged with: java
has comment: http://stackoverflow.com/comment/38912473
has comment: http://stackoverflow.com/comment/38912294
type: Question
has answer: http://stackoverflow.com/a/25022466
has comment: http://stackoverflow.com/comment/38912130
has comment: http://stackoverflow.com/comment/38913198
has comment: http://stackoverflow.com/comment/38912542
accepted answer: http://stackoverflow.com/a/25022339

http://stackoverflow.com/q/25032657
has body: The problem I'm facing is the following: When I start my app all the singletons get initialized in the main activity and everything works as expected. Then if I press the home buttom and comeback to the app quickly everything works, I think it's because everything is in memory yet, but if I go to chrome watch a couple of videos or start a game and try to get back to my app I get an exception. I don't understand this state of the app because it's not killed but it's not in memory and it tries to get back to the activity it was before pressing the home buttom, the onCreate method is called and I receive the Intent which called the activity in the first place but singletons are not initialized, the exception occurs here: Tracker tracker = GoogleAnalytics.getInstance(this).getDefaultTracker(); tracker.set(Fields.SCREEN_NAME, "My View"); tracker.send(MapBuilder .createAppView() .build() ); A possible solution I tried is just checking the tracker and if it is null create a new one and set it: if(tracker == null){ tracker = GoogleAnalytics.getInstance(this).getTracker(trackerId); GoogleAnalytics.getInstance(this).setDefaultTracker(tracker); } But I get another exception in another singleton. My question is: what variables are kept in memory when the app is in this state? What should I do, maybe call finish when the tracker is null? or Intent the main activity?
upvote count: 4
downvote count: 0
possible better answer: http://stackoverflow.com/a/25032737
has comment: http://stackoverflow.com/comment/38931993
has comment: http://stackoverflow.com/comment/38932123
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25032870
accepted answer: http://stackoverflow.com/a/25032870
has answer: http://stackoverflow.com/a/25032737
tagged with: java
has title: Singletons not available when the App comes back to memory
score: 4
type: Question
answer count: 2
favorite count: 0
tagged with: singleton
tagged with: android

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

java.nio.file
tags question: http://stackoverflow.com/q/24953321
tag name: java.nio.file
type: Tag

http://stackoverflow.com/q/24965224
score: 0
answer count: 2
has body: I cannot figure out why the second for loop built around pacs.length keeps adding elements to the set even though they do not contain the variable being searched for in the mems.contains. I cannot get the code to not add members to the set indiscriminately. I do not see where I am going wrong, obviously. import java.io.*; import java.util.*; public class Trubl { public static void main( String args[] ) throws Exception { BufferedReader pacsFile = new BufferedReader( new FileReader( "pacs.txt" ) ); BufferedReader membersFile = new BufferedReader( new FileReader( "members.txt" ) ); TreeSet&lt;String&gt; memsSet = new TreeSet&lt;String&gt;(); TreeMap&lt;String, TreeSet&lt;String&gt;&gt; pac2mems = new TreeMap&lt;String, TreeSet&lt;String&gt;&gt;(); String[] pacs = new String [9]; int cnt = 0; for(int i = 0; i &lt; pacs.length; i++) { String pac = pacsFile.readLine(); pacs[i] = pac; } pacsFile.close(); Arrays.sort(pacs); int j = 0; while (membersFile.ready()) { String mems = membersFile.readLine(); System.out.println(mems); String[] splitter = mems.split("\\s+"); for (int i = 1; i &lt; pacs.length; i++) { System.out.println(pacs[i]); if (mems.contains(pacs[i])) { memsSet.add(splitter[0]); } System.out.println(memsSet); } pac2mems.put(pacs[j], memsSet); j++; } membersFile.close(); for (cnt = 0; cnt &lt; pac2mems.size(); cnt++) System.out.println(pacs[cnt] + " " + pac2mems.get(pacs[cnt])); } // END MAIN }
type: UnansweredQuestion
has title: Why is this program indiscriminately adding members to the set memsSet?
has answer: http://stackoverflow.com/a/24965292
has comment: http://stackoverflow.com/comment/38805813
tagged with: treeset
has answer: http://stackoverflow.com/a/24965836
tagged with: java
type: Question

http://stackoverflow.com/comment/38708260
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24913818
has text: http://stackoverflow.com/questions/21509150/default-boolean-value-in-java
score: 0

http://stackoverflow.com/comment/38894123
has text: you have to store the value of rating in a variable
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/25012481

http://stackoverflow.com/q/25033411
answer count: 2
upvote count: 1
has answer: http://stackoverflow.com/a/25033507
favorite count: 0
has body: I am using httpPut to java and I want to get the response code after I execute the command. What it gives me which is "response body" is: HTTP/1.1 200 OK [Cache-Control: no-cache, no-store, must-revalidate, Pragma: no-cache, Expires: Thu, 01 Jan 1970 00:00:00 GMT, Content-Type: application/json, Transfer-Encoding: chunked, Server: Jetty(8.1.8.v20121106)] But I only want 200! not the whole thing. Any help? This is my code by the way: String url = "http://localhost:80/api/clients/"; String clientID = "1234"; httpclient = new DefaultHttpClient(); HttpPut putRequest = new HttpPut(url + clientID); putRequest.setHeader("Content-Type", "application/x-www-form-urlencoded"); putRequest.setHeader("Charset", "UTF-8"); System.out.println(putRequest); // Add your data putRequest.setEntity(new StringEntity(clientID, "UTF-8")); HttpResponse responseBody = httpclient.execute(putRequest);
accepted answer: http://stackoverflow.com/a/25033489
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/25033489
type: Question
has title: How to get response code of httpPut in java
possible better answer: http://stackoverflow.com/a/25033507

http://stackoverflow.com/a/25068817
type: Answer
has body: It is one of the most basic rules in Object Oriented Programming Create a CardModel Object and call this object's method. CardModel cardModel = new CardModel(...); cardModel.getTitle(); that's it!
answers question: http://stackoverflow.com/q/25068678
score: 0

http://stackoverflow.com/comment/44200659
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27898793
type: Comment
has text: VM arguments are retained when in DEBUG mode though.

http://stackoverflow.com/a/24943780
answers question: http://stackoverflow.com/q/24943584
type: Answer
has comment: http://stackoverflow.com/comment/38808936
has body: Change this: &lt;jsp:useBean id="dataObject" class="com.mypack.BeanClass" scope="session"/&gt; &lt;jsp:setProperty name="dataObject" property="myMap"/&gt; &lt;% dataObject.setData(myMapObj); %&gt; To this: &lt;jsp:useBean id="dataObject" class="com.mypack.BeanClass" scope="session"/&gt; &lt;jsp:setProperty name="dataObject" property="data" value="${myMapObj}"/&gt; Your setter is called "setData(...)", not "setMyMap(...)". JSP is going to see property="data" and call setData(...). So that will fix you up, but you didn't show us where you are setting myMapObj. We have to assume that you are setting that up correctly elsewhere and have made it available to the tag via a pageContext.setAttribute("myMapObj", myMapObj); call. Side note: I recommend you rename the setData(..) method to setMyMap(...) to make it consistent with the getter getMyMap(...). If you do that, then you will need to change the property="..." back to "myMap", just like you had it.
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/38765419
accepted answer of: http://stackoverflow.com/q/24943584
has comment: http://stackoverflow.com/comment/38766006
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/24946454
upvote count: 1
downvote count: 1
tagged with: string
favorite count: 0
has comment: http://stackoverflow.com/comment/38770159
has comment: http://stackoverflow.com/comment/38770228
has answer: http://stackoverflow.com/a/24946505
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24946497
has body: I read something to buffer: char buf[] = new char[4096]; int got = reader.read(buf,0,4096); readLine() is not OK because of the stuff can contain "\n" characters. Then I nee to convert buf[] to String. String.valueOf(buf) will be of size buf.length() == 4096 and will contain junk at end. I need String of size got. There are 2 perverted way to do this. First way - create new array of size got, copy bytes to new array and do String.valueOf. Second way - append to String char by char converting each char to String.Is there better way not involving weird actions?
has title: Java - convert buffer to string (economical way)
type: Question
has answer: http://stackoverflow.com/a/24946477
tagged with: java
score: 0
answer count: 3

http://stackoverflow.com/comment/38845320
type: QuestionComment
has text: It is, sorry! I added an edit with the background class.
comment on: http://stackoverflow.com/q/24986621
score: 0
type: Comment

http://stackoverflow.com/comment/90258377
score: 0
type: Comment
has text: @roger_that - depends, but that's a completely different question. If you're comparing a "square" shape, you could probably work it out yourself... I'll leave that one to you though.
comment on: http://stackoverflow.com/a/25151302
type: AnswerComment

http://stackoverflow.com/q/24918802
type: AnsweredQuestion
tagged with: form-authentication
has comment: http://stackoverflow.com/comment/38742529
upvote count: 1
has answer: http://stackoverflow.com/a/25084996
has comment: http://stackoverflow.com/comment/38759697
type: Question
has title: Java/WildFly/MongoDB/JAAS - Authentication always returns 403 - Forbidden
score: 1
tagged with: java
tagged with: wildfly-8
tagged with: mongodb
answer count: 3
possible better answer: http://stackoverflow.com/a/32078948
accepted answer: http://stackoverflow.com/a/25084996
downvote count: 0
has answer: http://stackoverflow.com/a/38399805
has answer: http://stackoverflow.com/a/32078948
has body: I've created a custom LoginModule to authenticate the users present in mongoDB collections. In my case, I need one Role per page... I've already used JAAS authentication with JSF, but in this case, it's not working as expected... It's always returns 403 error (Forbidden). The mapping of the URLs apparently is OK. That's my pages hierarchy: app <-root pages my protected pages (one role per page) login.html login_error.html index.html Follow my configurations: jboss-web.xml nfceSecurityDomain true web.xml 30 FORM /app/login.html /app/login_error.html VISUALIZAR_NOTAS GESTAO_CERTIFICADO GESTAO_EMPRESA DOWNLOAD_XML INUTILIZACAO <web-resource-collection> index /app/index.html POST GET PUT DELETE </web-resource-collection> VISUALIZAR_NOTAS <web-resource-collection> orderList /app/pages/orderlist.html POST GET PUT DELETE </web-resource-collection> VISUALIZAR_NOTAS <web-resource-collection> certificateConfigurations /app/pages/certifiedlist.html POST GET PUT DELETE </web-resource-collection> GESTAO_CERTIFICADO <web-resource-collection> enterpriseConfigurations /app/pages/enterpriselist.html POST GET PUT DELETE </web-resource-collection> GESTAO_EMPRESA <web-resource-collection> xmlDownload /app/pages/orderdownload.html POST GET PUT DELETE </web-resource-collection> DOWNLOAD_XML <web-resource-collection> invalidate /app/pages/orderInvalidate.html POST GET PUT DELETE </web-resource-collection> INUTILIZACAO standalone.xml <login-module code="br.com.ciss.nfce.security.JAASLoginModule" flag="required"/> And here is my implementation of LoginModule, to get the user and roles from MongoDB: public class JAASLoginModule implements LoginModule { private static final Logger LOG = Logger.getLogger(JAASLoginModule.class); private Subject subject; private CallbackHandler callbackHandler; private Map sharedState; private Map options; private boolean succeeded = false; private boolean commitSucceeded = false; private String username = null; private String _idUser = ""; private char[] passwo…
has comment: http://stackoverflow.com/comment/38728671
favorite count: 0
tagged with: jaas

http://stackoverflow.com/comment/38859822
type: Comment
type: QuestionComment
has text: You're confusing me. You said "want to delete Cards from the List by referring to its rank" and then you said "I want to delete the Cards by referring to the card id". Which one is it?
score: 0
comment on: http://stackoverflow.com/q/24994511

http://stackoverflow.com/a/24966468
has comment: http://stackoverflow.com/comment/38807374
answers question: http://stackoverflow.com/q/24966453
has comment: http://stackoverflow.com/comment/38807478
has comment: http://stackoverflow.com/comment/38807308
downvote count: 0
has body: Did you declare your Activity in the manifest.xml?? It should be something like this: It would be placed the as the .Activity2 in this: <uses-sdk android:minSdkVersion="4" />
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/38807547
has comment: http://stackoverflow.com/comment/38807318
score: 2

http://stackoverflow.com/q/25049354
favorite count: 0
score: 0
has comment: http://stackoverflow.com/comment/38963617
has body: I would like to compare two arrays containing numbers, numbers highest occurrence (Top 10) in array2 to numbers in array1. Example array1 {123, 132, 231, 213, 312, 321,456, 765, 987} would mean that 123 in array2 = 6 times. This means 123 occurred 6 times in array1. The range for this is 000 - 999. Each number in array2 matches 6 numbers that maybe found in array1. Example 123 = 123, 132, 231, 213, 312, 321. Not counting numbers that repeat Example 111 or 177. Array2 has a fixed set of numbers while array1 is updated. What data type would I have to use? How would I count rearranged numbers? This is what I got so far; import java.util.Arrays; public class tuna { public static void main(String[] args) { int array1[] = { 123, 132, 231, 213, 312, 321}; int array2[] = { 012, 013, 014, 015, 016, 017, 018, 019, 123, 124, 125, 126, 127}; count(array1); } private static void count(int[] arr) { Arrays.sort(arr); int sum = 0, counter = 0; for (int i = 0; i &lt; arr.length; i++) { if (arr[0] == arr[arr.length - 1]) { System.out.println(arr[0] + ": " + counter + " times"); break; } else { if (i == (arr.length - 1)) { sum += arr[arr.length - 1]; counter++; System.out.println((sum / counter) + " : " + counter + " times"); break; } else { if (arr[i] == arr[i + 1]) { sum += arr[i]; counter++; } else if (arr[i] != arr[i + 1]) { sum += arr[i]; counter++; System.out.println((sum / counter) + " : " + counter + " times"); sum = 0; counter = 0; } } } } } }
has comment: http://stackoverflow.com/comment/38964855
has comment: http://stackoverflow.com/comment/38963902
has comment: http://stackoverflow.com/comment/38963635
upvote count: 1
has comment: http://stackoverflow.com/comment/38963575
downvote count: 1
type: AnsweredQuestion
has title: I would like to compare two arrays, and match highest occurrence from 1 to another?
tagged with: java
has answer: http://stackoverflow.com/a/25050531
has comment: http://stackoverflow.com/comment/38963606
has comment: http://stackoverflow.com/comment/38964750
type: Question
has comment: http://stackoverflow.com/comment/38963647
accepted answer: http://stackoverflow.com/a/25050531
answer count: 1
has comment: http://stackoverflow.com/comment/38965157
has comment: http://stackoverflow.com/comment/38964538
has comment: http://stackoverflow.com/comment/38963664

http://stackoverflow.com/q/24914354
accepted answer: http://stackoverflow.com/a/24914488
tagged with: if-statement
has comment: http://stackoverflow.com/comment/38709632
has comment: http://stackoverflow.com/comment/38709252
tagged with: java
has comment: http://stackoverflow.com/comment/38722658
has title: Error: else without if. What went wrong?
has body: The following code produces a compilation error of else without if. Everything else is fine. I would also like to know how to comment something out. import java.util.Scanner; public class CalcRunner { public static void main(String args[]) { System.out.println("Enter 1 to Add, 2 to Subtract, 3 to Divide, or 4 to Multiply"); int x = keyboard.nextInt(); if (x == 1); { System.out.println("Enter an integer"); int num1 = keyboard.nextInt(); System.out.println("Enter another integer"); int num2 = keyboard.nextInt(); System.out.println("The sum of the numbers equals " + (num1+num2)); } if (x == 2); { System.out.println("Enter an integer"); int num1 = keyboard.nextInt(); System.out.println("Enter another integer"); int num2 = keyboard.nextInt(); System.out.println("The sum of the numbers equals " + (num1-num2)); } if (x == 3); { System.out.println("Enter an integer"); int num1 = keyboard.nextInt(); System.out.println("Enter another integer"); int num2 = keyboard.nextInt(); System.out.println("The sum of the numbers equals " + (num1/num2)); } if (x == 4); { System.out.println("Enter an integer"); int num1 = keyboard.next=Int(); System.out.println("Enter another integer"); int num2 = keyboard.nextInt(); System.out.println("The sum of the numbers equals " + (num1*num2)); } else { System.out.print("Error 510038585832857329457294547243344684643734"); } } }
type: Question
score: -14
has answer: http://stackoverflow.com/a/24914421
answer count: 3
downvote count: 15
favorite count: 0
has comment: http://stackoverflow.com/comment/38709723
has answer: http://stackoverflow.com/a/24914488
has comment: http://stackoverflow.com/comment/38709522
possible better answer: http://stackoverflow.com/a/24914362
has comment: http://stackoverflow.com/comment/38709466
has answer: http://stackoverflow.com/a/24914362
upvote count: 1
type: AnsweredQuestion

http://stackoverflow.com/q/25005754
has comment: http://stackoverflow.com/comment/38886520
tagged with: timezone
has body: I have an input "+04:00" What API can i use to get the timezone from this? So far, 1) I looked into joda - https://www.joda.org/joda-time/apidocs/org/joda/time/DateTimeZone.html static DateTimeZone forOffsetHoursMinutes(int hoursOffset, int minutesOffset) Not sure if this is ideal. 2) I checked Timezone class. http://docs.oracle.com/javase/6/docs/api/java/util/TimeZone.html#getTimeZone%28java.lang.String%29 getTimeZone public static TimeZone getTimeZone(String ID) Gets the TimeZone for the given ID. Parameters: ID - the ID for a TimeZone, either an abbreviation such as "PST", a full name such as "America/Los_Angeles", or a custom ID such as "GMT-8:00". Note that the support of abbreviations is for JDK 1.1.x compatibility only and full names should be used. Returns: the specified TimeZone, or the GMT zone if the given ID cannot be understood. Can someone please explain how to give custom IDs as input to this function?
type: UnansweredQuestion
has title: How to get Timezone from String in JAVA
downvote count: 1
has answer: http://stackoverflow.com/a/25005875
type: Question
upvote count: 5
tagged with: java
score: 4
tagged with: jodatime
answer count: 1
linked to: http://stackoverflow.com/q/4869206
favorite count: 0

http://stackoverflow.com/comment/38920686
has text: No, this is not possible.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25026476

http://stackoverflow.com/q/25040924
has title: Artifactory default repository for missing jars
score: 0
answer count: 2
possible better answer: http://stackoverflow.com/a/25062072
has answer: http://stackoverflow.com/a/25062072
tagged with: maven
has answer: http://stackoverflow.com/a/25041574
type: AnsweredQuestion
tagged with: java
tagged with: artifactory
type: Question
accepted answer: http://stackoverflow.com/a/25041574
has body: How do I specify a specific remote repository (i.e. search.maven.org) so that artifactory defaults to looking for missing jars from there? I have a box that has a strict firewall and I need to know the exact url in order to get access to these jars and currently it pulls from several different sources. I Want to force it to use only one or two so I can have the sys admins open up the domains. Thanks.

http://stackoverflow.com/q/25052818
has title: Read .properties file every minute
type: AnsweredQuestion
favorite count: 0
has comment: http://stackoverflow.com/comment/38969953
has comment: http://stackoverflow.com/comment/38970649
type: Question
has body: I do a small task. My task is read message from .properties file in servlet and then pass it to jsp. I did it. Now I need to read .properties file every minute. I have no idea how to do it. Can anybody help me? This is my classes: MessageController import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; public class MessageController extends HttpServlet { private Messenger messenger; @Override public void init() throws ServletException { messenger = new Messenger(); } protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { request.setAttribute("message", messenger.getMessage("POST", request.getParameter("username"), getServletContext())); request.getRequestDispatcher("/result.jsp").forward(request, response); } protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { getServletContext().getAttribute("abc"); request.setAttribute("message", messenger.getMessage("GET", request.getParameter("username"), getServletContext())); request.getRequestDispatcher("/result.jsp").forward(request, response); } } Messeger (read properties file and form message): import java.io.IOException; import java.text.MessageFormat; import java.util.Properties; public class Messenger{ private static final String MESSAGE_PATH = "/WEB-INF/properties/message.properties"; public String getMessage(String requestType, String username, javax.servlet.ServletContext context) { Properties properties = readPropertiesFile(context); String message = formMessage(username, requestType, properties); return message; } private Properties readPropertiesFile(javax.servlet.ServletContext context){ Properties properties = new Properties(); try { properties.load(context.getResourceAsStream(MESSAGE_PATH)); } catch (IOException exception) { } return propert…
possible better answer: http://stackoverflow.com/a/25054088
tagged with: properties
has answer: http://stackoverflow.com/a/25056222
has comment: http://stackoverflow.com/comment/38970288
has answer: http://stackoverflow.com/a/25054598
has answer: http://stackoverflow.com/a/25054088
has comment: http://stackoverflow.com/comment/38970000
score: 0
tagged with: java
answer count: 3
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/38970373
has comment: http://stackoverflow.com/comment/38970087
has comment: http://stackoverflow.com/comment/38970429
has comment: http://stackoverflow.com/comment/38969912
accepted answer: http://stackoverflow.com/a/25056222
tagged with: servlets

http://stackoverflow.com/a/25064982
downvote count: 0
answers question: http://stackoverflow.com/q/25063018
upvote count: 2
has body: Make sure you have correct mapping (as geopoint for location), I think this might help. POST x/diseases/_search { "size": 0, "query": { "filtered": { "query": { "match_all": {} }, "filter": { "and": { "filters": [ { "geo_polygon": { "location": { "points": [ { "lat": 40.73, "lon": -74.1 }, { "lat": 40.83, "lon": -75.1 } ] } } }, { "geo_polygon": { "location": { "points": [ { "lat": 40.73, "lon": -74.1 }, { "lat": 40.83, "lon": -75.1 } ] } } } ] } } } }, "aggs": { "diseases": { "terms": { "field": "disease_name" } } } } Here, you can change the coordinates and if you want add similar filter for other polygons. Hope this helps!!
has comment: http://stackoverflow.com/comment/39137050
has comment: http://stackoverflow.com/comment/39136833
type: Answer
has comment: http://stackoverflow.com/comment/38994999
score: 2

http://stackoverflow.com/q/24941171
has title: Download from Android using ftp://user:password@url
score: 0
tagged with: android
has comment: http://stackoverflow.com/comment/38760028
tagged with: ftp
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38795444
tagged with: java
type: Question
has body: The following code works from command line Java on Windows, but does not work on Android device connected via WiFi. No Apache client used, just simple class using URL as below. When replacing my FTP by test HTTP URL h??p://google.com, it works. What could be the cause? Is the URL library different? final String ftpRoot = "user:password@myftp/path"; ftp.downloadFile(destPath+"/list","ftp://"+ftpRoot+"/")); //URL + "/" returns FTP directory listing public synchronized boolean downloadFile (String localfilename,String ftpPath){ try{ URL url = new URL(ftpPath); m_client = url.openConnection(); m_client.connect(); //here connection fails at Android but works in command line ...
has comment: http://stackoverflow.com/comment/38765851

http://stackoverflow.com/comment/38927272
has text: Actually I use try-catch here, but I want to know is there a stander workflow to close the socket connection? I mean both client and server side have to invoke 'socket.close()' right? if client closed socket immediately after sent data, will it cause some exception like 'socket is close' while server tries to read data from stream?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25030128
score: 0

http://stackoverflow.com/comment/38741123
type: Comment
comment on: http://stackoverflow.com/a/24918951
type: AnswerComment
score: 0
has text: @Filippo So, is your point to have four columns in `Requirement` or three? My code above assumes that you want to have three columns (each belonging to requirement PK) and it works so under Hibernate 4.3.5 and JPA 2.1.

http://stackoverflow.com/comment/38929255
type: Comment
type: QuestionComment
has text: where are you calling this setImage() method?
comment on: http://stackoverflow.com/q/25031159
score: 0

http://stackoverflow.com/a/25003672
answers question: http://stackoverflow.com/q/25002819
downvote count: 0
score: 3
type: Answer
upvote count: 3
has body: I'd suggest doing a packet capture (e.g., Wireshark or tcpdump) while sending your request. In Wireshark you can filter on "SSL" and the source and destination IP addresses (SSL &amp;&amp; ip.src==X.X.X.X &amp;&amp; ip.dst==X.X.X.X) to isolate the traffic of interest, and then look for the following sequence of SSL Handshake messages in the "Info" column (or something similar): Client -> Server: Client Hello Server -> Client: Server Hello, Certificate, Certificate Request, Server Hello Done Client -> Server: Certificate, Certificate Verify, Client Key Exchange The key things to look for are the Certificate Request (make sure the server is asking for the certificate, and check the list of trusted CAs), and then the Client -> Server Certificate message, which includes the client's certificate. Other things you can check in the packet capture: * The list of supported cipher suites by the client. If the server does not accept any of them the connection will fail. * The TLS version. The client and server must support a common version for communication to take place. It appears you restricted to TLS v1.0, so check that this is supported on the other end. * Other "Alert" messages, which indicate a fatal error or a warning.

http://stackoverflow.com/q/25046317
tagged with: jmx
score: 6
has comment: http://stackoverflow.com/comment/38958228
possible better answer: http://stackoverflow.com/a/25281006
has comment: http://stackoverflow.com/comment/39397350
type: Question
has answer: http://stackoverflow.com/a/25281006
has comment: http://stackoverflow.com/comment/38958101
has comment: http://stackoverflow.com/comment/38957969
has answer: http://stackoverflow.com/a/25305169
tagged with: jconsole
tagged with: java
tagged with: jboss
answer count: 6
has answer: http://stackoverflow.com/a/25047001
has answer: http://stackoverflow.com/a/33292475
upvote count: 7
has comment: http://stackoverflow.com/comment/38958255
downvote count: 1
has title: JConsole remote connection to JBoss EAP
has answer: http://stackoverflow.com/a/37752221
has body: I am trying to connect to a remote jboss instance running on a server. I am using the following connection URL service:jmx:remoting-jmx://90.214.64.170:9999 When i do this i get the following 2 errors in the console window After selecting insecure i am presented with this I have, prior to connecting via jconsole also gone to the bin directory of my jboss server and run ./jconsole.sh which outputs the following to the command line CLASSPATH /usr/bin/java/jdk1.8.0_11/lib/jconsole.jar:/usr/bin/java/jdk1.8.0_11/lib/tools.jar:/var/opt/jboss/modules/system/layers/base/org/jboss/remoting-jmx/main/remoting-jmx-1.1.2.Final-redhat-1.jar:/var/opt/jboss/modules/system/layers/base/org/jboss/remoting3/main/jboss-remoting-3.2.18.GA-redhat-1.jar:/var/opt/jboss/modules/system/layers/base/org/jboss/logging/main/jboss-logging-3.1.2.GA-redhat-1.jar:/var/opt/jboss/modules/system/layers/base/org/jboss/xnio/main/xnio-api-3.0.7.GA-redhat-1.jar:/var/opt/jboss/modules/system/layers/base/org/jboss/xnio/nio/main/xnio-nio-3.0.7.GA-redhat-1.jar:/var/opt/jboss/modules/system/layers/base/org/jboss/sasl/main/jboss-sasl-1.0.3.Final-redhat-1.jar:/var/opt/jboss/modules/system/layers/base/org/jboss/marshalling/main/jboss-marshalling-1.4.2.Final-redhat-1.jar:/var/opt/jboss/modules/system/layers/base/org/jboss/marshalling/river/main/jboss-marshalling-river-1.4.2.Final-redhat-1.jar:/var/opt/jboss/modules/system/layers/base/org/jboss/as/cli/main/jboss-as-cli-7.3.0.Final-redhat-14.jar:/var/opt/jboss/modules/system/layers/base/org/jboss/staxmapper/main/staxmapper-1.1.0.Final-redhat-2.jar:/var/opt/jboss/modules/system/layers/base/org/jboss/as/protocol/main/jboss-as-protocol-7.3.0.Final-redhat-14.jar:/var/opt/jboss/modules/system/layers/base/org/jboss/dmr/main/jboss-dmr-1.2.0.Final-redhat-1.jar:/var/opt/jboss/modules/system/layers/base/org/jboss/as/controller-client/main/jboss-as-controller-client-7.3.0.Final-redhat-14.jar:/var/opt/jboss/modules/system/layers/base/org/jboss/threads/main/jboss-threads-2.1.1.Fin…
has comment: http://stackoverflow.com/comment/38958770
favorite count: 0
has comment: http://stackoverflow.com/comment/39393690
has comment: http://stackoverflow.com/comment/38958034
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/35872450
accepted answer: http://stackoverflow.com/a/25305169

http://stackoverflow.com/comment/38947527
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/25040921
has text: That's why they are NOT equals... I don't want it to be null char AND I don't want it to be a non-existant char

http://stackoverflow.com/comment/38987926
type: Comment
type: QuestionComment
has text: You also need to make a C/C++ compiler AND a linker "each and every time".
comment on: http://stackoverflow.com/q/25061449
score: 0

http://stackoverflow.com/comment/38712448
comment on: http://stackoverflow.com/a/24915819
type: Comment
has text: @Braj I don't really need all the other params, I just need the first one, so is it safe to just find the first "&" and cut the string from there? Or do I need to worry about "&" as an encoded character?
score: 0
type: AnswerComment

http://stackoverflow.com/comment/38962203
type: QuestionComment
comment on: http://stackoverflow.com/q/25039380
has text: http://www.imagebam.com/image/946284342096239
score: 0
type: Comment

http://stackoverflow.com/q/25035515
has body: On reading file, how to clear file archive bit using java for an android application. I have found an e.g for Windows but I am not sure how I could use that for android File theFile = new File("c:/foobar.txt"); Path file = theFile.toPath(); Files.setAttribute(file, "dos:archive", false);
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/38937256
has comment: http://stackoverflow.com/comment/38936855
tagged with: cordova
answer count: 0
has title: Clearing Archive bit for android
tagged with: java
type: Question
score: 0
tagged with: filesystems
has comment: http://stackoverflow.com/comment/38937117
has comment: http://stackoverflow.com/comment/38936724

http://stackoverflow.com/comment/38852478
score: 1
comment on: http://stackoverflow.com/q/24989871
has text: @BackSlash thanks, i have understand about SELECT FOR UPDATE, but not for UPDATE part in my case.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38732292
type: QuestionComment
comment on: http://stackoverflow.com/q/24926529
has text: where is `MapFragment`? You are not displaying Map.
score: 0
type: Comment

instantiation
type: Tag
tags question: http://stackoverflow.com/q/24971708
tag name: instantiation

http://stackoverflow.com/q/24953978
tagged with: java-8
tagged with: executorservice
type: AnsweredQuestion
has title: Does an ExecutorService get garbage collected when out of scope?
accepted answer: http://stackoverflow.com/a/24954385
has comment: http://stackoverflow.com/comment/38789193
tagged with: java
has comment: http://stackoverflow.com/comment/38784306
possible better answer: http://stackoverflow.com/a/24955027
type: Question
has answer: http://stackoverflow.com/a/24955027
has comment: http://stackoverflow.com/comment/38809084
has comment: http://stackoverflow.com/comment/38784309
has body: I'm asking this question because I am creating a lot of executor services and while I may already have a memory leak somewhere that needs to be investigated, I think a recent change to the following code actually worsened it, hence I am trying to confirm what is going on: @FunctionalInterface public interface BaseConsumer extends Consumer&lt;Path&gt; { @Override default void accept(final Path path) { String name = path.getFileName().toString(); ExecutorService service = Executors.newSingleThreadExecutor(runnable -&gt; { Thread thread = new Thread(runnable, "documentId=" + name); thread.setDaemon(true); return thread; }); Future&lt;?&gt; future = service.submit(() -&gt; { baseAccept(path); return null; }); try { future.get(); } catch (InterruptedException ex) { Thread.currentThread().interrupt(); } catch (ExecutionException ex) { throw new RuntimeException(ex); } } void baseAccept(final Path path) throws Exception; } Then this Consumer&lt;Path&gt; gets called on another thread pool with (usually) N=2 threads, I am not sure if that is relevant. The question is: Does the ExecutorService service go out of scope and get garbage collected once BaseConsumer#accept has finished?
has comment: http://stackoverflow.com/comment/38784324
answer count: 2
has answer: http://stackoverflow.com/a/24954385
downvote count: 0
has comment: http://stackoverflow.com/comment/38784404
favorite count: 0
score: 28
has comment: http://stackoverflow.com/comment/38784129
upvote count: 28
tagged with: multithreading
has comment: http://stackoverflow.com/comment/38784186
tagged with: garbage-collection

http://stackoverflow.com/comment/38727068
score: 0
has text: Jar files are just Zip files with some extra properties...
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24923561

http://stackoverflow.com/a/24969846
has body: Why not download the markers from you browser and store it in your drawable or asset folder? That way you don't need to load it from the internet. I'm sure those markers are just small i size maybe could take up 50-100kb ea, or even lesser.
score: 0
answers question: http://stackoverflow.com/q/24969788
type: Answer
has comment: http://stackoverflow.com/comment/38813437

http://stackoverflow.com/comment/38838687
comment on: http://stackoverflow.com/q/24983060
type: Comment
type: QuestionComment
has text: I would recommend using a debugger to step through the method and ensure that all your fields are in a valid state.
score: 0

http://stackoverflow.com/comment/38929990
score: 1
type: AnswerComment
has text: The conversion is done before the multiplication and in c code after. There is a difference.
comment on: http://stackoverflow.com/a/25031634
type: Comment

http://stackoverflow.com/comment/38745092
score: 0
type: Comment
type: QuestionComment
has text: Does `OwnExceptionAboutTechnicalError` extends `Exception`?
comment on: http://stackoverflow.com/q/24933493

http://stackoverflow.com/comment/38949118
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25041944
has text: Don't remove within a loop. Use `iterator` instead.

http://stackoverflow.com/q/25011224
has title: Gradle not generating SERVICE_COMPONENT when using DS Annotations
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
has body: I'm using Declarative Services annotations in my project along with gradle. I have specified the respective annotations (@Component etc) in my Component classes. I have also added the dependency for the felix scr annotations projects in the gradle file. But, when I build my project the component xml file is not getting generated and neither is the Service-Component header in the Manifest.MF file. I'm using the 'osgi' plugin in gradle for generating the OSGI bundle. Does gradle provides this support? It is possible in maven by the use of the maven-scr plugin. Do we have any such plugin in gradle? Any help would be appreciated.
tagged with: gradle
accepted answer: http://stackoverflow.com/a/25016611
type: Question
tagged with: declarative-services
has comment: http://stackoverflow.com/comment/38899384
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/25016611
tagged with: apache-felix
tagged with: osgi

http://stackoverflow.com/a/25060711
type: Answer
score: 2
answers question: http://stackoverflow.com/q/25060651
has body: The keyword super exists to give child classes access to their parent classes and their exposed public members. That being said: super(in): Calls the superclass's constructor, passing in the stream as an argument super.read(): Calls the superclass's read method
downvote count: 0
upvote count: 2

http://stackoverflow.com/a/25071329
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/25068625
upvote count: 1
type: Answer
has body: Might as well use a Semaphore or, in this case, a CountDownLatch. Looking at the source code for Semaphore, wait and notify barely scratch the surface. Using a CountDownLatch makes code easier to read: import java.util.concurrent.CountDownLatch; public class WaitOnCount { public static void main(String[] args) { CountDownLatch latch = new CountDownLatch(1); ThreadB b = new ThreadB(latch); b.start(); try { latch.await(); System.out.println("Total is: " + b.total); } catch (InterruptedException e) { e.printStackTrace(); } } static class ThreadB extends Thread { final CountDownLatch latch; int total; ThreadB(CountDownLatch latch) { super(); this.latch = latch; } @Override public void run() { for(int i = 0; i &lt; 100; i++) { total += i; } latch.countDown(); } } }

http://stackoverflow.com/comment/38847094
score: 0
comment on: http://stackoverflow.com/q/24987535
type: Comment
type: QuestionComment
has text: (You can Google UTF8, you know.)

http://stackoverflow.com/q/25001533
type: Question
has title: Set html cell contents to bold in Flex Table
accepted answer: http://stackoverflow.com/a/25001631
has comment: http://stackoverflow.com/comment/38873034
score: 0
answer count: 1
has body: I want to Set html cell contents to bold in Flex Table. FlexTable myTable = new FlexTable(); myTable.setHTML(1, 0, "Name :"); I want to make the "Name" content as Bold like 'Name' instead of 'Name' . For now it is just displaying as Regular Text. Can someone help me on this.
tagged with: gwt
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/25001631

http://stackoverflow.com/a/28763698
upvote count: 1
type: Answer
has body: All what you need is to set your query like that %27stackoverflow bing api%27 Here is my source code: ODataConsumer consumer = ODataConsumers .newBuilder("https://api.datamarket.azure.com/Bing/Search/v1/") .setClientBehaviors( OClientBehaviors.basicAuth("accountKey", "{My Account ID}")) .build(); System.out.println(consumer.getServiceRootUri() + consumer.toString()); OQueryRequest&lt;OEntity&gt; oQueryRequest = consumer.getEntities("Web") .custom("Query", "%27stackoverflow%27"); System.out.println("oRequest : " + oQueryRequest); Enumerable&lt;OEntity&gt; entities = oQueryRequest.execute(); System.out.println(entities.elementAt(0));
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/25031879

http://stackoverflow.com/a/24937147
upvote count: 1
has comment: http://stackoverflow.com/comment/38753531
has comment: http://stackoverflow.com/comment/38753899
has comment: http://stackoverflow.com/comment/38752579
has body: Try this, I can not grant that it is correct, but I've used in my projects. //do logout public static void logout() { Session session = Session.getActiveSession(); if (session != null &amp;&amp; !session.isClosed()) { session.closeAndClearTokenInformation(); } } //check whether login/out. public static boolean isLoggedIn() { Session session = Session.getActiveSession(); return (session != null &amp;&amp; session.getAccessToken() != null &amp;&amp; session.getAccessToken().length() &gt; 1); } //In your create you might do this ...... Session session = Session.getActiveSession(); if (session == null) { if (_savedInstanceState != null) { session = Session.restoreSession(this, null, _statusCallback, _savedInstanceState); } if (session == null) { session = new Session(this); } Session.setActiveSession(session); if (session.getState().equals(SessionState.CREATED_TOKEN_LOADED)) { session.openForRead(new Session.OpenRequest(_fragment) .setCallback(_statusCallback)); } } .....
answers question: http://stackoverflow.com/q/24936986
has comment: http://stackoverflow.com/comment/38754921
type: Answer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/38753269
has comment: http://stackoverflow.com/comment/38752866

http://stackoverflow.com/comment/38768086
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24942710
has text: Thank you for this idea - it really began to work then i extracted Thread.sleep() from synchronized block. But, it steel works partly. Here is a problem. I need to print message from thread t1 EACH 5 sec, but it is printed only one time. As far as i understand the problem is that after thread t1 got lock on Chronometr, it stops checking condition in the while() and t1 is never active again.
type: AnswerComment

http://stackoverflow.com/q/25037568
type: Question
has comment: http://stackoverflow.com/comment/38953324
tagged with: spring-boot
has comment: http://stackoverflow.com/comment/38944219
tagged with: java
has comment: http://stackoverflow.com/comment/38953453
has comment: http://stackoverflow.com/comment/38944989
has title: Deploying Java Spring Rest Service To Tomcat 6.0.20
linked to: http://stackoverflow.com/q/22974475
tagged with: web.xml
has body: I'm fairly new with Spring Framework and struggling to get this simple example to work on a Tomcat 6 instance. The example is here http://spring.io/guides/gs/rest-service/ . It works fine when i run it within Eclipse but when i convert it to a WAR file and deploy, the directory in Tomcat is created but the service/tomcat responds with a 404. I suspect i need to create a web.xml file (not sure the annotated way will work with tomcat 6 because it supports only servlet 2.5) but not sure where to start. Any help would be much appreciated.
type: UnansweredQuestion
tagged with: spring
tagged with: deployment
answer count: 0
score: 0

http://stackoverflow.com/a/25063223
upvote count: 2
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25062451
has body: In Java, a byte is 8 bits, while an int is 32 bits. To convert each of your ints to a single byte without loss of data, you need to ensure all your numbers are in the range -128 to 127 inclusive. If they are in this range, then you should just store them as bytes in the first place (if this is not possible, there are ways to do the conversion already discussed). If they are not in this range, then you shouldn't be converting them to bytes at all because it will force your numbers into the range, and thus you will lose a lot of data. Alternatively, you could use short, as that would be 16 bits (giving you the range -32,768 to 32,767 inclusive). But if you can't ensure that your numbers will be within these ranges, then you will need to use int. Note: You can store each int as 4 bytes or as 2 shorts, but each number would still be 32 bits, so you're not gaining any space efficiency by doing so. You can read more about Java's primitive types here.
answers question: http://stackoverflow.com/q/25062451
type: Answer
downvote count: 0
score: 2

http://stackoverflow.com/a/25009296
score: 6
type: Answer
has comment: http://stackoverflow.com/comment/38887973
upvote count: 6
has body: For multiple jars you can do java -cp "path1/servlet.jar;path2/mysql.jar" yourPackage.Class Or put all jars in one folder (let it be path1/lib) and do something like following java -cp "path1/lib/*" yourPackage.Class Note : classpath wildcards can be used only in Java 6 or later.
answers question: http://stackoverflow.com/q/25009257
accepted answer of: http://stackoverflow.com/q/25009257
has comment: http://stackoverflow.com/comment/38888275
has comment: http://stackoverflow.com/comment/38888535
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38888244
downvote count: 0
has comment: http://stackoverflow.com/comment/38888457

http://stackoverflow.com/comment/38962452
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25048385
score: 0
has text: @voo Do you need your first task to run on your first thread, and nothing else, or do you also need task number 2 to execute on a specific one, and so on ?

http://stackoverflow.com/q/25007778
answer count: 2
has answer: http://stackoverflow.com/a/25086447
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/25086447
tagged with: akka
tagged with: akka-cluster
upvote count: 2
has body: I am writing an Akka application and I want to use the Akka Cluster feature that Typsafe provides. I am trying to understand the main difference between Akka Cluster, Akka Cluster Singleton and Akka Cluster Sharding. To me, they seem to be providing similar things. In my scenario I want to have a cluster that will have: Stateless actors that could live in any machine (I will have a pool of them) Stateless actors that I want them to live in specific machines Stateful actors that could live in any machine but I need just one instance of them across the whole cluster and being able to restart the actor with its previous state if it dies. Based on what I have read I would need Akka Cluster for the first kind, Akka Cluster Singleton for the second kind and Akka Cluster Sharding for the third kind. Is my assumption correct? I am looking for some guidance as well as any example online if you know any.
possible better answer: http://stackoverflow.com/a/25008932
has answer: http://stackoverflow.com/a/25008932
score: 2
type: AnsweredQuestion
has title: Akka Cluster, Cluster Sharding and Cluster singleton use cases
tagged with: java
type: Question
tagged with: akka-persistence

http://stackoverflow.com/a/25024026
has comment: http://stackoverflow.com/comment/38916276
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/25023788
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/38916588
accepted answer of: http://stackoverflow.com/q/25023788
type: Answer
has body: If you have a String message = ...; this is converted to a byte[] byte[] bytes = message.getBytes(); then the DatagramPacket must be constructed using new DatagramPacket(bytes, bytes.length(), ... ); Your call uses new DatagramPacket( message.getBytes, message.length(),.., but this uses the String length but Farsi requires more than one byte per character. The string آرمین has 5 characters, but the UTF-8 encoding requires 10 bytes. You need to send 10 bytes.

http://stackoverflow.com/comment/38851026
type: Comment
comment on: http://stackoverflow.com/q/24989653
type: QuestionComment
has text: Did the build always fail in Jenkins, or only sometimes? Can you paste the error + error message?
score: 3

http://stackoverflow.com/q/24909683
downvote count: 0
tagged with: smartsheet-api
score: 1
tagged with: java
has body: I would like to make a call from one of the Smartsheet Column Cell to a Java code running on web server (could be Servlet or a Portlet). The Java code will retrieve other relevant data from a data source (database) and updates the resultset information retrieved from data source into other column cells in the Smartsheet. One immediate solution I could think of: - Create a hyperlink pointing to Java code and add it to one of the desired Cell. - If the user click on the hyperlink in column cell then trigger the call to Java code and update the rest of columns (for that particular row). I would like to know if there are other alternatives/ideas of doing it ?
type: Question
has answer: http://stackoverflow.com/a/24918828
upvote count: 1
answer count: 1
has title: Make calls to Java code from a Smartsheet Cell and update other column cells
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/q/24915391
type: AnsweredQuestion
downvote count: 0
score: 1
has body: So this was pretty confusing for me.I decided to redirect application console, into TextArea in my UI. Bud when i did that with Fixed TextArea(Fixed ID) in SceneBuilder and then annotated @FXML private TextArea consoleTextArea; Nothing happen.No change to content.And yes i did initialized it in constructor.And further in initialize. This is not working code: public class ConsoleController implements Initializable { Thread t; @FXML private Label totalM; @FXML private Label freeM; @FXML private Label maxM; @FXML private TextArea consoleTextArea; private Console console; private PrintStream ps; public ConsoleController() { System.out.println("Called constructor"); totalM = new Label(); freeM = new Label(); maxM = new Label(); consoleTextArea = new TextArea(); console = new Console(consoleTextArea); ps = new PrintStream(console, true); } @Override public void initialize(URL location, ResourceBundle resources) { redirectOutput(ps); t = new Thread(() -&gt; { while (true) { try { Platform.runLater(() -&gt; { updateMemInfo(); }); Thread.sleep(1000); } catch (InterruptedException ex) { ex.printStackTrace(); } } }); t.setPriority(Thread.MIN_PRIORITY); t.setName("MemUpdateInfoThread"); t.setDaemon(true); t.start(); } private void updateMemInfo() { totalM.setText("Total Memory (in bytes): " + Runtime.getRuntime().totalMemory()); freeM.setText("Free Memory (in bytes): " + Runtime.getRuntime().freeMemory()); maxM.setText("Max Memory (in bytes): " + Runtime.getRuntime().maxMemory()); } private void redirectOutput(PrintStream prs) { System.setOut(prs); System.setErr(prs); } private void updateConsole(String text) { for (int c : text.toCharArray()) { try { console.write(c); } catch (IOException ex) { ex.printStackTrace(); } } } private class Console extends OutputStream { private TextArea txtArea; public Console(TextArea txtArea) { this.txtArea = txtArea; } @Override public void write(int b) throws IOException { txtArea.appendText(String.valueOf((char) b)); } } } Bud after some eddi…
favorite count: 0
type: Question
accepted answer: http://stackoverflow.com/a/24915703
upvote count: 1
tagged with: fxml
tagged with: java
tagged with: scenebuilder
tagged with: javafx
tagged with: stream
answer count: 1
has answer: http://stackoverflow.com/a/24915703
has title: JavaFX Redirected System.out stream TextArea,only working when not used as FXML Component with fixedID.Why?

http://stackoverflow.com/q/24975882
tagged with: styles
has title: Alternative styling for get and set methods
type: Question
has answer: http://stackoverflow.com/a/24976130
has answer: http://stackoverflow.com/a/68144996
has body: We are all familiar with Java's "getter &amp; setter" methods. They are a great way to create data encapsulation; ensuring that any private fields outside of a classes code can only be accessed through these specific methods. These methods may then include checks, overhead, synchronization etc. public class Person(){ private String name; private int birthYear; // traditional getter/setter syntax public String getName(){ return name; } public int getBirthYear(){ return birthYear; } public void setName(String name){ this.name = name; } public void setBirthYear(int birthYear){ this.birthYear = birthYear; } // proposed overloading getter/setter syntax public String name(){ return name; } public int birthYear(){ return birthYear; } public void name(String name){ this.name = name; } public void birthYear(int birthYear){ this.birthYear = birthYear; } } My question is if there is anything wrong with using method overloading to have the "proposed" syntax above for getter/setters? To me it seems more readable and intuitive: Person p = new Person(); p.name("Bob"); System.out.println(p.name()); The big disadvantage I can think of is that everybody is so used to the get/set syntax that it'll make things less readable. Anyway, it's not a major issue, I don't mind using getters/setters but I've just thought of this alternative way that looks prettier to me and wanted to know what other people think? Thanks
score: 0
answer count: 3
type: UnansweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/24975922

http://stackoverflow.com/comment/38909647
comment on: http://stackoverflow.com/a/25020555
has text: No worries - enjoy docker!
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/38956563
has text: I tried and it would not let because my ranking was not high enough until 8 hours after I posted.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25024446

http://stackoverflow.com/comment/38738518
has text: share the import code. basically i believe you are not simply creating new nodes, but doing some unoptimized logic before creation - like matching relations to other nodes - thus the more nodes you have already created, the more time it takes for a new node to create, since it must first calculate the logic on all previous nodes
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/24917327
type: Comment

http://stackoverflow.com/q/24952043
downvote count: 1
has title: Is it possible to send broadcast socket in jsp?
has comment: http://stackoverflow.com/comment/38782271
type: Question
linked to: http://stackoverflow.com/q/6579350
tagged with: java
possible better answer: http://stackoverflow.com/a/24952879
has comment: http://stackoverflow.com/comment/38781309
answer count: 2
has body: I find the jsp code for send socket, and change the IP to 255.255.255.255, but the result is it says: 'Network is unreachable'. The code is: &lt;%@ page contentType="text/html; charset=utf-8" language="java" import="java.util.*,java.net.*,java.io.*,java.lang.*" errorPage="" %&gt; var errors=""; &lt;% try{ int character; Socket socket = new Socket("255.255.255.255", 10000); InputStream inSocket = socket.getInputStream(); OutputStream outSocket = socket.getOutputStream(); String str = "Message"; byte buffer[] = str.getBytes(); outSocket.write(buffer); while ((character = inSocket.read()) != -1) { out.print((char) character); } socket.close(); } catch(java.lang.Exception e){ %&gt; errors="Something is wrong!"+ "&lt;%= e.getMessage() %&gt;"; &lt;% } My tomcat is version 6( I guess...), Or if it's impossible( I heard people say jsp is different from java, it only use for presentation), can I write a java class( using DatagramSocket) to show the receiving data and let my jsp import the class and get the data? Any advice will be appreciated.
tagged with: jsp
has answer: http://stackoverflow.com/a/24953399
favorite count: 0
accepted answer: http://stackoverflow.com/a/24953399
tagged with: broadcast
score: 0
has comment: http://stackoverflow.com/comment/38780490
tagged with: sockets
has answer: http://stackoverflow.com/a/24952879
has comment: http://stackoverflow.com/comment/38780558
linked to: http://stackoverflow.com/q/19771485
type: AnsweredQuestion
upvote count: 1

http://stackoverflow.com/q/24916255
accepted answer: http://stackoverflow.com/a/24916669
score: -1
tagged with: boolean
upvote count: 0
has body: I want this program to check if a word is in the dictionary how would I do this in a format close to this? What should I add to this to make it work? Here is my code: String file = ("/Users/Brandon/Desktop/code/Good.txt"); Dictionary dict = new Hashtable(); boolean checkWord(String s){ if(StringIsInDictionary) return true; return false }
answer count: 1
has comment: http://stackoverflow.com/comment/38712990
has comment: http://stackoverflow.com/comment/38712997
favorite count: 0
has comment: http://stackoverflow.com/comment/38713126
has comment: http://stackoverflow.com/comment/38713074
has comment: http://stackoverflow.com/comment/38713113
tagged with: dictionary
has answer: http://stackoverflow.com/a/24916669
has title: Java make program check if a word is in the dictionary
type: AnsweredQuestion
tagged with: file
has comment: http://stackoverflow.com/comment/38713620
downvote count: 1
type: Question
tagged with: java

http://stackoverflow.com/q/24912877
tagged with: android
upvote count: 1
has body: This is the DBAdapter I'm using, and for some reason when I try to insert a row- the application crashes. public class DBAdapter { private static final String TAG = "DBAdapter"; //used for logging database version changes // Field Names: static final String KEY_ROWID = "Row ID"; static final String NAME_COLUMN = "Name"; static final String EMAIL_COLUMN = "E-mail"; static final String PHONENUMBER_COLUMN = "Phone Number"; static final String ADDRESS_COLUMN = "Street Address"; static final String ZIP_COLUMN = "Zip Code"; static final String ARRIVAL_COLUMN = "Arrival Date"; static final String DEPARTURE_COLUMN = "Departure Date"; static final String ROOM_COLUMN = "Room Number"; static final String NOTES_COLUMN = "Notes Area"; public static final String[] ALL_KEYS = new String[] {NAME_COLUMN, EMAIL_COLUMN, PHONENUMBER_COLUMN, ADDRESS_COLUMN, ZIP_COLUMN, ARRIVAL_COLUMN, DEPARTURE_COLUMN, ROOM_COLUMN, NOTES_COLUMN}; // Column Numbers for each Field Name: public static final int COL_ROWID = 0; public static final int COL_NAME = 1; public static final int COL_EMAIL = 2; public static final int COL_PHONENUMBER = 3; public static final int COL_ADDRESS = 4; public static final int COL_ZIP = 5; public static final int COL_ARRIVAL = 6; public static final int COL_DEPARTURE = 7; public static final int COL_ROOM = 8; public static final int COL_NOTES = 9; // DataBase info: static final String DATABASE_NAME = "Reservations.db"; static final String DATABASE_TABLE = "Reservations"; public static final int DATABASE_VERSION = 2; // The version number must be incremented each time a change to DB structure occurs. //SQL statement to create database private static final String DATABASE_CREATE_SQL = "CREATE TABLE " + DATABASE_TABLE + " (" + KEY_ROWID + " INTEGER PRIMARY KEY AUTOINCREMENT, " + NAME_COLUMN + " TEXT NOT NULL, " + EMAIL_COLUMN + " TEXT" + PHONENUMBER_COLUMN + " TEXT NOT NULL, " + ADDRESS_COLUMN + " TEXT" + ZIP_COLUMN + " TEXT NOT NULL, " + ARRIVAL_COLUMN + " TEXT NOT NULL, " + …
downvote count: 1
type: AnsweredQuestion
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/38706450
has comment: http://stackoverflow.com/comment/38706299
score: 0
tagged with: sqlite
has answer: http://stackoverflow.com/a/24912958
accepted answer: http://stackoverflow.com/a/24912958
answer count: 1
has title: Android application crashing when inserting row to SQlite?
favorite count: 0

http://stackoverflow.com/comment/38922023
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25022363
has text: Thanks @Jay I'll take notice of your recommendations
type: AnswerComment

http://stackoverflow.com/comment/39023094
type: Comment
comment on: http://stackoverflow.com/a/25066727
score: 0
type: AnswerComment
has text: I have used a static function with user defined function. This works however H2 seems to call the function 3 times altough I call it only once in the template.

http://stackoverflow.com/a/25052807
answers question: http://stackoverflow.com/q/25052414
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25052414
has comment: http://stackoverflow.com/comment/38970008
has comment: http://stackoverflow.com/comment/39010741
type: Answer
has comment: http://stackoverflow.com/comment/38971173
has body: Inside xml just keep an ImageView and inside init function of your custom view inflate this xml and return it. in getView create a new instance of custom view and return it. XML: <?xml version="1.0" encoding="utf-8"?> <ImageView android:layout_width="match_parent" android:layout_height="wrap_content" android:background="#333333" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Custom view Test" /> Custom view: public class ImageTapView extends LinearLayout{ public ImageTapView(Context context, AttributeSet attrs){ super(context, attrs); init(context); } public ImageTapView(Context context){ super(context); init(context); } private void init(Context context){ LayoutInflater inflater = (LayoutInflater) context .getSystemService(Context.LAYOUT_INFLATER_SERVICE); inflater.inflate(R.layout.your_xml, this, true); } public void onClick(){ } } getView: @Override public View getView(int position, View convertView, ViewGroup parent) { ImageTapView view = (ImageTapView ) convertView; if (view == null) view = new ImageTapView (getContext()); return view; }
upvote count: 1
score: 1

http://stackoverflow.com/a/24982826
has body: Your join code looks correct. I suspect your code is experiencing a race hazard: Wiki page on Race Condition When you have multiple threads running concurrently, all modifying a shared resource, you need to ensure that they have exclusive access while the modification is being performed. As a quick fix to confirm that this is a data race, try adding the synchronized modifier to your add() method in your MyInteger class. What's ultimately happening is (for a two-Thread example): (Assume MyInteger instance has an initial value of 17.) Thread 1 calls add(3) JVM (Thread 1) reads/sees that MyInteger has value of 17, and maintains this separately during the add operation Thread 2 calls add(5) JVM (Thread 2) reads/sees that MyInteger has value of 17, and maintains this separately during the add operation JVM (Thread 1 and Thread 2) increment their respective values, so Thread 1 has 20, and Thread 2 has 22. JVM (Thread 1) writes 20 back to the primitive inside MyInteger JVM (Thread 2) writes 22 back to the primitive inside MyInteger You have now lost the result of the add(3) operation, as properly atomic operations would have resulted in 25 as a final value. The most important thing to take away from this, aside from the importance of thread safety, is that even a simple addition operation involving primitives is not performed as a single, atomic operation. Rather, it is broken down into smaller steps inside the JVM, which allows for concurrent threads to race against each other. Here is a screenshot of the (excellent) table in the wiki article that demonstrates this visually:
score: 4
upvote count: 4
has comment: http://stackoverflow.com/comment/38840076
has comment: http://stackoverflow.com/comment/38841947
has comment: http://stackoverflow.com/comment/38838323
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/38838443
has comment: http://stackoverflow.com/comment/38841904
answers question: http://stackoverflow.com/q/24982697

wifi
tag name: wifi
type: Tag
tags question: http://stackoverflow.com/q/24966670
tags question: http://stackoverflow.com/q/25059381

http://stackoverflow.com/q/24918988
has answer: http://stackoverflow.com/a/24921025
accepted answer: http://stackoverflow.com/a/24921025
has title: Best way to draw collectibles in a game?
answer count: 2
upvote count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/24919112
favorite count: 0
type: AnsweredQuestion
score: 1
tagged with: java
possible better answer: http://stackoverflow.com/a/24919112
has body: I want my game to draw coins from a sprite and then my main character would be able to pick them up. I'm trying to use array list for this but i have no idea how to implement this feature. Do I make an array list of Sprites I need to draw and then reuse it ? If so , how ? Or do I use some other function ? I'm a begginer , so sorry if this question seems odd .
type: Question
tagged with: libgdx

http://stackoverflow.com/q/24943894
has answer: http://stackoverflow.com/a/24946154
downvote count: 1
has body: How do I to write an entire table to a flat file (text file) using jdbc? So far I've attempted the following: Statement statement = connection.createStatement(); ResultSet result = statement.executeQuery("SELECT * FROM tablename"); BufferedInputStream buffer; FileOutputStream out = new FileOutputStream("flatfile.txt"); while(result.next() ) { buffer = new BufferedInputStream(result.getBinaryStream("????") ); byte[] buf = new byte[4 * 1024]; //4K buffer int len; while( (len = buffer.read(buf, 0, buf.length) ) != -1 ) { out.write(buf, 0, len ); } } out.close(); "????" is just my placeholder. I am stuck on what to pass in as an argument.
upvote count: 33
has answer: http://stackoverflow.com/a/79221845
has answer: http://stackoverflow.com/a/31887249
tagged with: java
has title: How do you get values from all columns using ResultSet.getBinaryStream() in jdbc?
tagged with: db2
accepted answer: http://stackoverflow.com/a/24946881
score: 32
has comment: http://stackoverflow.com/comment/38765797
possible better answer: http://stackoverflow.com/a/31887249
answer count: 4
type: AnsweredQuestion
tagged with: sql
has comment: http://stackoverflow.com/comment/38765506
has comment: http://stackoverflow.com/comment/38765622
has comment: http://stackoverflow.com/comment/38765424
favorite count: 0
has comment: http://stackoverflow.com/comment/38765731
tagged with: resultset
type: Question
tagged with: jdbc
has answer: http://stackoverflow.com/a/24946881
has comment: http://stackoverflow.com/comment/38768333

http://stackoverflow.com/comment/38952651
comment on: http://stackoverflow.com/a/25043383
score: 0
type: AnswerComment
type: Comment
has text: the reason i want to just print 2, 3 is because 1 and -1 cancel each other out so there is no need to print them

http://stackoverflow.com/comment/38955542
score: 0
type: Comment
has text: I already have the domain class. Do the fields need to be named the same as they are in the JSP form? Does the constructor need to do anything, or will setters work? How should the controller change to access the JSON?
comment on: http://stackoverflow.com/a/25045030
type: AnswerComment

http://stackoverflow.com/comment/38818464
score: 0
has text: Thank you, I get used to use array[] from other languages.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24972303

http://stackoverflow.com/q/24951257
tagged with: java-7
favorite count: 0
has body: Java 7 changed the sorting algorithm such that it throws an java.lang.IllegalArgumentException: "Comparison method violates its general contract!" in some cases when the used comparator is buggy. Is it possible to tell what kind of bug in the comparator causes this? In my experiments it did not matter if x != x , it also did not matter if x &lt; y and y &lt; z but z &lt; x , but it did matter if x = y and y = z but x &lt; z for some values x, y, z. Is this generally so? (If there were a general rule to this, it might be easier to look for the bug in the comparator. But of course it is better to fix all bugs. :-) ) In particular, the following two comparators did not make TimSort complain: final Random rnd = new Random(52); Comparator&lt;Integer&gt; brokenButNoProblem1 = new Comparator&lt;Integer&gt;() { @Override public int compare(Integer o1, Integer o2) { if (o1 &lt; o2) { return Compare.LESSER; } else if (o1 &gt; o2) { return Compare.GREATER; } return rnd.nextBoolean() ? Compare.LESSER : Compare.GREATER; } }; Comparator&lt;Integer&gt; brokenButNoProblem2 = new Comparator&lt;Integer&gt;() { @Override public int compare(Integer o1, Integer o2) { if (o1 == o2) { return Compare.EQUAL; } return rnd.nextBoolean() ? Compare.LESSER : Compare.GREATER; } }; but the following comparator did make it throw up: Comparator&lt;Integer&gt; brokenAndThrowsUp = new Comparator&lt;Integer&gt;() { @Override public int compare(Integer o1, Integer o2) { if (Math.abs(o1 - o2) &lt; 10) { return Compare.EQUAL; // WRONG and does matter } return Ordering.natural().compare(o1, o2); } }; UPDATE: in some real life data we had a failure where there were no x,y,z with x = y and y = z but x &lt; z . So It seems my guess was wrong, and it doesn't seem this specific kind failure only. Any better ideas?
has comment: http://stackoverflow.com/comment/38781330
upvote count: 5
downvote count: 0
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/8327514
has answer: http://stackoverflow.com/a/24951765
linked to: http://stackoverflow.com/q/16078578
tagged with: timsort
tagged with: java
has comment: http://stackoverflow.com/comment/38799341
has title: When does TimSort complain about broken comparator?
has comment: http://stackoverflow.com/comment/38781611
has comment: http://stackoverflow.com/comment/38781478
type: Question
answer count: 2
score: 5
has answer: http://stackoverflow.com/a/24951671

http://stackoverflow.com/comment/38931293
score: 0
type: AnswerComment
has text: I have tried it , I have edited question accordingly :)
type: Comment
comment on: http://stackoverflow.com/a/25032408

http://stackoverflow.com/comment/38846392
has text: Thanks a lot... worked for me... also for all the methods which are throwing exceptions.. they are getting modified and never asked me to put try catch when it is suppposed to.. can you let me know how can i keep throws in method signature too.. in my jar file?
type: AnswerComment
comment on: http://stackoverflow.com/a/24966327
score: 0
type: Comment

http://stackoverflow.com/comment/38793169
score: 0
has text: And where would that be? I know in regular AsyncTask you would do it in the OnPostExecute method but I'm not familiar with request.exesuteAsync();
comment on: http://stackoverflow.com/q/24958784
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25003519
type: Answer
has comment: http://stackoverflow.com/comment/38878878
answers question: http://stackoverflow.com/q/25003404
has comment: http://stackoverflow.com/comment/38876947
accepted answer of: http://stackoverflow.com/q/25003404
score: 4
upvote count: 4
has body: Standard overriding is definitely out of the question. Private members aren't even inherited so there is no sense in the very concept of "overriding" them in the subclass. In your case the writers decided to have this class private. It may be inconvenient for your particular purpose, but since everything within a public library which is publicly accessible automatically becomes a part of its API, binding its authors to maintain it for backward compatibility, it is no light decision to make any particular piece of code public. Here the writers decided not to take that step. So, indeed, reusing by copy-paste (if feasible) could in this case be an appropriate means of achieving your goal. While doing so take care to respect the terms of the library's license.
has comment: http://stackoverflow.com/comment/38876977
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/38819417
score: 0
type: AnswerComment
has text: You don't need to use `runascurrentuser` flag when you omit the `postinstall` one as it is used by default.
type: Comment
comment on: http://stackoverflow.com/a/24972664

http://stackoverflow.com/comment/38821032
type: AnswerComment
has text: @AbhinavKumar The `Array` class provides a nice method to get the length of an array.
score: 0
comment on: http://stackoverflow.com/a/24973699
type: Comment

http://stackoverflow.com/comment/38874953
comment on: http://stackoverflow.com/a/25000610
type: AnswerComment
has text: i dont want to increase dependencies
score: 0
type: Comment

http://stackoverflow.com/comment/38834049
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24980638
type: Comment
has text: Sorry, I meant the HttpServletRequest. I was under the impression that that had to be run from a web server, but your last comment has told me that that is the way to go. Thanks for all the help.

http://stackoverflow.com/comment/38937805
comment on: http://stackoverflow.com/q/25036021
type: Comment
type: QuestionComment
has text: It's fine as it is. That's what polymorphism is there for.
score: 2

http://stackoverflow.com/q/25022095
type: AnsweredQuestion
tagged with: java
tagged with: eclipse
tagged with: classpath
type: Question
has answer: http://stackoverflow.com/a/25044167
accepted answer: http://stackoverflow.com/a/25044167
score: 0
answer count: 1
tagged with: tomcat
has title: Unable to export non-jar files when web project is exported as a war file from Eclipse
has body: I have developed a dynamic web application in Eclipse. I am using Tomcat as a server. In my lib folder I have placed one non-jar files( addressing.mar ). This file is necessary other wise I get an error in my application. Now I export my project as war file and then deploy the project on Tomcat server. When I run the project I get an exception because addressing.mar cannot be found in the lib folder of the project. I don't know why addressing.mar isn't exported. If I manually place file in it, it is working, but I need a better solution.

http://stackoverflow.com/comment/38730421
score: 0
has text: @user3862586: I didnt notice that. Wait while i correct it.
type: Comment
comment on: http://stackoverflow.com/a/24925389
type: AnswerComment

http://stackoverflow.com/q/25005481
tagged with: arrays
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/38880695
has comment: http://stackoverflow.com/comment/38880942
has answer: http://stackoverflow.com/a/25005518
accepted answer: http://stackoverflow.com/a/25005518
has body: I have a problem when i want to convert one String to JSON Array: this is String arrayPersona = ""[{\"nombre\": \"Luis\", \"apellido\": \"cardozo\", \"edad\": 23}, {\"nombre\": \"Pedro\", \"apellido\": \"Castro\", \"edad\": 25}, {\"nombre\": \"Ana\", \"apellido\": \"Lopez\", \"edad\": 22}]"" when i try to convert to JSONArray using next code registros = request.getParameter("jsonArray"); JSONParser parser = new JSONParser(); Object obj = parser.parse(registros); JSONArray jsonArray = (JSONArray) obj; Output: (java.lang.ClassCastException) java.lang.ClassCastException: java.lang.String cannot be cast to org.json.simple.JSONArray I think this line Object obj = parser.parse(registros); don't convert the String in Object but i don't now why ............ thanks for your Help
has title: How to Convert a String (JSON format) to JSONArray
downvote count: 2
type: AnsweredQuestion
score: -2
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: Question
upvote count: 0

non-static
tags question: http://stackoverflow.com/q/25021744
type: Tag
tag name: non-static

http://stackoverflow.com/a/24984395
has body: With Eclipse itself, one generally wouldn't try to do the deployment of the built JAR to the target and have it run in debug mode. Instead, one would start the remote debugging session in Eclipse after having deployed the newly built jar and started it with the various debug/suspend flags to allow you to remotely connect to it. There are a variety methods of doing the deploy. The most straightforward would be to simply do a regular built in Eclipse (or at the command line via ant or using whatever build tool you are using), manually scp the jar over to the remote location, and ssh into the box and start the app up using the necessary commands. Another option is to use a deployment framework such as fabric (written in Python) which will do the build, scp it over to your remote location, and then run whatever commands you need to run in order to get that up and running (i.e. first stopping an existing Tomcat instance, etc. or whatever the case may be). You can have different environments setup in the fabfile, such as debug and prod, so you can deploy it in debug mode for cases like you are looking for now, and then in prod mode it deploys normally and just runs. If you are using Gradle, it has some tools such as Cargo that can help with remote deployments, or for simpler use cases, using the ssh plugin and managing things more directly (see http://java.dzone.com/articles/replace-your-scripts-gradle for more details). Edit in response to comment from OP: I've not used Remote System Explorer myself, but it appears to be extensible to some extent (see the Service and Subsystem layers), although fundamentally it still seems to be UI-focused. For this sort of use case I would recommend giving Gradle another look, as it's focused on building, is very extensible, and can be integrated into Eclipse or run completely on the command line.
score: 3
accepted answer of: http://stackoverflow.com/q/24984274
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/38873682
upvote count: 3
answers question: http://stackoverflow.com/q/24984274

http://stackoverflow.com/comment/38864226
has text: Well @AbsurdMind answered your question - not always. Also I'm wondering, what is the case where you need to know that?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24950928
score: 0

http://stackoverflow.com/comment/38974618
type: QuestionComment
score: 4
comment on: http://stackoverflow.com/q/25055290
has text: `volatile` wouldn’t fix that problem.
type: Comment

http://stackoverflow.com/comment/38728114
score: 0
type: QuestionComment
type: Comment
has text: have you read [this question/answer](http://stackoverflow.com/questions/5972764/non-static-method-cannot-be-referenced-from-a-static-context?rq=1) and do you understand what a static reference is?
comment on: http://stackoverflow.com/q/24924298

http://stackoverflow.com/q/24942322
answer count: 2
tagged with: jframe
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/259575
has answer: http://stackoverflow.com/a/24943684
has title: Combine JFileChooser in the middle of JFrame
has answer: http://stackoverflow.com/a/24943528
tagged with: java
tagged with: jfilechooser
type: Question
has body: I'm doing a mini-program in Java, that would manage files in the computer. I tried put the JFileChooser.showSaveDialog() in the middle of the frame, by creating a panel and put it in the middle of the frame : JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JPanel panel = new JPanel(); panel.setPreferredSize(new Dimension(150,150) ); JFileChooser chooseFile = new JFileChooser(); chooseFile.showSaveDialog(panel); frame.getContentPane().add(BorderLayout.CENTER,panel); frame.setSize(400,400); frame.setVisible(true); But actually, when the showSaveDialog() command happens, the frame becomes not visible. Can I change it?
score: 0

http://stackoverflow.com/comment/38745742
type: QuestionComment
has text: It's strange that using inputDoc.getAttachment("ICEMachine_bottomsection.JPG") doesn't work for this document. Another approach could be to use `Vector<String> attachments = DominoUtils.getCurrentSession().evaluate("@AttachmentNames",inputDoc); EmbeddedObject image = inputDoc.getAttachment(attachments.get(0));` to get a hand on the embedded object.
score: 0
comment on: http://stackoverflow.com/q/24918942
type: Comment

http://stackoverflow.com/q/24958900
has comment: http://stackoverflow.com/comment/38792715
has answer: http://stackoverflow.com/a/24959076
answer count: 3
has comment: http://stackoverflow.com/comment/38792689
has body: I'm trying to do a program that if two TextFields are equal to a value something will happen and I have two if statements. When the first if statement happens the second if statement happens but the value I set in the code does not match. To explain better, here is the code: private void LevelUp(){ float level = (float) Double.parseDouble(lvl.getText()); float expmn = (float) Double.parseDouble(ExpMin.getText()); if(level == 1 &amp;&amp; expmn == 500){ lvl.setText("2"); ExpMin.setText("501"); ExpMax.setText("1000"); JOptionPane.showMessageDialog(null,"" + "levevlup!" ,"Para Yok",JOptionPane.PLAIN_MESSAGE); if(level == 2 &amp;&amp; expmn == 1000); lvl.setText("3"); ExpMin.setText("1001"); ExpMax.setText("2500"); } else{ JOptionPane.showMessageDialog(null,"" + "leveladssadaup" ,"Para Yok",JOptionPane.PLAIN_MESSAGE); } } }
has comment: http://stackoverflow.com/comment/38792903
tagged with: void
has title: Java is trying to do if statement that is not true
score: -1
possible better answer: http://stackoverflow.com/a/24959026
has comment: http://stackoverflow.com/comment/38792978
has answer: http://stackoverflow.com/a/24959026
accepted answer: http://stackoverflow.com/a/24959040
has comment: http://stackoverflow.com/comment/38792710
has comment: http://stackoverflow.com/comment/38792722
downvote count: 1
type: AnsweredQuestion
tagged with: if-statement
tagged with: java
tagged with: jtextfield
type: Question
upvote count: 0
tagged with: button
has answer: http://stackoverflow.com/a/24959040
has comment: http://stackoverflow.com/comment/38792691
favorite count: 0

tablemodel
type: Tag
tags question: http://stackoverflow.com/q/25066696
tag name: tablemodel
tags question: http://stackoverflow.com/q/24986087

http://stackoverflow.com/q/24928743
tagged with: http://stackoverflow.com/tag/csv
has comment: http://stackoverflow.com/comment/78648753
tagged with: http://stackoverflow.com/tag/xml
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38737915
tagged with: xslt
has comment: http://stackoverflow.com/comment/38736563
tagged with: java
has comment: http://stackoverflow.com/comment/38744386
type: Question
score: 0
has title: convert XML to CSV without XSLT in java
linked to: http://stackoverflow.com/q/1086807
linked to: http://stackoverflow.com/q/19434274
has body: first time using stack overflow, I'm now a student doing a project for analtics purpose, but the company store all the records into XML and I have to convert it and make a program as so to make it automated report send by email. I'm using java to do XML parser and I'm now trying Apache common digester as other parser needs XSLT to do that, but iIwant a program that doesn't depends on XSLT because the company wants a system and sends a report like every 5 min of summary. So using XSLT may be quite slow as I saw some of the answer here. So may I know how to do that using digester or other methord, try to show some example the codes if possible, to make a conversion. Here is the sample code I have build under digester: public void run() throws IOException, SAXException { Digester digester = new Digester(); // This method pushes this (SampleDigester) class to the Digesters // object stack making its methods available to processing rules. digester.push(this); // This set of rules calls the addDataSource method and passes // in five parameters to the method. digester.addCallMethod("datasources/datasource", "addDataSource", 5); digester.addCallParam("datasources/datasource/name", 0); digester.addCallParam("datasources/datasource/driver", 1); digester.addCallParam("datasources/datasource/url", 2); digester.addCallParam("datasources/datasource/username", 3); digester.addCallParam("datasources/datasource/password", 4); File file = new File("C:\\Users\\1206432E\\Desktop\\datasource.xml"); // This method starts the parsing of the document. //digester.parse("file:\\Users\\1206432E\\Desktop\\datasource.xml"); digester.parse(file); } Another one which is build using DOM to convert CSV to XML but still relies one XSLT file: public static void main(String args[]) throws Exception { File stylesheet = new File("C:\\Users\\1206432E\\Desktop\\Style.xsl"); File xmlSource = new File("C:\\Users\\1206432E\\Desktop\\data.xml"); DocumentBuilderFactory factory = DocumentBuilderFactory.newInsta…

http://stackoverflow.com/comment/38933650
has text: Look into possible duplicate of http://stackoverflow.com/questions/12727989/jax-ws-getting-client-ip
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25033435

http://stackoverflow.com/comment/38973343
comment on: http://stackoverflow.com/a/25053301
type: AnswerComment
score: 0
type: Comment
has text: I didn't use a `JToggleButton` because the OP didn't use it. I think that the OP doesn't want the buttoon to stay pressed if it is in selected state. Nevertheless one might use the `ToggleButtonModel`.

http://stackoverflow.com/q/24927401
accepted answer: http://stackoverflow.com/a/24927693
has comment: http://stackoverflow.com/comment/38747309
has comment: http://stackoverflow.com/comment/38733965
type: Question
score: 14
tagged with: java
has comment: http://stackoverflow.com/comment/38734510
possible better answer: http://stackoverflow.com/a/24927726
answer count: 2
has answer: http://stackoverflow.com/a/24927726
has comment: http://stackoverflow.com/comment/38734254
downvote count: 0
has answer: http://stackoverflow.com/a/24927693
has title: Creating object using static keyword in Java
has comment: http://stackoverflow.com/comment/38734550
favorite count: 0
tagged with: static
linked to: http://stackoverflow.com/q/3499214
has comment: http://stackoverflow.com/comment/38734360
has comment: http://stackoverflow.com/comment/38734669
has body: class abc { int a = 0; static int b; static abc h = new abc(); //line 4 public abc() { System.out.println("cons"); } { System.out.println("ini"); } static { System.out.println("stat"); } } public class ques { public static void main(String[] args) { System.out.println(new abc().a); } } When i wrote this code I am getting output in order like this: ini cons stat ini cons 0 Here when I created a new object in main(), class abc got loaded and static variables and blocks are executed in order they are written. When control came to line 4 static abc h = new abc(); Instance Initialization block is called. Why? why is static block not called when a new object is created at line 4 and till that time static block was also not called even once, so according to convention static block should have been called. Why is this unexpected output coming?
has comment: http://stackoverflow.com/comment/38734817
has comment: http://stackoverflow.com/comment/38734258
tagged with: initialization
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38746466
upvote count: 14

http://stackoverflow.com/a/25101772
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39086539
accepted answer of: http://stackoverflow.com/q/24981186
type: Answer
has comment: http://stackoverflow.com/comment/39078923
answers question: http://stackoverflow.com/q/24981186
has comment: http://stackoverflow.com/comment/39081858
has body: Okay I think I understand your problem: You want to have DnD enabled, just not when the user is changing their selection. You should try this (in Java 7, I'm not too comfortable with lambda expressions yet, so I'm still not using Java 8. It'll work on Java 8 though): class Main { private static boolean listChanging = false; public static void createGUI() { final JFrame f = new JFrame(); JList&lt;String&gt; list = new JList&lt;String&gt;(new String[] { "Text A", "Text B" }); list.setFont(list.getFont().deriveFont(24f)); list.setDragEnabled(true); list.setTransferHandler(new TransferHandler() { private static final long serialVersionUID = 1L; @Override public int getSourceActions(JComponent c) { if (listChanging) { listChanging = false; return NONE; } else { return COPY; } } @Override @SuppressWarnings("unchecked") public Transferable createTransferable(JComponent c) { return new StringSelection(((JList&lt;String&gt;) c).getSelectedValue()); } }); list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); list.addListSelectionListener(new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent e) { f.setLocation(f.getX(), f.getY() + f.getHeight()); listChanging = true; } }); list.setSelectedIndex(0); f.add(list, BorderLayout.CENTER); f.pack(); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.setLocationByPlatform(true); f.setVisible(true); } public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { Main.createGUI(); } }); } } What this code does is that when the user when the user changes selection it set a variable listChanging to true. The when the user drags (by accident or on purpose), it checks if listChanging is true, which means that this was probably an unexpected drag. If the list was not changing, then it allows COPY drags. Basically, if the drag was during a list change, it disables DnD. If the list did not change, and the user purposefully dragged it enables DnD. Hope this…
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/39061650

http://stackoverflow.com/q/25039129
tagged with: java
has comment: http://stackoverflow.com/comment/38944159
tagged with: jboss
linked to: http://stackoverflow.com/q/22421469
has body: Spring MVC "duplicates" parts of the URL I looked at the previous link but the answers did not work and did not seem relevant (unless I'm doing something wrong). My jboss-web.xml root is "/portal" I have an jsp doc (with only html in it) that posts to a java controller that authenticates a username and password. The formaction is "portal/index". The controller's class level path annotation is "portal". The method that I want it to post to has a path annotation "/index". @Controller @Path("portal") public class TheController {....} @POST @Path("/index") public Response login() {....} If the password and username are correct, then the method will forward to home.jsp. Otherwise, it will go back to index.jsp. For some reason, when I submit the form with the incorrect username and password the 1st time, it will go back to "portal/portal/index" (the form will show up) and if I submit it incorrectly a 2nd time, it will go to "portal/portal/portal/index" and the security filter it goes through will return a 404 not found. What is wrong with my set up that is leading to the duplicating URL?
type: Question
has comment: http://stackoverflow.com/comment/38944586
has title: Duplicating url - Resteasy, Spring, HTML
score: 0
tagged with: http://stackoverflow.com/tag/html
answer count: 1
tagged with: resteasy
tagged with: spring
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25039729
accepted answer: http://stackoverflow.com/a/25039729

http://stackoverflow.com/q/24983812
has comment: http://stackoverflow.com/comment/38840379
tagged with: null
has comment: http://stackoverflow.com/comment/38840008
has title: How would I read the following text into a 2D Array
score: 0
tagged with: multidimensional-array
has body: Once written to text file the 2D object looks like this: null null -5 160 2 null null null 75 80 1 75 160 0 null 75 320 1 null null 155 160 2 null null 235 0 1 235 80 2 235 160 1 null null the object is in the form elements(x,y,i) So each object makes use of 3 digits. The problem arises in reading the Integers from the text file as it is mixed with the String from the "null values." This is what I have so far but it only partially reads the text file. public void readElements() throws IOException { File file = new File("elements.txt"); Scanner inp = new Scanner(file); for (int col = 0; col &lt;rectArr.length; col++){ if(inp.hasNextLine()) { inp.nextLine(); } for(int row = 0; row&lt;rectArr[0].length; row++){ if(inp.hasNext()) { try { String s = inp.next(); Integer.parseInt(s); System.out.println(s); int x = Integer.parseInt(s); int y = Integer.parseInt(inp.next()); int i = Integer.parseInt(inp.next()); elementsArr[col][row] = new elements(x, y, i); } catch (NumberFormatException nfe) { } } } } }
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38839977
tagged with: java
has comment: http://stackoverflow.com/comment/38843834
has comment: http://stackoverflow.com/comment/38841363
has comment: http://stackoverflow.com/comment/38843397
type: Question
has comment: http://stackoverflow.com/comment/38843530
has comment: http://stackoverflow.com/comment/38839929

http://stackoverflow.com/comment/38791579
score: 0
type: Comment
type: QuestionComment
has text: Then friend no other way to generate such offal, perhaps with another tool ?
comment on: http://stackoverflow.com/q/24958042

http://stackoverflow.com/q/25007475
type: Question
has comment: http://stackoverflow.com/comment/38884376
has comment: http://stackoverflow.com/comment/38885046
has comment: http://stackoverflow.com/comment/38884579
linked to: http://stackoverflow.com/q/4571419
has comment: http://stackoverflow.com/comment/38884940
has body: For some reason, a string drawn to a BufferedImage appears differently to one drawn straight to a JComponent. Here's an example. The top string is drawn directly, while the bottom is drawn using a buffer. What is going on here? import javax.swing.*; import java.awt.*; import java.awt.image.BufferedImage; import java.util.Map; public class Main { static class Canvas extends JComponent { @Override public void paintComponent(Graphics g) { g.setColor(Color.WHITE); g.fillRect(0, 0, this.getWidth(), this.getHeight()); g.setColor(Color.BLACK); g.drawString("OMFG look at this 'S'", 10, 20); BufferedImage bi = new BufferedImage(150,50,BufferedImage.TYPE_INT_RGB); Graphics2D imageG = bi.createGraphics(); imageG.setColor(Color.WHITE); imageG.fillRect(0, 0, 150, 50); imageG.setColor(Color.BLACK); imageG.setFont(g.getFont()); imageG.drawString("OMFG look at this 'S'", 10, 10); g.drawImage(bi, 0, 30, this); } } public static void main(String[] args) { JFrame jf = new JFrame(); jf.setMinimumSize(new Dimension(150, 80)); jf.add(new Canvas()); jf.setVisible(true); } }
downvote count: 0
has comment: http://stackoverflow.com/comment/38884889
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/38885057
has comment: http://stackoverflow.com/comment/38884730
answer count: 0
has comment: http://stackoverflow.com/comment/38885019
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38884466
upvote count: 1
tagged with: swing
has comment: http://stackoverflow.com/comment/38885169
has comment: http://stackoverflow.com/comment/38885005
has comment: http://stackoverflow.com/comment/38884423
linked to: http://stackoverflow.com/q/8281886
tagged with: fonts
tagged with: rendering
has comment: http://stackoverflow.com/comment/38884765
tagged with: java
tagged with: bufferedimage
has title: Messed up BufferedImage fonts on OS X

http://stackoverflow.com/comment/38868972
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24986199
has text: @FuxsA you can write whatever you want in the configuration file, as long as you parse it correctly in your code. In my example above, you would simply write "3 1 5" in the configuration file, which would be assigned to `firstArg`, `secondArg`, and `thirdArg`, respectively.
score: 0

http://stackoverflow.com/comment/39071575
comment on: http://stackoverflow.com/q/25049751
score: 0
type: Comment
type: QuestionComment
has text: A pure parser won't do it. You need a parser augmented with tree node building operations. See my answer.

http://stackoverflow.com/comment/38895604
comment on: http://stackoverflow.com/q/25013363
score: 0
type: Comment
type: QuestionComment
has text: Here is your answer - java.io.FileNotFoundException: /VimbaEmailLogo.png (No such file or directory). Try change VIMBA_LOGO value.

http://stackoverflow.com/q/25041520
has body: I have a class that looks like this: public class TrafficReportMapper implements RowMapper&lt;TrafficReport&gt; { @Override public TrafficReport mapRow(ResultSet rs, int rowNum) { // Do something here return new TrafficReport(....); } } TrafficReport is a POJO and I want to extend it with something like DayTrafficReport and to create a new mapper that extends TrafficReportMapper. So I changed TrafficReportMapper as follows: public class TrafficReportMapper&lt;T extends TrafficReport&gt; implements RowMapper&lt;T&gt; { @Override public T mapRow(ResultSet rs, int rowNum) { // Exactly the same code as before return new TrafficReport(....); } } Only this time I get Incompatible Types: Required T; found TrafficReport But the thing is that TrafficReport must be of type T. I'm not sure what I'm missing here.
score: 0
answer count: 2
possible better answer: http://stackoverflow.com/a/25041611
tagged with: generics
has title: Incompatible type when using generic
has comment: http://stackoverflow.com/comment/38949469
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25041869
tagged with: java
has answer: http://stackoverflow.com/a/25041611
type: Question
has answer: http://stackoverflow.com/a/25041869

http://stackoverflow.com/q/24983596
has comment: http://stackoverflow.com/comment/42079977
score: 4
has title: Why is exception not thrown when the connection is terminated?
answer count: 1
favorite count: 0
tagged with: download
tagged with: sockets
linked to: http://stackoverflow.com/q/24975455
has comment: http://stackoverflow.com/comment/38840231
has answer: http://stackoverflow.com/a/26747313
type: AnsweredQuestion
duplicate of: http://stackoverflow.com/q/24975455
tagged with: java
type: Question
upvote count: 4
tagged with: network-programming
has body: I am here to solve an issue i am facing. I hope to get some help from the experts. Below is a code of a simple file downloader in java. I want to detect an exception when the connection is broken in the middle of downloading a file. Now, I run the code and in the middle of downloading the file, i turn off my wifi with keyboard wifi off button. Doing this the program hangs forever without throwing any exceptions and without terminating. It seems it blocks forever. Firstly my confusion is why is exception not thrown? Secondly, in the following code you can see this line //con.setReadTimeout(2000); which is currently commented out. Removing the comment and running the program, now if connection breaks in the middle by turning off wifi then it waits for 2 seconds and then if it cannot read then it terminates without throwing exception. So, again in this case why is it just terminating and not throwing any exception? I am very puzzled by this behavior. I hope i can get some help. Thank you very much! import java.io.FileOutputStream; import java.net.URL; import java.net.URLConnection; import java.nio.channels.Channels; import java.nio.channels.ReadableByteChannel; import java.util.*; public class Main { public static void main(String[] args) { try{ URL website = new URL("http://128f1.downloadming1.com/bollywood%20mp3/Jai%20Ho%20(2014)/06%20-%20Naacho%20Re%20-%20DownloadMing.SE.mp3"); URLConnection con = website.openConnection(); //con.setReadTimeout(2000); ReadableByteChannel rbc = Channels.newChannel(con.getInputStream()); FileOutputStream fos = new FileOutputStream("song.mp3"); fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); } catch(Exception e){ System.out.println("got here"); e.printStackTrace(); } System.out.println("Done downloading..."); } }
accepted answer: http://stackoverflow.com/a/26747313
downvote count: 0
tagged with: url

http://stackoverflow.com/comment/38887384
type: QuestionComment
comment on: http://stackoverflow.com/q/25008834
has text: Sorry i am a beginner. where can i find them?
score: 0
type: Comment

http://stackoverflow.com/a/25044736
has body: Well, when you parametrize JComboBox with &lt;String[][]&gt;, the method addItem() requires a String[][] as a parameter: public void addItem(String[][] item) { // method signature when &lt;String[][]&gt; In your example you are trying to pass a normal String, which is obviously not allowed, since it is not a String[][]. To fix this issue, just parametrize it with String: private JComboBox&lt;String&gt; myComboBox = new JComboBox&lt;&gt;(); For more information about rawtypes see the amazingly detailled answer to that question: What is a raw type and why shouldn&#39;t we use it?
upvote count: 6
answers question: http://stackoverflow.com/q/25043929
accepted answer of: http://stackoverflow.com/q/25043929
score: 6
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/38955111
type: Answer

http://stackoverflow.com/comment/38963606
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25049354
has text: int array2[] = { 12, 13, 14, 15, 16, 17, 18, 19, 123, 124, 125, 126, 127}; your array also not valid
score: 0

http://stackoverflow.com/q/25068926
upvote count: 1
tagged with: swing
has title: After changing JLabel text it will not reposition
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25069459
has body: I have a JDialog with a title written at the top. I call this JDialog for two different cases and if it is not the default I change the text to something else. This works fine but the position is then too far to the right. I have tried numerous methods such as: TitleText.setText("Edit Fuse"); TitleText.setAlignmentY(JLabel.CENTER_ALIGNMENT); //TitleText.setHorizontalAlignment(JDialog.); //TitleText.setLayout(new FlowLayout(FlowLayout.LEFT)); None of them even move the text. I am using a Free Design Layout for the entire JDialog. If I must I'll just create another JLable and hide/unhide but I thought this would be simple. Anyone know how to do this?
score: 1
tagged with: java
type: Question
tagged with: layout
has comment: http://stackoverflow.com/comment/39000694
answer count: 1
downvote count: 0
tagged with: jdialog
has answer: http://stackoverflow.com/a/25069459
favorite count: 0
tagged with: jlabel

http://stackoverflow.com/a/24942090
score: 0
has body: In case anyone else is looking to figure out the standard deviation when you know X% of the population is within Y units of the mean, I think I figured it out with Java. Commons Math has a nice library for error functions so I used that. SD = Math.sqrt(2) * Erf.erfcInv(1 - p) where 0 &lt;= p &lt;= 1 So that will give you the standard deviation for Y units from the mean. Hope that helps.
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24940494
type: Answer
accepted answer of: http://stackoverflow.com/q/24940494

http://stackoverflow.com/a/45295699
upvote count: 2
type: Answer
score: 2
answers question: http://stackoverflow.com/q/24958366
downvote count: 0
has body: This is several steps how to draw image on the canvas. Make your own canvas on a frame object. import java.awt.Canvas; import java.awt.Dimension; import javax.swing.JFrame; public class Display { private JFrame jframe; private static Canvas canvas; private String title; private int width, height; public Display(String tuade, int rong, int dai) { this.title = tuade; this.width = dai; this.height = rong; initCanvas(); } private void initCanvas() { jframe = new JFrame(title); jframe.setSize(width, height); jframe.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); jframe.setResizable(false); jframe.setVisible(true); jframe.setLocationRelativeTo(null); canvas = new Canvas(); canvas.setPreferredSize(new Dimension(width, height)); canvas.setMaximumSize(new Dimension(width, height)); canvas.setMinimumSize(new Dimension(width, height)); jframe.add(canvas); jframe.pack(); } public Canvas getCanvas() { if(canvas == null) { System.out.println("Canvas is null"); return null; } return canvas; } } Then, draw an image on the Display class import java.awt.Graphics; import java.awt.image.BufferStrategy; import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; import javax.imageio.ImageIO; public class DrawImageOnCavas implements Runnable { private Display Display; private Thread t; private boolean running; public int dai, rong; private String tuade; private BufferStrategy bs; private Graphics g; private BufferedImage testImage; public DrawImageOnCavas(String tuade, int dai, int rong) { this.dai = dai; this.rong = rong; this.tuade = tuade; } @Override public void run() { init(); System.err.println("run..." + running); while (running) { //System.err.println("run..." + running); tick(); render(); } //stop(); } private void render() { bs = Display.getCanvas().getBufferStrategy(); if (bs == null) { System.out.println("bs is null...."); Display.getCanvas().createBufferStrategy(3); return; } g = Display.getCanvas().getGraphics(); g.drawImage(testImage, 20, 20, null…

http://stackoverflow.com/a/24942920
upvote count: 1
has comment: http://stackoverflow.com/comment/38765741
has body: Right now there is no way to add your own cookies to Worklight requests. Like your edit says, any Cookie header added using addGlobalHeader() gets replaced with only the cookies WL adds. A feature request has been opened to see if this functionality could be added in future versions.
has comment: http://stackoverflow.com/comment/38765567
answers question: http://stackoverflow.com/q/24942101
downvote count: 0
has comment: http://stackoverflow.com/comment/38764946
has comment: http://stackoverflow.com/comment/38764267
has comment: http://stackoverflow.com/comment/38764579
type: Answer
score: 1

http://stackoverflow.com/q/24990185
possible better answer: http://stackoverflow.com/a/24990274
has answer: http://stackoverflow.com/a/24990274
has title: When exception occurs is it possible to pause my try block, execute catch block and again resume my try block
has comment: http://stackoverflow.com/comment/38851831
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/24990256
tagged with: exception
type: AnsweredQuestion
has body: try { System.out.println("Enter your name"); Name = in.next(); } catch (InputMismatchException exception) { System.out.println("Enter valid input"); } When user enters integer value, i need to pause my execution then need to display "Enter valid input" and again have to remuse my try block. How can i achieve this in java..
tagged with: java
accepted answer: http://stackoverflow.com/a/24990256
linked to: http://stackoverflow.com/q/13239972
type: Question

http://stackoverflow.com/a/25006141
has comment: http://stackoverflow.com/comment/38921156
has comment: http://stackoverflow.com/comment/38896819
has body: I think the 1.2 million strings will not fit in memory or easily overflow the size limitation of your memory (consider a bad case where the average string length 256). If some kind of pre-processing is allowed, I think you'd better first reduce the sequence of strings into a sequence of words. It means that you first convert your data into another set of data that will easily fit in memory and won't overflow. After that, I think you can depend on the in-memory data structures such as HashMap.
score: 0
answers question: http://stackoverflow.com/q/24989645
type: Answer

http://stackoverflow.com/comment/38921014
has text: Thank you for the quick response. So if I understand correctly, after the change in schema.xml things would still be functional (i.e. not throw errors either from the the solr webapp itself or the solrj client making requests to it) however there could be inconsistencies in what is indexed. Is that accurate? In my testing, everything looked functional and I did not see any errors. But you make a good point about looking at what kind of inconsistency I might be introducing and how that impacts the useful of the index.
comment on: http://stackoverflow.com/a/25025100
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/25062062
downvote count: 0
score: 1
favorite count: 0
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/25062607
has answer: http://stackoverflow.com/a/25062607
has answer: http://stackoverflow.com/a/25062423
tagged with: java
tagged with: hibernate
upvote count: 1
has body: In an application that makes use of Hibernate we have several entity classes which map to tables in the database schema. I have seen entities which a lot of seemingly useless JavaDoc comments and can't help but wonder if there's any usefulness there at all. Is there any value to these brain-dead comments? And if not, can you make an argument for its removal? /** * MyClass entity. */ @Entity @Table(name="my_class") public class MyClass { // Fields /** The id. */ private Integer id; /** The name. */ private String name; ... // Constructors /** * default constructor. */ public MyClass() { } ... // Property accessors /** * Gets the id. * * @return the id */ @Id @GeneratedValue(strategy = IDENTITY) @Column(name = "id", unique = true, nullable = false) public Integer getId() { return this.id; } /** * Sets the id. * * @param id * the new id */ public void setId(Integer id) { this.id = id; } ... }
tagged with: comments
accepted answer: http://stackoverflow.com/a/25062423
has title: Is there any value to "boilerplate comments?"
type: AnsweredQuestion

http://stackoverflow.com/comment/38945613
type: QuestionComment
type: Comment
has text: If you want to copy a file to an OutputStream, and you're making use of the Files class anyway, why not use `Files.copy(file, procOutput);`?
comment on: http://stackoverflow.com/q/25038912
score: 0

http://stackoverflow.com/q/24993271
possible better answer: http://stackoverflow.com/a/24993339
favorite count: 0
has body: Im beginner JAVA developer. Here is a method: private Method getSomething() { for (Method m : getClass().getDeclaredMethods()) { return m; } return notFound; } private void notFound() { throw new Exception(); } it doesnt matter what it does - if it finds something, then returns a Method - if not, the notFound() method itself should be returned. So the hot spot is at the return notFound; line: if I use return notFound(); then it returns its value, not the method itself. I want something like a reference/pointer. So getSomething() returns something what can be called, and if the returned method is used wrong, it should trigger that Exception - so its not an option to replace return notFound; with throw new Exception(); ! Or the 2nd option is to create a lambda method....
accepted answer: http://stackoverflow.com/a/24993312
has comment: http://stackoverflow.com/comment/38857432
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24993339
tagged with: java
has answer: http://stackoverflow.com/a/24993312
downvote count: 1
type: Question
answer count: 2
upvote count: 5
has title: Java, return method as reference
score: 4

http://stackoverflow.com/q/24981371
has comment: http://stackoverflow.com/comment/38835350
has body: I have an algorithm to run and at one of the steps I have to find duplicate pairs in a list called (PairList), count them and eliminate the pairs that are smaller than a specific parameter (minSupp).This is my code for adding the pairs to PairList. for (int i = sizes.get(sequence.getId())-maxError ; i &lt;= sizes.get(sequence.getId())-1; i++){ for(int j = i+1; j&lt;sizes.get(sequence.getId()); j++){ //Get the first Item int first = sequence.getItemsets().get(i); //gets the second Item int second =sequence.getItemsets().get(j); //Generate pattern as pair Pair pattern = new Pair(first, second); sequenceID = sequence.getId(); //Generate triples with sequence ID and pair Triples triples = new Triples(sequenceID, i, j); if (!pairList.contains(pattern)){ //adds if it doesn't exist pairList.add(pattern); } Now pairList contains some pairs like this: (3, 28) (3, 58) (3, 61) (3, 28) (5, 21) (3, 28) (5, 21) I want to know for instance how many times (3, 28) occurs in this List. and for a (minSupp=2) I want to remove the pairs that occurred less than 2 times So the output should be something like this: (3, 28) : 3 (3, 58) : 1 (this must be removed) (3, 61) : 1 remove (5, 21) : 2 I worked on it and this is my code until now but it gives me an output far too much from what I want so please help! for(Pair pair : pairList){ int a = Collections.frequency(pairList, pair); for (int i=0 ; i&lt;pairList.size() ; i++){ for (int j =i+1 ; j&lt;pairList.size()-1;j++){ if (pairList.get(i).getX()==pairList.get(j).getX() &amp;&amp; pairList.get(i).getY()==pairList.get(j).getY() ){ a++; System.out.println(pair + ": " + a); }
answer count: 1
has answer: http://stackoverflow.com/a/24981542
tagged with: arraylist
tagged with: count
type: UnansweredQuestion
has title: Count duplicate Integer pairs in an arrayList in java
type: Question
linked to: http://stackoverflow.com/q/27581
tagged with: java
tagged with: duplicates
score: 0

http://stackoverflow.com/comment/88302381
type: Comment
comment on: http://stackoverflow.com/a/24941879
score: 0
has text: @sina72 How about itext7 ? I can not set image dimensions and save as image file like this. Can you please help ?
type: AnswerComment

http://stackoverflow.com/comment/38798759
type: Comment
type: QuestionComment
has text: So you should make taglet lib (jar file) and just use it as dependency for mavan-javadoc-plugin. Apart from that if the library requires 1.5 it should run with Java 1.7. So i don't see problem.
comment on: http://stackoverflow.com/q/24961307
score: 0

http://stackoverflow.com/comment/39183791
type: QuestionComment
has text: @adcom Yeah, I have got it reduced a bit by increasing timeouts (Read timeout & Socket timeout) - also, I noticed nginx rejecting some messages which were above 1 MB, so I increased request size to 5 MB as precaution. But still some issues are around - mainly Read timeout when client is trying to connect to server and occasional broken pipes. Thanks for your imputs.
score: 0
comment on: http://stackoverflow.com/q/25059196
type: Comment

http://stackoverflow.com/a/38463119
has body: foo.bars.one.counter=1 foo.bars.one.active=false foo.bars[two].id=IdOfBarWithKeyTwo public class Foo { private Map&lt;String, Bar&gt; bars = new HashMap&lt;&gt;(); public Map&lt;String, Bar&gt; getBars() { .... } } https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-Configuration-Binding
score: 4
downvote count: 3
type: Answer
answers question: http://stackoverflow.com/q/24917194
has comment: http://stackoverflow.com/comment/96572173
has comment: http://stackoverflow.com/comment/64331435
upvote count: 7

http://stackoverflow.com/comment/38931247
type: Comment
score: 1
comment on: http://stackoverflow.com/q/25032361
has text: Looks like the class wich is stored in file is not the same as your `User` class. Are you sure that the class in dat file is a user object?
type: QuestionComment

http://stackoverflow.com/q/24968386
type: Question
upvote count: 3
answer count: 1
tagged with: generics
favorite count: 0
has body: I am not understanding the difference between getGenericExceptionTypes and getExceptionTypes methods in Method class of Reflection API,especially the use of former one when creating generic Exceptions is not allowed in java... For example, GenericException&lt;T&gt; extends Throwable{ /// NOT ALLOWED }
tagged with: exception
has answer: http://stackoverflow.com/a/24968424
accepted answer: http://stackoverflow.com/a/24968424
type: AnsweredQuestion
score: 3
downvote count: 0
tagged with: reflection
tagged with: java
has title: difference between getGenericExceptionTypes and getExceptionTypes

http://stackoverflow.com/comment/38762892
score: 0
type: Comment
type: QuestionComment
has text: You have to open the file for "append". Otherwise, any info already in the file will be erased.
comment on: http://stackoverflow.com/q/24942603

http://stackoverflow.com/a/25059145
downvote count: 0
score: 1
type: Answer
has body: From the docs : /user: The Guardian Actor The actor which is probably most interacted with is the parent of all user-created actors, the guardian named "/user". Actors created using system.actorOf() are children of this actor. This means that when this guardian terminates, all normal actors in the system will be shutdown, too. It also means that this guardian’s supervisor strategy determines how the top-level normal actors are supervised. Since Akka 2.1 it is possible to configure this using the setting akka.actor.guardian-supervisor-strategy, which takes the fully-qualified class-name of a SupervisorStrategyConfigurator. When the guardian escalates a failure, the root guardian’s response will be to terminate the guardian, which in effect will shut down the whole actor system. Your master is the top level actor in your application therefore he is a child of the user guardian, so he'll be restarted automatically because supervision for the Guardian is defaulting to : final val defaultDecider: Decider = { case _: ActorInitializationException ⇒ Stop case _: ActorKilledException ⇒ Stop case _: DeathPactException ⇒ Stop case _: Exception ⇒ Restart }
answers question: http://stackoverflow.com/q/25056195
upvote count: 1
has comment: http://stackoverflow.com/comment/39016929
has comment: http://stackoverflow.com/comment/39016594

http://stackoverflow.com/q/25032659
tagged with: methods
type: Question
has comment: http://stackoverflow.com/comment/38931897
possible better answer: http://stackoverflow.com/a/25032711
has answer: http://stackoverflow.com/a/25032711
tagged with: inheritance
has answer: http://stackoverflow.com/a/25032750
has comment: http://stackoverflow.com/comment/38931835
score: 0
has comment: http://stackoverflow.com/comment/38931737
has answer: http://stackoverflow.com/a/25032715
favorite count: 0
has answer: http://stackoverflow.com/a/25032762
answer count: 5
has answer: http://stackoverflow.com/a/25032845
accepted answer: http://stackoverflow.com/a/25032750
has comment: http://stackoverflow.com/comment/38932524
has comment: http://stackoverflow.com/comment/38931927
has title: Why I cannot access Child Object method with Parent Type
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38932063
has body: object a2 is of type A but references an object of class C. So, a2 should be able to access m3(). But, why is it not happening? If m3() method had been defined in class A, then the code would run fine class A { int var = 7; void m1() { System.out.println("A's m1 ,"); } void m2() { System.out.println("A's m2 ,"); } } class B extends A { void m1() { System.out.println("B's m1 ,"); } } class C extends B { void m3() { System.out.println("c's m3 ," + (var + 6)); } } class Mixed { public static void main(String[] args) { A a = new A(); B b = new B(); C c = new C(); A a2 = new C(); a2.m1(); a2.m2(); a2.m3(); } }
upvote count: 2
tagged with: java
downvote count: 2

http://stackoverflow.com/a/25123559
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/39104879
accepted answer of: http://stackoverflow.com/q/25060027
type: Answer
answers question: http://stackoverflow.com/q/25060027
score: 3
upvote count: 3
has body: Two issues here: The query method declaration is invalid as it needs to carry an @Modifying annotation to correctly execute the query. The method is not exported by Spring Data REST as it's generally hard to reason about the correct HTTP method to use for the exposure. The current way of exposing the method is to plug in a manually implemented controller that gets the repository injected and manually invokes the method.
has comment: http://stackoverflow.com/comment/39105837

http://stackoverflow.com/comment/38736337
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24928313
has text: How do you expect the client to "know" what arguments to pass for a new service? You're building a Facade, but are you only hiding the easy bit? That is: where the new service is, not what arguments it takes.

http://stackoverflow.com/q/25038908
has title: How to @Inject fastxml.jackson.ObjectMapper into JAX-RS Resource?
tagged with: java
score: 4
upvote count: 4
has body: I'm trying to inject an instance of the ObjectMapper class into my JAX-RS Resource, but I am seeing this error, [ERROR ] Api type [com.fasterxml.jackson.databind.ObjectMapper] is not found with the qualifiers Qualifiers: [@javax.enterprise.inject.Default()] for injection into Field Injection Point, field name : mapper, Bean Owner : [PageMetaResource, Name:null, WebBeans Type:MANAGED, API Types:[com.lmig.pi.ado.meta.resources.PageMetaResource], Qualifiers:[javax.enterprise.inject.Any,javax.enterprise.inject.Default]] I have an empty beans.xml file in the WEB-INF directory, &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;beans xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/beans_1_0.xsd"&gt; &lt;/beans&gt; I'm wondering if my Application.getSingletons() method is causing the issue, @Override public Set&lt;Object&gt; getSingletons() { Set&lt;Object&gt; set = new HashSet&lt;&gt;(); DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"); ObjectMapper mapper = new ObjectMapper(); mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); mapper.setSerializationInclusion(JsonInclude.Include.NON_DEFAULT); mapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false); mapper.configure(SerializationFeature.WRITE_EMPTY_JSON_ARRAYS, false); mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); mapper.setDateFormat(df); JacksonJsonProvider provider = new JacksonJsonProvider(); provider.setMapper(mapper); set.add(provider); return set; } My resource class looks like this, public class PageMetaResource extends BasePresentationResource { /** * The logger of the class */ private static final Logger logger = Logger.getLogger(PageMetaResource.class); /** * Factory that produces a {@link PageMetaServices} instance for this resource. */ private ServiceFactory serviceFactory; /** * Factory that produce…
tagged with: websphere
answer count: 1
downvote count: 0
tagged with: jackson
favorite count: 0
tagged with: cdi
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25040559
type: Question

http://stackoverflow.com/comment/38936736
score: 1
has text: Correction: `Number` is not `Comparable`... could try `toLongValue` though. Reason it does not work is just <, +, etc. is defined only for primitives. For Long, autounboxing works.
comment on: http://stackoverflow.com/q/25035413
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38803353
type: QuestionComment
comment on: http://stackoverflow.com/q/24964242
type: Comment
has text: http://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html
score: 0

http://stackoverflow.com/q/25041253
upvote count: 2
answer count: 2
tagged with: file-io
has comment: http://stackoverflow.com/comment/38947870
favorite count: 0
downvote count: 5
has comment: http://stackoverflow.com/comment/38968048
type: UnansweredQuestion
score: -3
has answer: http://stackoverflow.com/a/25041533
has answer: http://stackoverflow.com/a/25041328
has title: Error while reading a data from a file
tagged with: java
has comment: http://stackoverflow.com/comment/38948418
type: Question
tagged with: bufferedreader
has body: I am using below program to read a data from a file. I am getting false when i try to validate the existence of file.File is present though import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; public class BufferedReaderExample { public static void main(String[] args) { BufferedReader br = null; try { String sCurrentLine; br = new BufferedReader(new FileReader("H:\\infilename.txt")); while ((sCurrentLine = br.readLine()) != null) { System.out.println(sCurrentLine); } } catch (IOException e) { e.printStackTrace(); } finally { try { if (br != null)br.close(); } catch (IOException ex) { ex.printStackTrace(); } } } } Getting below error java.io.FileNotFoundException: H:\infilename.txtt (The system cannot find the file specified) at java.io.FileInputStream.open(Native Method) at java.io.FileInputStream.&lt;init&gt;(Unknown Source) at java.io.FileInputStream.&lt;init&gt;(Unknown Source) at java.io.FileReader.&lt;init&gt;(Unknown Source) at BufferedReaderExample.main(BufferedReaderExample.java:15) I am always getting error when i try to read a file in my systems. I am using eclipse. It is not installed on my system. It is a standalone application.is that causing a problem here? PLease help me on this

http://stackoverflow.com/comment/38926764
type: QuestionComment
comment on: http://stackoverflow.com/q/25029785
has text: @alfasin's second suggestion isn't just a small thing (which I suspect he knows :) ). Your first loop is starting out on interpreted code (e.g. for `String.equals`) and then compiling and optimizing it as it goes. The second loop gets all of that benefit without having to do any of the work. Microbenchmarks like this are notoriously difficult in Java; I suggest you read up on the many pages out there that have been written on it (google "java microbenchmark").
score: 4
type: Comment

http://stackoverflow.com/a/25060706
has comment: http://stackoverflow.com/comment/38985445
has comment: http://stackoverflow.com/comment/38985028
accepted answer of: http://stackoverflow.com/q/25060651
has comment: http://stackoverflow.com/comment/38985310
answers question: http://stackoverflow.com/q/25060651
has comment: http://stackoverflow.com/comment/38985934
type: AcceptedAnswer
downvote count: 0
score: 6
type: Answer
upvote count: 6
has body: In the first case super refers to the constructor in the base class FilterInputStream. If the constructor of a parent class has argument, any class that extends it must explicitly call the appropriate constructor using super. If the base class simply has a no-argument constructor the super is supplied implicitly by Java. In the second case, FilterInputStream read method has been overloaded by LowerCaseInputStream. This means that any call to LowerCaseInputStream.read() would go to its implementation. So for LowerCaseInputStream to call the read implementation in FilterInputStream (to get the standard behavior) it must reference super otherwise it would be an infinite loop.

http://stackoverflow.com/q/25026185
possible better answer: http://stackoverflow.com/a/32305649
tagged with: parse-platform
has answer: http://stackoverflow.com/a/32305649
type: AnsweredQuestion
upvote count: 9
has answer: http://stackoverflow.com/a/25027937
tagged with: java
has comment: http://stackoverflow.com/comment/38920086
score: 9
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/38920115
has title: How to know when Parse.initialize() has already been called?
downvote count: 0
has comment: http://stackoverflow.com/comment/38920617
favorite count: 0
accepted answer: http://stackoverflow.com/a/25027937
has body: Right now I am using a static boolean to tell when the initialization has occurred. Is there an easier way to know that I have already called initialize? Thank you!!! SOLVED!!!! Thank you so much for your comments. You need to initialize parse in a class that extends an application, and then add it to the manifest file as an application (not an other activity). :) This is my class to use Parse: package com.example.myapp; import com.parse.Parse; import android.app.Application; public class UseParse extends Application { @Override public void onCreate() { super.onCreate(); Parse.initialize(this, "id", "key"); } } This is my android manifest file <?xml version="1.0" encoding="utf-8"?> <uses-sdk android:minSdkVersion="11" android:targetSdkVersion="14"/> <supports-screens android:smallScreens="true" android:normalScreens="true" android:largeScreens="true" android:xlargeScreens="true" android:anyDensity="true"/> <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.INTERNET" /> <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-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> <uses-permission android:name="android.permission.CALL_PHONE" android:required="false" /> <permission android:protectionLevel="signature" android:name="com.example.myapp.permission.C2D_MESSAGE" /> <uses-permission android:name="com.example.myapp.permission.C2D_MESSAGE" /> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> //... more <service android:name="com.parse.PushService" /> <action …

jboss5.x
tag name: jboss5.x
tags question: http://stackoverflow.com/q/24913398
tags question: http://stackoverflow.com/q/25032644
type: Tag

http://stackoverflow.com/q/24910286
has body: I'm facing a problem when integrating a third party web service. I receive the following error: [ERROR] Failed to execute goal org.apache.cxf:cxf-codegen-plugin:2.4.2:wsdl2java (generate-sources) on project pcm_portal: Thrown by JAXB: 'string15' is already defined at line 305 column 2 of schema ... -> [Help 1] Actually I understand the error, this file contains severall schemas for the same target namespace and we can find the same simpleType (string15) defined in both schemas. It's something like this: <xsd:schema elementFormDefault="qualified" attributeFormDefault="unqualified" targetNamespace="http://myNs/" xmlns:xsdLocal3="http://myNs/"> <xsd:simpleType name="string15"> <xsd:restriction base="xsd:string"> <xsd:maxLength value="15"></xsd:maxLength> </xsd:restriction> </xsd:simpleType> </xsd:schema> <xsd:schema elementFormDefault="qualified" attributeFormDefault="unqualified" targetNamespace="http://myNs/" xmlns:xsdLocal3="http://myNs/"> <xsd:simpleType name="string15"> <xsd:restriction base="xsd:string"> <xsd:maxLength value="15"></xsd:maxLength> </xsd:restriction> </xsd:simpleType> </xsd:schema> My question is 1) is there a way to allow wsdl2java to deal with such a file? Today I'm using it via maven cxf-codegen-plugin and it is configured with this: -exsh true -xjc-npa 2) If not does anybody knows a reference document that could be an argument for me since the team that gave me the wsdl say that there is no problem (indeed SoapUI makes no trouble with this WSDL)?
has comment: http://stackoverflow.com/comment/65836480
has comment: http://stackoverflow.com/comment/64929232
score: 2
upvote count: 2
tagged with: cxf
tagged with: java
tagged with: web-services
tagged with: wsdl2java
type: Question
has comment: http://stackoverflow.com/comment/38703378
linked to: http://stackoverflow.com/q/6681265
has comment: http://stackoverflow.com/comment/38705735
has answer: http://stackoverflow.com/a/25039297
has title: wsdl with duplicate type definitions on the same target namespace
answer count: 1
downvote count: 0
favorite count: 0
type: UnansweredQuestion
tagged with: maven

http://stackoverflow.com/q/24919152
has comment: http://stackoverflow.com/comment/38718690
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/24919265
downvote count: 0
has body: I am making a download manager and I want multiple threads downloading different segments of file to write to file at different places at a time. Just for every one's clarification I dont want file to lock because it will kill the purpose of different threads writing at a time. I am using Apache HttpClient library and FileChannel transferFrom(). Current code only downloads the first segment and simply ignores other segments. Code Explanation: The startDownload method creates a new file and checks if link support partial content, If it does it starts threads for each segment otherwise a single thread will download the whole file.The getFileName is function for extracting file name from URI. The Download method contains the code which actually downloads the file using HttpClient and then writes it using transferFrom. public void startDownload() { Thread thread = new Thread(() -&gt; { try { String downloadDirectory = "/home/muhammad/"; URI uri = new URI("http://94.23.204.158/JDownloader.zip"); int segments = 2; // Create a HttpClient for checking file for segmentation. CloseableHttpClient Checkingclient = HttpClients.createDefault(); // get request for checking size of file. HttpGet checkingGet = new HttpGet(uri); CloseableHttpResponse checkingResponse = Checkingclient.execute(checkingGet); long sizeofFile = checkingResponse.getEntity().getContentLength(); // Create a new file in downloadDirectory with name extracted from uri. File file = new File(downloadDirectory + getFileName(uri)); if (!file.exists()) { file.createNewFile(); } // set range header for checking server support for partial content. checkingGet.setHeader("Range", "bytes=" + 0 + "-" + 1); checkingResponse = Checkingclient.execute(checkingGet); // Check if response code is 206 (partial content response code). if (checkingResponse.getStatusLine().getStatusCode() == 206) { //find size of each segment. final long sizeOfEachSegment = sizeofFile / segments; //Download each segment independently. for (int i = 0…
favorite count: 0
tagged with: filechannel
accepted answer: http://stackoverflow.com/a/24920279
tagged with: apache-httpclient-4.x
possible better answer: http://stackoverflow.com/a/24919265
tagged with: multithreading
upvote count: 1
has answer: http://stackoverflow.com/a/24920279
type: AnsweredQuestion
has title: write from multiple threads on same file without locking, Java
score: 1
has comment: http://stackoverflow.com/comment/38718995
tagged with: java

akka
type: Tag
tags question: http://stackoverflow.com/q/25056195
tags question: http://stackoverflow.com/q/25057854
tags question: http://stackoverflow.com/q/24964198
tags question: http://stackoverflow.com/q/24987616
tags question: http://stackoverflow.com/q/24909459
tags question: http://stackoverflow.com/q/25014416
tag name: akka
tags question: http://stackoverflow.com/q/25021848
tags question: http://stackoverflow.com/q/25007778
tags question: http://stackoverflow.com/q/24947266
tags question: http://stackoverflow.com/q/24923050

http://stackoverflow.com/comment/38748252
has text: no just how to import the classes that I've downloaded into eclipse and use it
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24934752

arraylist
tags question: http://stackoverflow.com/q/24922856
tags question: http://stackoverflow.com/q/24995141
tags question: http://stackoverflow.com/q/24960513
tags question: http://stackoverflow.com/q/25016040
tags question: http://stackoverflow.com/q/25012033
tags question: http://stackoverflow.com/q/24966678
tags question: http://stackoverflow.com/q/24984787
tags question: http://stackoverflow.com/q/25064864
tags question: http://stackoverflow.com/q/24981371
tags question: http://stackoverflow.com/q/24947133
tags question: http://stackoverflow.com/q/24994544
tags question: http://stackoverflow.com/q/24987345
tags question: http://stackoverflow.com/q/24939766
tags question: http://stackoverflow.com/q/24921687
tags question: http://stackoverflow.com/q/25022987
tags question: http://stackoverflow.com/q/25038889
tags question: http://stackoverflow.com/q/24947750
tags question: http://stackoverflow.com/q/24922011
tags question: http://stackoverflow.com/q/24989280
tags question: http://stackoverflow.com/q/24916558
tags question: http://stackoverflow.com/q/24932977
tags question: http://stackoverflow.com/q/25044726
tags question: http://stackoverflow.com/q/25038143
tags question: http://stackoverflow.com/q/25018513
tags question: http://stackoverflow.com/q/25058351
tags question: http://stackoverflow.com/q/25031880
tags question: http://stackoverflow.com/q/24943663
tags question: http://stackoverflow.com/q/24944678
tags question: http://stackoverflow.com/q/24975286
tags question: http://stackoverflow.com/q/24994511
tags question: http://stackoverflow.com/q/25062763
tags question: http://stackoverflow.com/q/25001011
tags question: http://stackoverflow.com/q/25032813
tags question: http://stackoverflow.com/q/24981649
tags question: http://stackoverflow.com/q/24953353
tags question: http://stackoverflow.com/q/24998544
tags question: http://stackoverflow.com/q/25026935
tags question: http://stackoverflow.com/q/25002788
tags question: http://stackoverflow.com/q/25019322
tags question: http://stackoverflow.com/q/24992946
tags question: http://stackoverflow.com/q/25021054
tags question: http://stackoverflow.com/q/24917931
tags question: http://stackoverflow.com/q/25015803
tags question: http://stackoverflow.com/q/24981188
tags question: http://stackoverflow.com/q/24973059
tags question: http://stackoverflow.com/q/25007085
tags question: http://stackoverflow.com/q/25016930
tags question: http://stackoverflow.com/q/25053439
tags question: http://stackoverflow.com/q/24986748
tags question: http://stackoverflow.com/q/25025524
tags question: http://stackoverflow.com/q/25044836
tags question: http://stackoverflow.com/q/24934782
tags question: http://stackoverflow.com/q/24995332
tags question: http://stackoverflow.com/q/24992894
tags question: http://stackoverflow.com/q/25013119
tags question: http://stackoverflow.com/q/24930545
tags question: http://stackoverflow.com/q/25057117
tags question: http://stackoverflow.com/q/24973394
tags question: http://stackoverflow.com/q/24912168
tags question: http://stackoverflow.com/q/25012524
tags question: http://stackoverflow.com/q/25011984
tags question: http://stackoverflow.com/q/25049921
tags question: http://stackoverflow.com/q/24957813
tags question: http://stackoverflow.com/q/25030039
type: Tag
tags question: http://stackoverflow.com/q/24948817
tags question: http://stackoverflow.com/q/24934697
tags question: http://stackoverflow.com/q/25047821
tag name: arraylist
tags question: http://stackoverflow.com/q/25045844
tags question: http://stackoverflow.com/q/24947467
tags question: http://stackoverflow.com/q/25032577
tags question: http://stackoverflow.com/q/24988232

http://stackoverflow.com/q/25001860
has comment: http://stackoverflow.com/comment/38873967
downvote count: 1
type: Question
score: -1
has title: binary search tree generator
has answer: http://stackoverflow.com/a/25002076
answer count: 2
has comment: http://stackoverflow.com/comment/38873802
has comment: http://stackoverflow.com/comment/38873866
upvote count: 0
has comment: http://stackoverflow.com/comment/38874086
favorite count: 0
tagged with: binary-search-tree
has comment: http://stackoverflow.com/comment/38873917
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25002058
has comment: http://stackoverflow.com/comment/38873782
tagged with: tree
has body: I attempted to build a binary search tree builder method. However I think I am missing something. I tested my method with inOrderPrint method and a treeHeigh method. How my method works is that a root node is the first parameter. The second parameter is another TreeNode node. This parameter is a TreeNode and the method should rearrange itself to a binary search tree. My inOrderPrint is giving me the correct printing which leads me to assume that my buildBST is working. However my treeHeight method is not giving me the correct output. I'm pretty sure my inOrderPrint and treeHeight methods are correctly created. I believe there is some logic I am missing in my buildBST method but I cant seem to tell what it is. I have root set as 14. If I put TreeNodes with values 5,10,3,20,50,25,40,1,2, 18, 100,101, I get a sorted output of those numbers but with treeHeight, I get an output of 5 when I should be expecting 7. Could someone tell me where I went wrong? Binary Search Tree generator code: public static void buildBST(TreeNode root, TreeNode node) { if (root == null) { node = root; } else { // less than root if (node.data &lt; root.data) { if (root.left == null) { root.left = node; } else { buildBST(root.left, node); } } // greater than root if (node.data &gt;= root.data) { if (root.right == null) { root.right = node; } else { buildBST(root.right, node); } } } } inOrderPrint: public static void inOrderPrint(TreeNode node) { if (node == null) { return; } else { inOrderPrint(node.left); System.out.println(node.data); inOrderPrint(node.right); } } treeHeight: public static int treeHeight(TreeNode node) { if (node == null) { return 0; } else { int Ldepth = treeHeight(node.left); int Rdepth = treeHeight(node.right); return Math.max(Ldepth, Rdepth) + 1; } }
has comment: http://stackoverflow.com/comment/38873695
tagged with: java

http://stackoverflow.com/comment/38753027
type: AnswerComment
score: 0
has text: @DeepanshuBedi Yes, it will.
type: Comment
comment on: http://stackoverflow.com/a/24937584

http://stackoverflow.com/q/25041529
linked to: http://stackoverflow.com/q/25472013
has comment: http://stackoverflow.com/comment/38949227
has comment: http://stackoverflow.com/comment/38973826
has comment: http://stackoverflow.com/comment/38949345
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/38948498
possible better answer: http://stackoverflow.com/a/39320808
has answer: http://stackoverflow.com/a/39320808
has answer: http://stackoverflow.com/a/25057215
has comment: http://stackoverflow.com/comment/38948915
answer count: 2
downvote count: 0
linked to: http://stackoverflow.com/q/1203652
favorite count: 0
tagged with: python
accepted answer: http://stackoverflow.com/a/25057215
has title: How to run the Python interpreter and get its output using Java?
has body: Is it possible to get console output from Python using Java? Here is an example of such output: Python 3.3.4 (v3.3.4:7ff62415e426, Feb 10 2014, 18:13:51) [MSC v.1600 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information. &gt;&gt;&gt; 2+2 4 &gt;&gt;&gt; Now, the main goal is to get the above output by calling Python interpreter using Java. Here's my attempt: //... //Irrelevant code omitted ProcessBuilder processBuilder = new ProcessBuilder("cmd"); processBuilder.redirectErrorStream(true); processBuilder.start(); processBuilder.command("python2"); Process pythonProcess = processBuilder.start(); OutputStream outputStream = pythonProcess.getOutputStream(); OutputStreamWriter osw = new OutputStreamWriter(outputStream); osw.write("2+2\r\nquit()\r\n"); osw.flush(); osw.close(); InputStream inputStream = pythonProcess.getInputStream(); BufferedReader bufferedReader = new BufferedReader( new InputStreamReader(inputStream)); String line; while( (line=bufferedReader.readLine())!=null) { System.out.println(line); } //... //Irrelevant code omitted I understand that calling the start method spawns a new process with its environment for execution. Writing python2 to a process's output stream results in creating another process. This is when the problem starts. I haven't been able to find a way of sending the command 2+2 to the Python interpreter (which is the child process of CMD) instead of its parent process. To summarize: How do I run the Python interpreter, execute some commands inside it, and in the end, print the results to the standard output?
has comment: http://stackoverflow.com/comment/38948626
type: AnsweredQuestion
score: 3
linked to: http://stackoverflow.com/q/1401002
upvote count: 3

http://stackoverflow.com/comment/38873250
has text: So you're basically asking the SO community to test your code for you, and tell you what the bugs are? I don't think anyone really has the time to do that, but I might be wrong. If you could be specific about exactly what failed, then somebody would almost certainly be able to tell you why. But in its present form, I don't think you're going to get any answers to your question at all.
score: 0
comment on: http://stackoverflow.com/q/24983336
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24998524
tagged with: saaj
type: Question
has title: Error occured when call webService with SAAJ
tagged with: java
downvote count: 0
has comment: http://stackoverflow.com/comment/38868907
has body: Hy guys, I'm trying to implement a SOAP client using SAAJ, that return an attachment, but unfortunately I'm not able to parse the response because when I call the method soapConnection.call(message,url) I receive this error message stacktrace: Error occurred while sending SOAP Request to Server javax.xml.soap.SOAPException: java.io.IOException: Could not transmit message at org.jboss.ws.core.soap.SOAPConnectionImpl.callInternal(SOAPConnectionImpl.java:152) at org.jboss.ws.core.soap.SOAPConnectionImpl.call(SOAPConnectionImpl.java:64) at it.infocamere.leii.batch.test.SOAPClientSAAJ.main(SOAPClientSAAJ.java:31) Caused by: java.io.IOException: Could not transmit message at org.jboss.ws.core.client.HTTPRemotingConnection.invoke(HTTPRemotingConnection.java:267) at org.jboss.ws.core.client.SOAPProtocolConnectionHTTP.invoke(SOAPProtocolConnectionHTTP.java:71) at org.jboss.ws.core.soap.SOAPConnectionImpl.callInternal(SOAPConnectionImpl.java:143) ... 2 more Caused by: org.jboss.remoting.CannotConnectException: Can not connect http client invoker after 1 attempt(s) at org.jboss.remoting.transport.http.HTTPClientInvoker.makeInvocation(HTTPClientInvoker.java:271) at org.jboss.remoting.transport.http.HTTPClientInvoker.transport(HTTPClientInvoker.java:176) at org.jboss.remoting.MicroRemoteClientInvoker.invoke(MicroRemoteClientInvoker.java:169) at org.jboss.remoting.Client.invoke(Client.java:2070) at org.jboss.remoting.Client.invoke(Client.java:879) at org.jboss.ws.core.client.HTTPRemotingConnection.invoke(HTTPRemotingConnection.java:246) ... 4 more Caused by: org.jboss.ws.WSException: Failed to inline XOP data at org.jboss.ws.extensions.xop.XOPContext.replaceXOPInclude(XOPContext.java:342) at org.jboss.ws.extensions.xop.XOPContext.inlineXOPData(XOPContext.java:165) at org.jboss.ws.core.soap.SOAPFactoryImpl.createElement(SOAPFactoryImpl.java:143) at org.jboss.ws.core.soap.SOAPFactoryImpl.createElement(SOAPFactoryImpl.java:106) at org.jboss.ws.core.soap.EnvelopeBuilderDOM.buildBodyE…
favorite count: 0
tagged with: soapui
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38889758
tagged with: soap
has comment: http://stackoverflow.com/comment/38889818
linked to: http://stackoverflow.com/q/15948927
answer count: 0
score: 1
has comment: http://stackoverflow.com/comment/38889896
upvote count: 1
tagged with: web-services

exception
tags question: http://stackoverflow.com/q/25048405
tags question: http://stackoverflow.com/q/24972005
tags question: http://stackoverflow.com/q/24991859
tags question: http://stackoverflow.com/q/24990185
tags question: http://stackoverflow.com/q/24970914
tags question: http://stackoverflow.com/q/24988491
tags question: http://stackoverflow.com/q/24990836
tags question: http://stackoverflow.com/q/24970373
tags question: http://stackoverflow.com/q/24983887
tags question: http://stackoverflow.com/q/25063894
tags question: http://stackoverflow.com/q/25015803
tags question: http://stackoverflow.com/q/24953201
type: Tag
tags question: http://stackoverflow.com/q/25042896
tags question: http://stackoverflow.com/q/24980476
tags question: http://stackoverflow.com/q/24981736
tags question: http://stackoverflow.com/q/24926348
tags question: http://stackoverflow.com/q/24912567
tags question: http://stackoverflow.com/q/24973714
tags question: http://stackoverflow.com/q/24929147
tags question: http://stackoverflow.com/q/25000695
tags question: http://stackoverflow.com/q/24954266
tags question: http://stackoverflow.com/q/25022657
tags question: http://stackoverflow.com/q/24911472
tags question: http://stackoverflow.com/q/25054095
tags question: http://stackoverflow.com/q/24987451
tags question: http://stackoverflow.com/q/25010143
tags question: http://stackoverflow.com/q/25018095
tags question: http://stackoverflow.com/q/25002802
tags question: http://stackoverflow.com/q/25024506
tags question: http://stackoverflow.com/q/24992128
tags question: http://stackoverflow.com/q/24968386
tags question: http://stackoverflow.com/q/24968959
tags question: http://stackoverflow.com/q/24977174
tags question: http://stackoverflow.com/q/24939084
tags question: http://stackoverflow.com/q/25018473
tag name: exception
tags question: http://stackoverflow.com/q/24969016
tags question: http://stackoverflow.com/q/24912099
tags question: http://stackoverflow.com/q/24938327
tags question: http://stackoverflow.com/q/24947229
tags question: http://stackoverflow.com/q/24926166
tags question: http://stackoverflow.com/q/25004905
tags question: http://stackoverflow.com/q/24980651
tags question: http://stackoverflow.com/q/25059006
tags question: http://stackoverflow.com/q/25005112
tags question: http://stackoverflow.com/q/25027249

http://stackoverflow.com/a/24949320
type: Answer
has comment: http://stackoverflow.com/comment/38776429
answers question: http://stackoverflow.com/q/24949012
has body: i dont see a problem why you wouldnt be able to create a search on this adapter. you will just have to create a method like filer(String searchValue) which does the searching, by removing invalid results from the list of results. In your case float[] result_arr; Im not exactly sure why you would want to make a list with just floats in it, but anyway thats the way i would go. And as Raghunandan already pointed out, you should add a searchview to the actionbar, and attach a textlistener onto it. now you can either wait for "enter" to start your search, or even do a live search on every new letter.
score: 0

http://stackoverflow.com/a/25036072
accepted answer of: http://stackoverflow.com/q/25036021
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/38937938
type: Answer
upvote count: 3
has body: Yes. You can cast Child to a Parent since every Child is Parent. That's the beauty of OOP.
score: 3
answers question: http://stackoverflow.com/q/25036021

http://stackoverflow.com/comment/39276786
score: 0
type: AnswerComment
has text: I must say that I hibernate often and I'm suspicious that there could be cache or memory address corruption during hibernation/sleep/awake transition cycling, but I have done a few hard reboots and the new condition sometimes occurs after a fresh boot (with no invocation of Netbeans)... However, since my main issue has been worked around, I'll mark your advise as solving my main issue (unless you have more to add). Thank you, Daniel!
type: Comment
comment on: http://stackoverflow.com/a/25067935

http://stackoverflow.com/a/25015071
has comment: http://stackoverflow.com/comment/38901332
has body: Because you are rounding each account if you want a total that is equal to the sum of the accounts you will have to compute the total using the rounded values for the accounts.
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/25014727
has comment: http://stackoverflow.com/comment/38900295
accepted answer of: http://stackoverflow.com/q/25014727
downvote count: 0
has comment: http://stackoverflow.com/comment/38899553
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38900065
has comment: http://stackoverflow.com/comment/38899668
type: Answer

http://stackoverflow.com/comment/38926734
score: 0
comment on: http://stackoverflow.com/q/25029668
type: Comment
type: QuestionComment
has text: The connection object has a method "getMetaData()" which can give you the information you want. It might do what you want.

http://stackoverflow.com/a/79445456
type: Answer
has body: I had to properly define the classpath classpath = sourceSets.main.runtimeClasspath mainClass = 'com.xxxx.xxxx.xxxx'
score: 0
answers question: http://stackoverflow.com/q/24924932

http://stackoverflow.com/comment/38837731
type: QuestionComment
type: Comment
has text: @bjlee72 As I said the String,String generic parameters are the given format the database doesnt allow it in a different way.
comment on: http://stackoverflow.com/q/24982487
score: 0

http://stackoverflow.com/comment/76440631
type: Comment
score: 8
has text: One could simply use `for(String theKey : queryParameters.keySet()) { ... }` instead of working directly with `Iterator`.
type: AnswerComment
comment on: http://stackoverflow.com/a/24991536

http://stackoverflow.com/comment/38992511
comment on: http://stackoverflow.com/a/25060398
has text: Yes, it makes sense. Probably slower, as it constructs a new string. But only testing.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/74530590
has text: i am getting this error Error executing action `run` on resource 'execute[run app.jar in directory]'
score: 0
comment on: http://stackoverflow.com/a/25068888
type: AnswerComment
type: Comment

http://stackoverflow.com/a/24923217
has comment: http://stackoverflow.com/comment/38750349
has body: Well you could make a class that stores the shape of the different entities and has methods for finding overlapping shapes. My answer is very broad, but this would be the best solution if what you are looking for is realistic collision detection. Circles or rectangles work as well but are far less realistic** ** Depends on your physics. If it is only a side scroller then it may not be as big a deal... UPDATE: By Shapes I am referring to an Object with Vertices, not a pixel-precision image of your entity!!!!! Example EntityShape class: public class YourEntityShape{ private Point p1, p2, p3, p4, p5, p6; public YourEntityShape(Point p1, Poin...... etc.){ this.p1 = p1; this.p2 = p2; //etc.... } //Getter for private Points public Point getP1(){ return p1; } //etc.. public boolean overlaps(OtherEntityShape s){ //Your collision detection code... } } As suggested by user 1337, you could use float[] arrays to store the x and y values. example: float[] x; float[] y; Then you can populate them with the corresponding x and y values of the points.
has comment: http://stackoverflow.com/comment/38749718
has comment: http://stackoverflow.com/comment/38749958
has comment: http://stackoverflow.com/comment/38750028
type: Answer
has comment: http://stackoverflow.com/comment/38751002
has comment: http://stackoverflow.com/comment/38750434
has comment: http://stackoverflow.com/comment/38750535
has comment: http://stackoverflow.com/comment/38727673
score: 0
answers question: http://stackoverflow.com/q/24922458
has comment: http://stackoverflow.com/comment/38750648
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24922458

bukkit
tag name: bukkit
tags question: http://stackoverflow.com/q/24917153
tags question: http://stackoverflow.com/q/24962864
tags question: http://stackoverflow.com/q/25051431
tags question: http://stackoverflow.com/q/25046960
tags question: http://stackoverflow.com/q/24929852
tags question: http://stackoverflow.com/q/24970526
tags question: http://stackoverflow.com/q/25048182
tags question: http://stackoverflow.com/q/24910684
tags question: http://stackoverflow.com/q/24930599
tags question: http://stackoverflow.com/q/24979579
tags question: http://stackoverflow.com/q/24928054
type: Tag
tags question: http://stackoverflow.com/q/25019433
tags question: http://stackoverflow.com/q/24980635
tags question: http://stackoverflow.com/q/25041119
tags question: http://stackoverflow.com/q/24917112

http://stackoverflow.com/a/25030319
score: 1
has comment: http://stackoverflow.com/comment/38928711
has body: The issue is that Runtime.exec() does not understand shell concepts such as "|". Try this: public static void printCustomCommand(){ String[] pids = {"pidof java"}; String s; try { Process pidProcess = Runtime.getRuntime().exec("/bin/bash -c pidof java"); BufferedReader br = new BufferedReader(new InputStreamReader(pidProcess.getInputStream())); pids = br.readLine().split(" "); for (String pid : pids){ String cmd = "/bin/bash -c lsof -p " + pid + " | grep jar &gt;&gt; /somepath/mydumpfile"; Process p; p = Runtime.getRuntime().exec(cmd); BufferedReader reader = new BufferedReader(new InputStreamReader(p.getInputStream())); String line = ""; while((line = reader.readLine()) != null) { System.out.print(line + "\n"); } p.waitFor(); } //pids = new String(bo).split(" "); } catch (IOException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } The problem is that exec runs a binary directly without invoking the shell. The "|" character is only recognized by the shell. The "-c" tells the shell to run a single command, and passes the entire command as the single argument.
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/38933372
has comment: http://stackoverflow.com/comment/38928691
upvote count: 1
accepted answer of: http://stackoverflow.com/q/25030212
answers question: http://stackoverflow.com/q/25030212

http://stackoverflow.com/q/24962521
tagged with: list
tagged with: java
has answer: http://stackoverflow.com/a/24962629
score: -1
has comment: http://stackoverflow.com/comment/38800133
type: Question
linked to: http://stackoverflow.com/q/3836621
has body: If there is an array or list that contains Foo objects, and I want to split the collection based on the property Foo.bar, is there a quick way to do it in Java besides using a map and traversing the collection? For example, say the list looks like: Foo.bar = 1 Foo.bar = 1 Foo.bar = 2 Foo.bar = 3 Foo.bar = 3 Foo.bar = 4 The list will be split into 4 different lists because there are 4 distinct values of bar.
upvote count: 0
tagged with: arrays
has comment: http://stackoverflow.com/comment/38800121
has title: In Java, how to split an array or list by some property or value?
linked to: http://stackoverflow.com/q/2921003
answer count: 1
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38802418
tagged with: collections
downvote count: 1
has comment: http://stackoverflow.com/comment/38800003

http://stackoverflow.com/a/24962596
type: Answer
has comment: http://stackoverflow.com/comment/38801821
accepted answer of: http://stackoverflow.com/q/24962479
score: 1
answers question: http://stackoverflow.com/q/24962479
has body: In the future, please post more lines of the Log so that we can see the exact line where the error occurred. It should show that further down in Logcat, and that will help you immensely to solve these problems yourself. The problem is most likely that you are trying to find Views in your layout before you have inflated them, and you are calling methods on these objects. In these lines: EditText input = (EditText)findViewById(R.id.inputField); int inputs = Integer.parseInt(input.getText().toString()); You are trying to find input and call getText() on it, but input will be null at this point. You must do this after you call setContentView(layout) in onCreate(). Move all of your View initialization and method calls into onCreate() AFTER setContentView(). EDIT: After the new log that you posted, I can see that it is crashing in findViewById. That is because you are calling findViewById as soon as the class is instantiated in these two lines: Button calc = (Button)findViewById(R.id.convert); Button clear = (Button)findViewById(R.id.clear); You have to do this only after setContentView has executed in onCreate().
upvote count: 1
has comment: http://stackoverflow.com/comment/38802680
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/38804438

http://stackoverflow.com/comment/38897328
type: QuestionComment
has text: there is another relevant question: http://stackoverflow.com/questions/11547082/fastest-way-to-scan-ports-with-java
type: Comment
comment on: http://stackoverflow.com/q/25000930
score: 0

http://stackoverflow.com/a/25139672
upvote count: 2
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39134701
type: Answer
has comment: http://stackoverflow.com/comment/39134259
score: 2
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25037227
has body: Very interesting question, and unfortunately non-trivial... Here's what I've found: First of all, using JPEGImageWriteParam.setEncodeTables(...) won't do. From the JavaDoc: Sets the quantization and Huffman tables to use in encoding abbreviated streams. And further from JPEG Metadata Format Specification and Usage Notes: This ordering implements the design intention that tables should be included in JPEGImageWriteParams only as a means of specifying tables when no other source is available, and this can occur only when writing to an abbreviated stream without tables using known non-standard tables for compression. I.e., the param option can only be used for writing "abbreviated streams" (customs JPEGs without tables, assuming the tables will be provided when reading back). Conclusion: The only way we can specify tables to be encoded with the JPEG, is to pass it in the meta data. From the same document mentioned above, the tables in the metadata will be ignored and replaced unless compression mode is MODE_COPY_FROM_METADATA, so we need to specify that. See the Image Metadata DTD for documentation on the metadata structure. The important parts are the dqt and dht nodes with sub-nodes, and their "User object"s (not to be confused with normal DOM "userData"). We need to update these nodes, with the new tables we want to use. Here's the code I came up with: // Obtain qtables mQMatrix = ...; // Read source image ImageInputStream imageInputStream = ImageIO.createImageInputStream(...); ImageReader reader = ImageIO.getImageReaders(imageInputStream).next(); reader.setInput(imageInputStream); mSourceImage = reader.read(0); IIOMetadata metadata = null; // We need the imageWriter to create the default JPEG metadata ImageWriter imageWriter = ImageIO.getImageWritersByFormatName("JPEG").next(); if (mQMatrix != null) { dumpMatrices(mQMatrix); // Obtain default image metadata data, in native JPEG format metadata = imageWriter.getDefaultImageMetadata(ImageTypeSpecifier.createFromRende…
has comment: http://stackoverflow.com/comment/39214293
answers question: http://stackoverflow.com/q/25037227
has comment: http://stackoverflow.com/comment/39279318

http://stackoverflow.com/a/25010596
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25010460
answers question: http://stackoverflow.com/q/25010460
type: Answer
has body: The key is that you must add a MouseListener to the component which will report the click locations: Tutorial to implement MouseListner , which will tell you about the position.

http://stackoverflow.com/a/25007905
downvote count: 0
score: 1
upvote count: 1
has body: Try this String str1 = "hello"; String str2 = "HELLO"; if(str1.equalsIgnoreCase(str2)){ //YOUR LOGIc }
type: Answer
answers question: http://stackoverflow.com/q/25007883

http://stackoverflow.com/comment/38780753
score: 1
comment on: http://stackoverflow.com/a/24951765
type: AnswerComment
type: Comment
has text: The OP clearly knows what a `Comparator` is meant to do. He is seeking *specific* information about what kind of bug is present when the sort fails in a specific manner.

binary-tree
tag name: binary-tree
type: Tag
tags question: http://stackoverflow.com/q/25005165
tags question: http://stackoverflow.com/q/25023636
tags question: http://stackoverflow.com/q/25041675

http://stackoverflow.com/a/24962781
type: Answer
has body: From what you are describing, I think that when you move an Entity, you want to move all its children. Your recursion has no stopping condition, and probably causes a stack overflow. It also has a confusing name, setPos, which implies a simple setter, but that's not what it does. You should have different methods for each type of movevent. Ex : translate, rotate, etc... You should do something like this : // simple setter public void setPos(Vector3f pos) { this.pos = pos; } // translation movement public void translate(Vector3f delta) { // translate the current Entity setPos (getPos().add(delta)); // translate the children for (Entity child : children) child.translate (delta); }
has comment: http://stackoverflow.com/comment/38808440
has comment: http://stackoverflow.com/comment/38809230
score: 0
answers question: http://stackoverflow.com/q/24962555

http://stackoverflow.com/comment/38829610
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24978159
has text: Thumps Up for the help! :)

http://stackoverflow.com/comment/38977577
score: 0
type: AnswerComment
type: Comment
has text: I agree, that is why I suggest to build a local cache.
comment on: http://stackoverflow.com/a/25055428

http://stackoverflow.com/a/24976070
type: AcceptedAnswer
type: Answer
downvote count: 0
score: 6
accepted answer of: http://stackoverflow.com/q/24976037
answers question: http://stackoverflow.com/q/24976037
upvote count: 6
has body: The actual main method is somewhere else. For example, in the KarelRunner class. When java executes the program, it's actually executing the main method in the runner class. Your own run method is called from that runner code.

http://stackoverflow.com/a/34734684
upvote count: 190
has comment: http://stackoverflow.com/comment/60703081
has body: The Solution Worked: 1.Open the projects gradle.properties file in android studio 2.Added this line at end of file org.gradle.jvmargs=-Xmx1024m & Save the file 3.Close & reopen the project or just Clean and re-Build it
downvote count: 3
has comment: http://stackoverflow.com/comment/121650901
has comment: http://stackoverflow.com/comment/82656569
has comment: http://stackoverflow.com/comment/135242536
score: 187
type: Answer
has comment: http://stackoverflow.com/comment/72841772
answers question: http://stackoverflow.com/q/25009717

http://stackoverflow.com/q/24955368
has answer: http://stackoverflow.com/a/24955452
favorite count: 0
has body: I am trying to delete a folder and its files in C:\Program Files\folder\files. I am not the creator of the folder but I do have admin rights in this very machine I am executing my java code. I am getting IO Exception error stating that I do not have permission to do this operation. So i tried PosixFilePermission to set permission which didn't work either. I have heard there is a workaround using bat or bash command to give admin privilege and execute the batch before deleting the folder. Please let me know if I am doing something wrong or advise on the best workaround. Note: file.canWrite() didn't throw any exception while checking the write access. I am using JDK 1.7 String sourcefolder = "C:\Program Files\folder\files"; File file = new File(sourcefolder); try { if (!file.canWrite()) throw new IllegalArgumentException("Delete: write protected: " + sourcefolder); file.setWritable(true, false); //using PosixFilePermission to set file permissions 777 Set&lt;PosixFilePermission&gt; perms = new HashSet&lt;PosixFilePermission&gt;(); perms.add(PosixFilePermission.OTHERS_WRITE); Files.setPosixFilePermissions(Paths.get(sourcefolder), perms); //file.delete(); FileUtils.cleanDirectory(file); System.out.println("Deleted"); } catch (Exception e) { e.printStackTrace(); }
type: UnansweredQuestion
upvote count: 1
score: 1
tagged with: java
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/24955719
tagged with: batch-processing
downvote count: 0
has title: Unable to delete files in system dir using Java

http://stackoverflow.com/comment/38874409
type: Comment
comment on: http://stackoverflow.com/a/24992944
type: AnswerComment
has text: A sample about how to get the commit message for a given commit is now available in the jgit-cookbook at https://github.com/centic9/jgit-cookbook/blob/master/src/main/java/org/dstadler/jgit/api/GetCommitMessage.java
score: 0

http://stackoverflow.com/comment/38821365
has text: You're passing `num` to the `print` method, so that is how many are printed. `num` is not updated by the recursive call.
comment on: http://stackoverflow.com/q/24973572
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/38823476
score: 0
type: Comment
type: QuestionComment
has text: @ajb: good point. also `Class` is final, so my idea is completely impossible.
comment on: http://stackoverflow.com/q/24964675

http://stackoverflow.com/q/24955314
tagged with: java
has title: Printing objects in a 2-D array using deepToString
type: Question
tagged with: arrays
score: 0
tagged with: multidimensional-array
answer count: 1
has answer: http://stackoverflow.com/a/24955342
has body: I'm trying to write a Java application that will simulate football fixtures (in the style of the World Cup) and produce match reports and results randomly. Since I want to assign players to each team, I need teams to be objects rather than just strings. This is proving problematic as I'm struggling to print the full list of teams upon running the application. So far for the Team class I have: import java.util.Arrays; public class Team { public static Team Team1 = new Team(); public static Team Team2 = new Team(); public static Team Team3 = new Team(); ... public static Team Team16 = new Team(); public static Team[][] FullTeamList = { {Team1, Team2, Team3, Team4}, {Team5, Team6, Team7, Team8}, {Team9, Team10, Team11, Team12}, {Team13, Team14, Team15, Team16} }; public static void printFullTeamList(){ System.out.println(Arrays.deepToString(FullTeamList)); } } (At some point I will manually change the team names, that's why I chose not to use a loop to instantiate the teams) And the main method reads: import java.util.Arrays; public class Main { public static void main (String[] args){ Team.printFullTeamList(); } } Unfortunately when I run the program it returns: [[Team@25d35bf2, Team@57398044, Team@141d19, Team@28825459], [Team@4187a8e0, ... But if it's possible I'd like it to return: [[Team1, Team2, Team3, Team4, Team5, ... etc Any help would be greatly appreciated
type: UnansweredQuestion

http://stackoverflow.com/q/24958003
tagged with: touch
has title: Perform work in an on touch listener and then delegate it to the previous one
answer count: 1
downvote count: 0
tagged with: events
score: 1
favorite count: 0
tagged with: listener
has body: In a ListView item I want to set up a touch listener, generally speaking I just want to perform some actions and then again delegate the touch event to the previous touch listener. Something like: convertView.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { // do something else convertView.dispatchTouchEvent(event); return true; } }); does not work, since it leads to a StackOverflow. What can I do here?
type: UnansweredQuestion
tagged with: android
tagged with: java
has answer: http://stackoverflow.com/a/24958264
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/38791865

http://stackoverflow.com/q/24981264
answer count: 1
tagged with: ms-access
has answer: http://stackoverflow.com/a/24981652
has body: I have taken my school IT project home to finish and although I could connect to my database while at school, I cannot connect to it on my own computer. I changed the directory in the database class and I am almost 100% sure that the directory is correct. It always gives me this error: Driver successfully loaded Unable to connect: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified java.sql.SQLException: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified at sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6964) at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:7121) at sun.jdbc.odbc.JdbcOdbc.SQLDriverConnect(JdbcOdbc.java:3080) at sun.jdbc.odbc.JdbcOdbcConnection.initialize(JdbcOdbcConnection.java:323) at sun.jdbc.odbc.JdbcOdbcDriver.connect(JdbcOdbcDriver.java:174) at java.sql.DriverManager.getConnection(DriverManager.java:571) at java.sql.DriverManager.getConnection(DriverManager.java:233) at Database.(Database.java:35) at GUI.(GUI.java:33) at GUI$41.run(GUI.java:564) 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.r…
type: UnansweredQuestion
tagged with: java
type: Question
tagged with: database
score: 0
has title: Can't connect to MS access database

http://stackoverflow.com/comment/38817659
type: Comment
type: QuestionComment
has text: @mutt : I agree with you. Is there any solution for it?.How should it be approached. Possibly making it a bit slower would help.
comment on: http://stackoverflow.com/q/24957617
score: 0

http://stackoverflow.com/q/24971765
has answer: http://stackoverflow.com/a/24973265
accepted answer: http://stackoverflow.com/a/24973265
tagged with: java
score: -1
has comment: http://stackoverflow.com/comment/38817365
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/38823557
downvote count: 1
has answer: http://stackoverflow.com/a/24972102
favorite count: 0
has title: Java AES decrypt different results after saved and decrypted again
has comment: http://stackoverflow.com/comment/38817621
tagged with: aes
upvote count: 0
tagged with: encryption
has body: When i run the scrypt my first decrypted result is correct: brother crowd mean guy ancient demand society before perfection glare anger certain When i save the encryptedText,salt(for example to a database) and want to decrypt again i get this. �Ŝ�,&amp;6���;�m�an guy ancient demand society before perfection glare anger certain *Update I think the problem was the way i handled the data(salt and iv). Now im able to encrypt and save -encryptText, randomIV, randomSalt to a database and decrypt it with masterPassword without problems. Thanks for the help everyone you are great! *Edited code, i ended up with this solution import java.io.UnsupportedEncodingException; import java.security.InvalidAlgorithmParameterException; import java.security.InvalidKeyException; import java.security.NoSuchAlgorithmException; import java.security.SecureRandom; import java.security.spec.InvalidKeySpecException; import java.security.spec.InvalidParameterSpecException; import java.util.Random; import javax.crypto.BadPaddingException; import javax.crypto.Cipher; import javax.crypto.IllegalBlockSizeException; import javax.crypto.NoSuchPaddingException; import javax.crypto.SecretKey; import javax.crypto.SecretKeyFactory; import javax.crypto.spec.IvParameterSpec; import javax.crypto.spec.PBEKeySpec; import javax.crypto.spec.SecretKeySpec; import org.apache.commons.codec.binary.Base64; public class Aes { private static int pswdIterations = 65536; private static int keySize = 256; public static String encrypt(String plainText, String password, String salt, String initializationVector) throws NoSuchAlgorithmException, InvalidKeySpecException, NoSuchPaddingException, InvalidParameterSpecException, IllegalBlockSizeException, BadPaddingException, UnsupportedEncodingException, InvalidKeyException, InvalidAlgorithmParameterException { byte[] saltBytes = salt.getBytes("UTF-8"); byte[] ivBytes = initializationVector.getBytes("UTF-8"); // Derive the key, given password and salt. SecretKeyFactory factory = …
has comment: http://stackoverflow.com/comment/38817457
possible better answer: http://stackoverflow.com/a/24972102
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38818052

http://stackoverflow.com/q/25003005
has comment: http://stackoverflow.com/comment/38879573
has comment: http://stackoverflow.com/comment/38876238
has comment: http://stackoverflow.com/comment/38876425
has title: Why is there not a ZipInputStream that deflates?
upvote count: 2
has answer: http://stackoverflow.com/a/25003382
answer count: 1
downvote count: 1
tagged with: outputstream
favorite count: 0
has comment: http://stackoverflow.com/comment/38875993
tagged with: http://stackoverflow.com/tag/zip
has comment: http://stackoverflow.com/comment/38876356
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38876447
has comment: http://stackoverflow.com/comment/38876381
score: 1
tagged with: java
tagged with: inputstream
type: Question
has body: There is java.io.ZipInputStream that inflates and java.io.ZipOutputStreamthat deflates. But sometimes I don't want that. Sometimes when using third parties APIs that accept an InputStream, I want a ZipInputStream that deflates. Is there any reason I can't do this? &lt; /rant> The real (constructive) question: is there a good way to get the equivalent of deflating ZipInputStream (not requiring multithread pipe streams)? Yes, often one reads obtains a compressed stream from an uncompressed one. But that can be done the other way around! For example: read a File, ZIP compress it, and then upload it (as a stream) using the Apache HTTP client.
has comment: http://stackoverflow.com/comment/38876196

http://stackoverflow.com/comment/38813435
comment on: http://stackoverflow.com/a/24969393
score: 0
type: AnswerComment
type: Comment
has text: it show the same error , thanks for your answer dude^^

http://stackoverflow.com/comment/65973453
type: Comment
type: AnswerComment
has text: You can force python to run interactively by providing the `-i` flag, like `python -i ....`. It wouldn't work in the more general case of the question to which you linked, but it should work for this case.
comment on: http://stackoverflow.com/a/25057215
score: 0

http://stackoverflow.com/comment/38942546
type: Comment
comment on: http://stackoverflow.com/a/25030947
has text: sorry i didn't test it
score: 0
type: AnswerComment

http://stackoverflow.com/q/24949587
has answer: http://stackoverflow.com/a/24949675
has comment: http://stackoverflow.com/comment/38776756
tagged with: android
has body: @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_splash); new Handler().postDelayed(new Runnable() { /* * Showing splash screen with a timer. This will be useful when you * want to show case your app logo / company */ @Override public void run() { // This method will be executed once the timer is over // Start your app main activity Intent i = new Intent(SplashScreen.this, MainActivity.class); startActivity(i); // close this activity finish(); } }, SPLASH_TIME_OUT); }
has comment: http://stackoverflow.com/comment/38776122
has comment: http://stackoverflow.com/comment/38776024
has comment: http://stackoverflow.com/comment/38776046
has comment: http://stackoverflow.com/comment/38776237
type: AnsweredQuestion
downvote count: 11
tagged with: java
has title: Friends Can any one explain this code
has comment: http://stackoverflow.com/comment/38776636
accepted answer: http://stackoverflow.com/a/24949723
type: Question
score: -11
has answer: http://stackoverflow.com/a/24949623
upvote count: 0
has comment: http://stackoverflow.com/comment/38776044
possible better answer: http://stackoverflow.com/a/24949623
answer count: 3
favorite count: 0
has answer: http://stackoverflow.com/a/24949723

http://stackoverflow.com/comment/38903504
type: AnswerComment
has text: And there you go, as easy as that. Thank you blueIDe!
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25016826

http://stackoverflow.com/comment/38844371
type: Comment
comment on: http://stackoverflow.com/a/24979080
has text: MY PROBLEM WAS IN POM.XML FILE! SEE UPDATE2 IN MY QUESTION
type: AnswerComment
score: 0

http://stackoverflow.com/comment/38903377
type: AnswerComment
type: Comment
has text: just as a note, the technique of comparing by subtraction will fail for numbers large enouygh to get integer overflow. See: http://stackoverflow.com/questions/2728793/java-integer-compareto-why-use-comparison-vs-subtraction
score: 1
comment on: http://stackoverflow.com/a/25015677

http://stackoverflow.com/q/24936572
type: Question
has comment: http://stackoverflow.com/comment/38751501
has comment: http://stackoverflow.com/comment/38751225
possible better answer: http://stackoverflow.com/a/24936999
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/24938984
accepted answer: http://stackoverflow.com/a/24938984
has title: Find the text between bbCode
tagged with: bbcode
has answer: http://stackoverflow.com/a/24936999
has comment: http://stackoverflow.com/comment/38751400
has body: I'm trying to remove the BBCode from a String. This is myString: String wording = "Teststring [URL=\"http://www.test.ch/status\"]http://www.test.ch/status[/URL] [IMG]http://sit.corproot.net/uploads/659_untitled.png[/IMG] \n\n" I've already tried this one: wording?.replaceAll("\\[URL=\".*\\](.*?)\\[/URL\\]", "") My target string should be: Teststring http://www.test.ch/status \n\n" But when I run the code, it doesn't replace anything What am I doing wrong? Kind regards
tagged with: regex
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38751342
tagged with: java
has comment: http://stackoverflow.com/comment/38751322

http://stackoverflow.com/q/25015263
has title: Working with credentials - google drive sdk + java
tagged with: google-oauth
score: 0
answer count: 1
tagged with: google-drive-api
has body: I need to upload file into Google Drive disc using Google Drive SDK. I have simple class to do it: public class DriveApiTest { private static String CLIENT_ID = "..."; private static String CLIENT_SECRET = "..."; // private static String REDIRECT_URI = "..."; private static String REDIRECT_URI = "..."; static HttpTransport httpTransport = new NetHttpTransport(); static JsonFactory jsonFactory = new JacksonFactory(); static String parentId = "0B8Myj-AtyvWAWlNTQmpMdWxCRTQ"; public static void start() throws IOException { GoogleAuthorizationCodeFlow flow = new GoogleAuthorizationCodeFlow.Builder( httpTransport, jsonFactory, CLIENT_ID, CLIENT_SECRET, Arrays.asList(DriveScopes.DRIVE)).setAccessType("online") .setApprovalPrompt("auto").build(); String url = flow.newAuthorizationUrl().setRedirectUri(REDIRECT_URI) .build(); System.out .println("Please open the following URL in your browser then type the authorization code:"); System.out.println(" " + url); try { Desktop.getDesktop().browse(new URI(url)); } catch (URISyntaxException e) { // TODO Auto-generated catch block e.printStackTrace(); } BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String code = br.readLine(); GoogleTokenResponse response = flow.newTokenRequest(code) .setRedirectUri(REDIRECT_URI).execute(); GoogleCredential credential = new GoogleCredential() .setFromTokenResponse(response); Drive service = new Drive.Builder(httpTransport, jsonFactory, credential).setApplicationName("Test").build(); File body = new File(); body.setTitle("jeszcze inny Plik w podfolderze"); body.setMimeType("text/csv"); body.setParents(Arrays.asList(new ParentReference().setId(parentId))); java.io.File fileContent = new java.io.File( "C:\\Users\\TomekZ\\Desktop\\RoboczeExcele\\Person.csv"); FileContent mediaContent = new FileContent("text/csv", fileContent); File file = service.files().insert(body, mediaContent).execute(); System.out.println("File ID: " + file.getId()); } } It is working but user have to go …
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26015559
tagged with: java
type: Question
tagged with: google-oauth-java-client

http://stackoverflow.com/a/24951197
has comment: http://stackoverflow.com/comment/38781329
has comment: http://stackoverflow.com/comment/38798523
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/24950666
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/38784787
has body: Alternatively, if you don't want A and B to be tied up by extending an abstract class you can just use composition. This also provides the flexibility to change the IFoo behaviour at run time if you were to inject the FooImpl as part of the constructor. In this example I have just hard wired the FooImpl for brevity. public class B implements ISomeInterface { private IFoo foo = new FooImpl(); public void foo() { foo.doSomethingFooey(); } public void bar() { // B specific implementation } } public class A implements ISomeInterface { private IFoo foo = new FooImpl(); public void foo() { foo.doSomethingFooey(); } public void bar() { // A specific implementation } }

http://stackoverflow.com/comment/38912473
has text: @KickButtowski While code golf can be interesting, that doesn't make this a good question for the site.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25022027

http://stackoverflow.com/comment/38953872
has text: Actually, if you only want to insert emoticons into Whatsapp, you might want to see if Whatsapp has any api you can use, or you may just want to create your own custom keyboard instead (which can work on all apps, not just Whatsapp).
type: Comment
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/25026886

http://stackoverflow.com/a/24932925
has body: The drawable will be fetched from "res/drawable-xhdpi" only if you are running the app on an xhdpi device. Else it will try to fetch the drawable from the corresponding drawable folder according to the screen and if it is not there, you will get the same error as above. If you are not sure which screen size you are using the best work around is to create a directory named "drawable" inside the res folder(ie, "res/drawable") and then add my_btn into the newly created "drawable" folder. Then it will fetch the image from the new folder regardless of the screen size. EDIT You are using the raw folder, not the resource folder. openRawResource reads from the raw folder. Use the following code to get a drawable and convert it to input stream(You will have to surround with try-catch). Drawable drawable = getResources().getDrawable(R.drawable.my_btn); BitmapDrawable bitmapDrawable = ((BitmapDrawable) drawable); Bitmap bitmap = bitmapDrawable.getBitmap(); ByteArrayOutputStream stream = new ByteArrayOutputStream(); bitmap.compress(CompressFormat.JPEG, 100, stream); //use the compression format of your need InputStream is = new ByteArrayInputStream(stream.toByteArray());
answers question: http://stackoverflow.com/q/24932838
has comment: http://stackoverflow.com/comment/38744181
has comment: http://stackoverflow.com/comment/77309051
has comment: http://stackoverflow.com/comment/38744633
upvote count: 3
type: Answer
has comment: http://stackoverflow.com/comment/38744794
has comment: http://stackoverflow.com/comment/38744890
downvote count: 0
has comment: http://stackoverflow.com/comment/38744234
has comment: http://stackoverflow.com/comment/38748930
score: 3

http://stackoverflow.com/q/24955618
has answer: http://stackoverflow.com/a/24967000
tagged with: java
has body: I'd like to include text-to-speech functionality in my Codename One android app, but I can't seem to get it to work. As Codename One does not provide this capability in its API, I'm trying to create a Native interface to handle it using the google maps cn1lib as an example. Here's what I've got so far: NativeTTS.java public class NativeTTS extends NativeInterface { public int speakString (String hello); } NativeTTSImpl.java public class NativeTTSImpl implements OnInitListener, LifecycleListener, IntentResultListener { private TextToSpeech tts; public void initialize () { AndroidNativeUtil.addLifecycleListener (this); } public void deinitialize () { AndroidNativeUtil.removeLifecycleListener (this); } public int speakString(String text) { return tts.speak (text, TextToSpeech.QUEUE_FLUSH, null); } public void onInit (int status) { if ( status == TextToSpeech.SUCCESS ) { tts.setLanguage (Locale.US); } } public boolean isSupported() { return true; } public void onActivityResult (int requestCode, int resultCode, Intent data) { if ( resultCode == TextToSpeech.Engine.CHECK_VOICE_DATA_PASS ) tts = new TextToSpeech (AndroidNativeUtil.getActivity (), this); else { Intent installIntent = new Intent (); installIntent.setAction (TextToSpeech.Engine.ACTION_CHECK_TTS_DATA); AndroidNativeUtil.getActivity ().startActivity (installIntent); } } public void onCreate (Bundle savedInstanceState) { Intent intent = new Intent (); intent.setAction (TextToSpeech.Engine.ACTION_CHECK_TTS_DATA); AndroidNativeUtil.startActivityForResult (intent, this); } public void onDestroy () { if ( tts != null ) { tts.stop (); tts.shutdown (); } } public void onResume () {} public void onPause () {} public void onLowMemory () {} public void onSaveInstanceState (Bundle b) {} } I'm attempting to use it back in my app like so: NativeTTS tts = (NativeTTS) NativeLookup.create (NativeTTS.class); if ( tts != null &amp;&amp; tts.isSupported () ) { int success = tts.speakString ("Hello World"); } However, I'm getting …
type: Question
possible better answer: http://stackoverflow.com/a/24965461
answer count: 2
has answer: http://stackoverflow.com/a/24965461
tagged with: codenameone
score: 0
accepted answer: http://stackoverflow.com/a/24967000
tagged with: android
tagged with: text-to-speech
has title: How to use Android TextToSpeech in CodenameOne?
type: AnsweredQuestion

command-query-separation
tags question: http://stackoverflow.com/q/24957458
type: Tag
tag name: command-query-separation
tags question: http://stackoverflow.com/q/24975402

http://stackoverflow.com/comment/38917795
has text: This is the right answer, I just found out myself though. Thank you for your help!
type: Comment
comment on: http://stackoverflow.com/a/25024753
score: 0
type: AnswerComment

http://stackoverflow.com/a/25086447
has body: "Stateless actors that could live in any machine" -- this sounds like akka cluster. "Stateless actors that I want them to live in specific machines" -- this sounds like akka cluster singleton, but you can also use roles "being able to restart the actor with its previous state if it dies" -- this sounds like Akka Cluster Sharding with akka-persistence.
upvote count: 3
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/25007778
score: 3
accepted answer of: http://stackoverflow.com/q/25007778
downvote count: 0

http://stackoverflow.com/a/24983807
answers question: http://stackoverflow.com/q/24983742
downvote count: 0
type: AcceptedAnswer
has body: Since your while loop already tests for valid titles, you shouldn't test it inside the loop too. This is simpler : while(!Arrays.asList(titles).contains(title)){ System.out.println("Please enter valid Job Title"); title = param.nextLine(); } System.out.println("Please enter your Hours for this week :"); String count = param.nextLine(); System.out.printf("Your Salary is : $ %f",HoursMath(HourRate(title),Integer.parseInt(count))); You don't have to break from the loop this way. Once you are out of the loop, you know you have a valid title.
type: Answer
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/24983742

nullpointerexception
tags question: http://stackoverflow.com/q/24978886
tags question: http://stackoverflow.com/q/24930161
tags question: http://stackoverflow.com/q/24924575
tags question: http://stackoverflow.com/q/24970120
tags question: http://stackoverflow.com/q/24917314
tags question: http://stackoverflow.com/q/24987451
tags question: http://stackoverflow.com/q/24959835
tags question: http://stackoverflow.com/q/25066183
tags question: http://stackoverflow.com/q/25034338
tags question: http://stackoverflow.com/q/25048182
tags question: http://stackoverflow.com/q/24992521
type: Tag
tag name: nullpointerexception
tags question: http://stackoverflow.com/q/24985465
tags question: http://stackoverflow.com/q/25012893
tags question: http://stackoverflow.com/q/24928042
tags question: http://stackoverflow.com/q/25066982
tags question: http://stackoverflow.com/q/24957585
tags question: http://stackoverflow.com/q/24971385
tags question: http://stackoverflow.com/q/24971413
tags question: http://stackoverflow.com/q/24997787
tags question: http://stackoverflow.com/q/24946764
tags question: http://stackoverflow.com/q/25046374
tags question: http://stackoverflow.com/q/25031563
tags question: http://stackoverflow.com/q/25063447
tags question: http://stackoverflow.com/q/24977882
tags question: http://stackoverflow.com/q/24924028
tags question: http://stackoverflow.com/q/24987587
tags question: http://stackoverflow.com/q/25052059
tags question: http://stackoverflow.com/q/25020144
tags question: http://stackoverflow.com/q/25017553
tags question: http://stackoverflow.com/q/24973752
tags question: http://stackoverflow.com/q/24952298
tags question: http://stackoverflow.com/q/24996838
tags question: http://stackoverflow.com/q/24931677
tags question: http://stackoverflow.com/q/24986449
tags question: http://stackoverflow.com/q/25015983
tags question: http://stackoverflow.com/q/24963607

http://stackoverflow.com/comment/41895093
comment on: http://stackoverflow.com/a/25051300
type: Comment
has text: Oops, late response but thank you for this! I did end up using this (never noticed it before you pointed it out), and it saves a lot of time! Accepted answer!
type: AnswerComment
score: 0

http://stackoverflow.com/a/25066208
has comment: http://stackoverflow.com/comment/38995798
has comment: http://stackoverflow.com/comment/38995328
has comment: http://stackoverflow.com/comment/38995523
has comment: http://stackoverflow.com/comment/38995316
type: Answer
has comment: http://stackoverflow.com/comment/38995187
has comment: http://stackoverflow.com/comment/38995403
has comment: http://stackoverflow.com/comment/38995462
has comment: http://stackoverflow.com/comment/38995474
has comment: http://stackoverflow.com/comment/38995719
answers question: http://stackoverflow.com/q/25066159
has comment: http://stackoverflow.com/comment/38995242
has body: The value of Google Play Services version is incorrect, inside res/value/integers.xml, change the value from: 2131034114 to: 5077000 The version of Google Play Services that you have is 5077000 not 2131034114 then Refresh -> Clean -> Build :)
score: 0

http://stackoverflow.com/comment/38718725
has text: Just need an idea. Not entire algorithm
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24919181

http://stackoverflow.com/comment/38891441
type: Comment
score: 3
type: AnswerComment
comment on: http://stackoverflow.com/a/25011152
has text: Links to external resources are encouraged, but please add context around the link so your fellow users will have some idea what it is and why it’s there. Always quote the most relevant part of an important link, in case the target site is unreachable or goes permanently offline.

http://stackoverflow.com/q/24949695
has comment: http://stackoverflow.com/comment/38776338
tagged with: java
has comment: http://stackoverflow.com/comment/38776341
type: Question
score: 0
answer count: 1
has title: how to add rating bar in Linear Layout Dynamically in Android?
has body: I have tried to add rating bar in Linear Layout at dynamically after some textfields. But I'm getting NullPointerException at the line = lL.addView(rating); Can someone help me please how to do this.Thanks in Advance. Here is my xml file. &lt;ScrollView android:id="@+id/scrollField" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_above="@+id/btnDELETE" android:layout_below="@+id/textTitle" android:layout_marginTop="10dp" &gt; &lt;LinearLayout android:id="@+id/linearLayoutRatingDetails" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" &gt; &lt;TextView android:id="@+id/tv_EmployeeName" android:layout_width="wrap_content" android:layout_height="40dp" android:layout_marginTop="10dp" android:text="dfkyjrtl" android:textColor="#2E1F1F" /&gt; &lt;TextView android:id="@+id/tv_TaskName" android:layout_width="wrap_content" android:layout_height="40dp" android:layout_marginTop="6dp" android:text="dfkyjrtl" android:textColor="#2E1F1F" /&gt; &lt;TextView android:id="@+id/tv_TaskDate" android:layout_width="wrap_content" android:layout_height="40dp" android:layout_marginTop="6dp" android:text="dfkyjrtl" android:textColor="#2E1F1F" /&gt; &lt;TextView android:id="@+id/tv_TaskRate" android:layout_width="wrap_content" android:layout_height="40dp" android:layout_marginTop="6dp" android:text="dfkyjrtl" android:textColor="#2E1F1F" /&gt; &lt;/LinearLayout&gt; &lt;/ScrollView&gt; Hare is my Activity code. public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.task_details); Intent intent = getIntent(); str_IntentName = intent.getExtras().getString("EMP_NAME"); str_IntentTaskName = intent.getExtras().getString("TASK_NAME"); str_IntentDate = intent.getExtras().getString("TASK_DATE"); str_IntentRate = intent.getExtras().getString("TASK_RATE"); numStar = Integer.valueOf(str_IntentRate); Log.e("integer numStar "," = " + numStar); lL = (LinearLayou…
has answer: http://stackoverflow.com/a/24949844
tagged with: android
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38776267

http://stackoverflow.com/a/25059763
has body: Storage Area 1.1 String - Constant String Pool 1.2 StringBuffer - Heap 1.3 StringBuilder - Heap Modifiable 2.1 String - No (immutable) 2.2 StringBuffer - Yes( mutable ) 2.3 StringBuilder - Yes( mutable ) Thread Safe 3.1 String - Yes 3.2 StringBuffer - Yes 3.3 StringBuilder - No Performance 4.1 String - Fast 4.2 StringBuffer - Very slow 4.3 StringBuilder - Fast
answers question: http://stackoverflow.com/q/25058861
upvote count: 1
score: 1
downvote count: 0
type: Answer

http://stackoverflow.com/comment/38967063
has text: What errors are being thrown. Please try to isolate where this problem is happening.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25051291

http://stackoverflow.com/comment/38979221
type: Comment
score: 2
comment on: http://stackoverflow.com/a/25057343
has text: Note that for readability reasons this kind of arithmetic operation is not recommended in real code. To express that you want to divide, use the `/` operator! Even if you divide by a power of two of which you only have the exponent in a variable: `n = n / (1 << k)` is easier to read than `n = n << k` (at least IMHO). Note that it's probably optimized to a bit-shifting operation by the compiler if that operation is going to be faster and if the results are the same. Writing `n << k` for optimization reasons is premature optimization, which is bad.
type: AnswerComment

http://stackoverflow.com/comment/38851662
comment on: http://stackoverflow.com/q/24990105
has text: Do you want a folder level lock ?
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/a/24941075
score: 1
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24941004
answers question: http://stackoverflow.com/q/24941004
type: Answer
has body: There's an option to save a build.xml script that replicates what you are doing on the export. If you do that, you can then just do show/view/ant and drag the build.xml in there and double click on the task to build it without errors.
downvote count: 0

http://stackoverflow.com/q/24949749
type: Question
tagged with: libgdx
has answer: http://stackoverflow.com/a/24954279
accepted answer: http://stackoverflow.com/a/24954279
tagged with: ios
score: 0
tagged with: robovm
answer count: 1
has title: Gdx.net: NPE in libgdx code with RoboVM
type: AnsweredQuestion
tagged with: java
has body: I'm having a problem with a Android/IOs app: the library code (libgdx?) throws a NPE, but debugging in RoboVM is not supported. When run in Android, it works as expected and reeaches the handleHttpResponse() method. When run in IOs, it reaches the failed(Throwable t) method with t being a NullPointerException. I've created a sample app to show the issue, maybe it's my fault, so here is the code: public class Npe extends ApplicationAdapter { SpriteBatch batch; Texture img; @Override public void create () { batch = new SpriteBatch(); img = new Texture("badlogic.jpg"); loadHttps("https://www.google.it"); } @Override public void render () { Gdx.gl.glClearColor(1, 0, 0, 1); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); batch.begin(); batch.draw(img, 0, 0); batch.end(); } private static void loadHttps(String url) { HttpRequest httpGet = new HttpRequest(HttpMethods.GET); httpGet.setUrl(url); Gdx.net.sendHttpRequest(httpGet, new HttpResponseListener() { @Override public void handleHttpResponse(HttpResponse httpResponse) { String res = httpResponse.getResultAsString(); System.err.println("res = \"" + res + "\""); } @Override public void failed(Throwable t) { System.err.println("On IOs we reach this point"); t.printStackTrace(); // and t is a NPE } @Override public void cancelled() { } }); } } and my robovm.xml: ${app.executable} ${app.mainclass} ios thumbv7 ios Info.plist.xml ../android/assets ** true data org.apache.harmony.xnet.provider.jsse.OpenSSLSocketFactoryImpl com.android.org.conscrypt.JSSEProvider com.android.org.conscrypt.OpenSSLProvider com.android.org.conscrypt.OpenSSLSocketFactoryImpl com.android.okhttp.HttpsHandler com.badlogic.gdx.scenes.scene2d.ui.* org.apache.harmony.xnet.provider.jsse.OpenSSLProvider org.apache.harmony.security.provider.cert.DRLCertFactory com.android.org.bouncycastle.jce.provider.BouncyCastleProvider org.apache.harmony.security.provider.crypto.CryptoProvider org.apache.harmony.xnet.provider.jsse.JSSEProvider com.android.org.bouncycastle.jce.pr…

http://stackoverflow.com/q/25035063
accepted answer: http://stackoverflow.com/a/25036534
linked to: http://stackoverflow.com/q/22608892
tagged with: jetty
linked to: http://stackoverflow.com/q/25972186
upvote count: 3
tagged with: java
has title: How to run Jetty with SPDY using ALPN?
type: Question
tagged with: alpn
type: AnsweredQuestion
score: 3
has body: I have returned to JDK8 with Jetty and SPDY and I see that now Jetty 9.2 supports ALPN protocol instead of NPN (see my question How to run Jetty with SPDY on JDK8?). So I set bootclasspath: java -Xbootclasspath/p:c:/jars/alpn-boot/alpn-boot-8.0.0.v2014031 ... But now I got exception: Exception in thread "xyz.server" java.lang.NoClassDefFoundError: org/eclipse/jetty/npn/NextProtoNego$ServerProvider at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(Unknown Source) at java.security.SecureClassLoader.defineClass(Unknown Source) ... at java.lang.ClassLoader.loadClass(Unknown Source) at org.eclipse.jetty.spdy.server.http.HTTPSPDYServerConnector.&lt;init&gt;(HTTPSPDYServerConnector.java:63) at org.eclipse.jetty.spdy.server.http.HTTPSPDYServerConnector.&lt;init&gt;(HTTPSPDYServerConnector.java:53) at org.eclipse.jetty.spdy.server.http.HTTPSPDYServerConnector.&lt;init&gt;(HTTPSPDYServerConnector.java:43) at xyz.my.my_httpsrv_jetty.startHTTPSServer(my_httpsrv_jetty.java:359) ... I use java version "1.8.0_05" and jetty 9.2.2.v20140723. The same error I got with JDK 1.7 and alpn-boot-7.0.0.v20140317.jar on WinXP where I changed if from -Xbootclasspath/p:c:/jars/npn-boot/npn-boot-1.1.7.v20140316.jar This execption points in my code into: SSLconnector = new HTTPSPDYServerConnector(server, sslContextFactory); It seems that even with ALPN jetty needs classes from npn-boot. Is it a bug or I have done something wrong?
has answer: http://stackoverflow.com/a/25036534
answer count: 1
downvote count: 0
favorite count: 0
tagged with: spdy

http://stackoverflow.com/q/25016482
tagged with: alfresco-share
has title: How to deploy custom theme in alfresco share for windows?
has comment: http://stackoverflow.com/comment/38904663
has answer: http://stackoverflow.com/a/25029536
tagged with: java
has comment: http://stackoverflow.com/comment/38925928
downvote count: 0
answer count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/25029536
tagged with: alfresco
has body: I have created one custom theme with help of eclipse and alfresco sdk. After successfully build it genarate amp and zip file. How can i deploy for share in alfresco for windows? I have tried to put in the Tomcat\webapps\share\themes and Tomcat\webapps\share\WEB-INF\lib folder but it didn't work.
type: AnsweredQuestion
score: 1
upvote count: 1
type: Question

http://stackoverflow.com/comment/38712245
has text: your html file is also in the same project structure ? update your question with snapshot of your project structure
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24915823

http://stackoverflow.com/q/24917212
has title: Migrating "Security Domain" from JBoss 5.1.0 to WildFly
type: UnansweredQuestion
tagged with: java
tagged with: jboss-web
type: Question
has answer: http://stackoverflow.com/a/25493372
tagged with: wildfly-8
tagged with: security
score: 0
has body: I am migrating a JBoss 5.1.0 app to WildFly 8.1.0. On my jboss-web.xml I have the following element: java:/jaas/myApp However, the schma http://www.jboss.org/j2ee/schema/jboss-web_5_1.xsd does not support this element, causing: cvc-complex-type.2.4.a: Invalid content was found starting with element 'security-domain'. The security domain is related to this application policy: com.sun.jndi.ldap.LdapCtxFactory/module-option> ldap://example.com:389 simple "DOMAIN"\username credential OU=aaaaa,OU=bbbbb,DC=cccc,DC=dddd,DC=com,DC=br (sAMAccountName={0}) OU=aaaaa,OU=bbbbb,DC=cccc,DC=dddd,DC=com,DC=br (member={1}) true cn 30000 SUBTREE_SCOPE false How can I rewrite this to make my app "WildFly deployable".
tagged with: jaas
answer count: 1

http://stackoverflow.com/a/33183601
answers question: http://stackoverflow.com/q/24948065
score: 2
has body: Here is an example to generate pdf and having barcode using opensource technology: (https://www.google.com/url?sa=t&amp;rct=j&amp;q=&amp;esrc=s&amp;source=web&amp;cd=2&amp;cad=rja&amp;uact=8&amp;ved=0CCUQiBUwAWoVChMI6KiL5urIyAIVRSmICh1WhASJ&amp;url=https%3A%2F%2Fplus.google.com%2F106756017574705877581%2Fposts%2FZLE22J3jPMa&amp;usg=AFQjCNFFs6Vfdq4Sr-mtjcDXfgcX0SxNKw&amp;sig2=swMxmIhVUqq2iiZnuwssow) Generating PDF having barcode of a String (i.e. SKU), using open source APIs. The acceptance criterion is that the generated bar-code should be able to be scanned by using any bar code scanner. To generate Barcode, I have used “ Zxing “ API. The used jars used in the below example are: core-2.2.jar, javase.jar. To generate PDF, I have used PDFBox API. In this example I have used the following jars: pdfbox-1.8.10.jar, pdfbox-app-1.8.10.jar. The above mentioned jar can be found at below link: https://sites.google.com/site/sujeetcorp/files/PDFBox%26Zxing_jars.zip?attredirects=0&amp;d=1 In the below example I am creating a PDF file having two pages and on each page there are two different barcode. Here is the code: package com.barcode; import java.awt.Color; import java.awt.image.BufferedImage; import java.io.File; import java.io.FileNotFoundException; import org.apache.pdfbox.pdmodel.PDDocument; import org.apache.pdfbox.pdmodel.PDPage; import org.apache.pdfbox.pdmodel.common.PDRectangle; import org.apache.pdfbox.pdmodel.edit.PDPageContentStream; import org.apache.pdfbox.pdmodel.font.PDFont; import org.apache.pdfbox.pdmodel.font.PDType1Font; import org.apache.pdfbox.pdmodel.graphics.xobject.PDPixelMap; import org.apache.pdfbox.pdmodel.graphics.xobject.PDXObjectImage; import com.google.zxing.BarcodeFormat; import com.google.zxing.client.j2se.MatrixToImageWriter; import com.google.zxing.common.BitMatrix; import com.google.zxing.oned.Code128Writer; public class BarCode { public static void main (String[] args) throws Exception { BitMatrix bitMatrix; String outputFileName = "Simpl…
downvote count: 0
upvote count: 2
type: Answer

http://stackoverflow.com/q/25042896
has title: Unsual Gmail Java messaging exception
type: Question
tagged with: exception
has answer: http://stackoverflow.com/a/25137566
has comment: http://stackoverflow.com/comment/38956445
has body: I am using Java Mail Api to send mail , it works perfectly on my computer system. But it does not work on the Clients Network.. I get Java Messaging exception cannot connect to Here is A snipet of the code private static void sendmail(String file) throws IOException { try { final String username ="username"; final String password= "password"; Properties props= new Properties(); props.put("mail.smtp.host", "smtp.gmail.com"); props.put("mail.smtp.socketFactory.port", "465"); props.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory"); props.put("mail.smtp.auth", "true"); props.put("mail.smtp.port", "465"); Session session = Session.getInstance(props, new javax.mail.Authenticator() { protected PasswordAuthentication getPasswordAuthentication() { return new PasswordAuthentication(username, password); } }); Message message= new MimeMessage(session); String To= "a@client.com"; String subject= "ERROR LOG IN EXCEL"; String body= "Testing Attached within"; message.setFrom(new InternetAddress(username)); message.setRecipients(Message.RecipientType.TO, InternetAddress.parse(To)); message.setSubject(subject); message.setText(body); MimeBodyPart messageBodyPart = new MimeBodyPart(); Multipart multipart = new MimeMultipart(); DataSource source = new FileDataSource(file); messageBodyPart.setDataHandler(new DataHandler(source)); messageBodyPart.setFileName("eror log.xls"); multipart.addBodyPart(messageBodyPart); message.setContent(multipart); Transport.send(message); JOptionPane.showMessageDialog(null, "message sent"); } I get the Error Java messaging exception cannot mail.smtp. host smtp.gmail.com port: 465 This works however on my own system. and the email was sent successful. Could this be a security configuration issue with the clients Network System
has comment: http://stackoverflow.com/comment/38959125
score: 0
tagged with: java
answer count: 1
type: UnansweredQuestion
tagged with: jakarta-mail
has comment: http://stackoverflow.com/comment/38951394

http://stackoverflow.com/comment/39000459
comment on: http://stackoverflow.com/a/25052514
score: 0
type: Comment
has text: Unfortunately that didn't work … I have the following jars/folders on my Java Build path in Eclipse : java-client-1.5.0.jar ( this is the Appium java bindings library ) , selenium-java-2.42.2.jar ( this is Selenium Webdriver java bindings library) , the folder "remote" from the Selenium Webdriver jar "openqa/selenium/remote" is also on the class path. I selected all these along with JRE system library and JUnit library in Order and Export, but it didn't work ..
type: AnswerComment

http://stackoverflow.com/q/24920302
type: Question
has comment: http://stackoverflow.com/comment/53420453
accepted answer: http://stackoverflow.com/a/43186055
downvote count: 0
possible better answer: http://stackoverflow.com/a/68010496
favorite count: 0
has comment: http://stackoverflow.com/comment/50367718
answer count: 3
has title: Jetty 9 - How do I set "request content" and "request headers" using Jetty 9?
has answer: http://stackoverflow.com/a/43186055
has answer: http://stackoverflow.com/a/76027638
has answer: http://stackoverflow.com/a/68010496
has body: I used ContentExchange class of Jetty 7 for setting URL, headers and requestContent. Following is What I have using Jetty 7. HttpClient client = new HttpClient(); client.start(); ContentExchange exchange = new ContentExchange(); exchange.setURL(url); exchange.setRequestHeader("Content-Type", "application/xml"); exchange.setRequestHeader("Authorization", "Basic " + this.getAuthenticatonString()); exchange.setMethod("POST"); final AbstractBuffer cb = new ByteArrayBuffer(xml.getBytes("UTF-8")); exchange.setRequestContent(cb); client.send(exchange); exchange.waitForDone(); Jetty 9 doesn't have ContentExchange class but after some research I have this HttpClient client = new HttpClient(); client .POST(url) .send() I think I can use client.param for setting request headers but I am not really sure about it. So my question is how do I set "request content" and "request headers" using Jetty 9?
tagged with: jetty
upvote count: 1
type: AnsweredQuestion
score: 1
tagged with: java

http://stackoverflow.com/a/25046223
type: Answer
has body: Using an EqualsBuilder is not implicitly better or worse than writing your equals method from scratch. In other words, I don't consider using EqualsBuilder to be a best practice. A non-EqualsBuilder equals() method usually looks like this: public boolean equals(Object other) { boolean result; if(this == other) result = true; else if(other == null) result = false; else if(other instanceof MyClass) { MyClass o=(MyClass) other; result = Objects.equals(this.a, o.a) &amp;&amp; Objects.equals(this.b, o.b) // ... &amp;&amp; Objects.equals(this.z, o.z); } else result = false; return result; }
score: 0
has comment: http://stackoverflow.com/comment/38958258
upvote count: 1
downvote count: 1
answers question: http://stackoverflow.com/q/25046166
has comment: http://stackoverflow.com/comment/38957809
has comment: http://stackoverflow.com/comment/38957884
has comment: http://stackoverflow.com/comment/42553135
has comment: http://stackoverflow.com/comment/38958329

http://stackoverflow.com/comment/38923825
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/25028182
has text: This depends on the database and the JDBC driver used. There's no generic answer.
type: Comment

http://stackoverflow.com/comment/38931334
type: AnswerComment
comment on: http://stackoverflow.com/a/25032408
type: Comment
has text: Can you try `<url-mapping>/<url-mapping>`?
score: 0

http://stackoverflow.com/a/25028216
score: 3
upvote count: 5
answers question: http://stackoverflow.com/q/25009717
has body: I had the same problem. Starting Android Studio as Administrator fixed it.
type: Answer
has comment: http://stackoverflow.com/comment/39095295
downvote count: 2
has comment: http://stackoverflow.com/comment/52101408

http://stackoverflow.com/a/24986295
score: 3
type: AcceptedAnswer
has body: Rectangle2D is axis aligned. It cannot be turned. Try using a Path2D instead. There is a nice constructor that seems to be doing exactly what you want: Path2D.Double(Shape shape, AffineTransform transform) private Path2D.Double transform(Rectangle2D.Double rect) { AffineTransform transform = new AffineTransform(); double angle = Math.toRadians(theta); transform.rotate(angle, rect.x + rect.width / 2, rect.y + rect.height / 2); return new Path2D.Double(rect, transform); } Also note that your toRadians(toRadians(theta)) is very suspicious and makes your angles very tiny.
upvote count: 3
type: Answer
accepted answer of: http://stackoverflow.com/q/24986287
downvote count: 0
answers question: http://stackoverflow.com/q/24986287

http://stackoverflow.com/comment/38750547
has text: Yes. But now I just want the code to run, I don't care what happens to segmentation. I've implemented my own version of a simple CCL, without using openCV. I will test that here. But first, I just want this thing to run without crashing. I'll check the segmentation later, no problem if no segmentation happens at all!
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24910225

http://stackoverflow.com/comment/38733554
type: QuestionComment
comment on: http://stackoverflow.com/q/24927066
has text: no thats not duplicate for that i know that i have to set `ResultSet.TYPE_SCROLL_INSENSITIVE` but i dont have connection object available i am using `namedParameterJdbcTemplate`
score: 0
type: Comment

http://stackoverflow.com/comment/38968517
score: 0
has text: getting null pointer exception in: System.arraycopy(bits.getBuffer(),0, data, offset, size);
type: AnswerComment
comment on: http://stackoverflow.com/a/25051756
type: Comment

http://stackoverflow.com/q/25066237
has answer: http://stackoverflow.com/a/25066487
has answer: http://stackoverflow.com/a/25066370
favorite count: 0
has body: Sorry for the (seemingly) lazy question, but i've been looking for a solution with no luck (in other words, I haven't found a solution that i understand). I want to have users log in to an app by way of entering a username and password, this username and password has to match a username and password from the jsonarray which i've retrieved from a phpmyadmin database. The username and password have to be in the same row. Here's the function I use to retrieve my jsonarray: private void getData(){ JSONArray json; try{ user = editText1.getText().toString(); password = editText2.getText().toString(); json = readJsonFromUrl("http://localhost/indextest.php?function=getdata"); Thread.sleep(1000); } catch (Exception e) { Log.e("BACKGROUND_PROC", e.getMessage()); } } I just need to know how to search the jsonarray for the values that i retrieve from my textviews. If possible I would like to retrieve a value that I can easily assign to an if statement like such: public void onClick(View v) { switch (v.getId()) { case R.id.button1: if ( editText1 != null &amp;&amp; editText1.length() != 0 &amp;&amp; editText2 != null &amp;&amp; editText2.length() != 0){ getData(); m_ProgressDialog = ProgressDialog.show(HomeScreen.this, "Please wait...", "Checking Details...", true); m_ProgressDialog.setCancelable(true); if ( /*username and password match*/){ Intent i = new Intent(this, Afterlog.class); startActivity(i); } else{ Toast.makeText(HomeScreen.this, "The username and password did not match any in our database...", Toast.LENGTH_SHORT).show(); } } else { Toast.makeText(HomeScreen.this, "Please enter a user name AND a password...", Toast.LENGTH_SHORT).show(); } break; } }
type: UnansweredQuestion
tagged with: android
upvote count: 1
tagged with: getjson
has answer: http://stackoverflow.com/a/25274260
has title: Comparing values from textviews and JSONArray
score: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: Question
tagged with: arrays
downvote count: 0
answer count: 3

http://stackoverflow.com/comment/38927856
type: Comment
comment on: http://stackoverflow.com/q/25029966
score: 1
type: QuestionComment
has text: @EJP The JIT compiler will do such [thing](http://docs.oracle.com/cd/E15289_01/doc.40/e15058/underst_jit.htm#i1077985)

http://stackoverflow.com/comment/38843046
comment on: http://stackoverflow.com/a/24985488
type: Comment
score: 1
has text: @T.J.Crowder I guess you are right. I thought the sort wouldn't be a problem because compareTo doesn't access the object at all, but calling compareTo on the null instance would cause the NullPointerException.
type: AnswerComment

http://stackoverflow.com/comment/38834998
has text: possible duplicate of [Why doesnt hasnext,hasprevious etc methods of Iterator or listIterator check for ConcurrentModificationException](http://stackoverflow.com/questions/21450191/why-doesnt-hasnext-hasprevious-etc-methods-of-iterator-or-listiterator-check-for)
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24980651
score: 0

http://stackoverflow.com/comment/38967387
has text: I'm using Oracle, and it works with a native query, but i'd like to use jpa
comment on: http://stackoverflow.com/q/25036961
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38875661
comment on: http://stackoverflow.com/q/25002776
has text: Perhaps it should be version 0.001 ALPHA instead.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38982722
comment on: http://stackoverflow.com/q/25059378
score: 0
type: Comment
type: QuestionComment
has text: if the project specific settings are enabled, make sure that the project is at compiler level 1.6

http://stackoverflow.com/q/25028913
type: Question
downvote count: 0
has answer: http://stackoverflow.com/a/25029000
has answer: http://stackoverflow.com/a/25028936
has comment: http://stackoverflow.com/comment/38925153
score: 1
favorite count: 0
possible better answer: http://stackoverflow.com/a/25029000
has title: Can't read input file when compressed as a jar
has body: I am trying to run a jar file in terminal when I get this error: I can run this file fine in my IDE, but when I export the project as a jar, it cannot find the file. Here is the code that the error points to: BufferedImage buttonIcon = ImageIO.read(new File("img/button.png")); button = new JButton(new ImageIcon(buttonIcon));
answer count: 4
has answer: http://stackoverflow.com/a/25028979
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25028936
has answer: http://stackoverflow.com/a/55780235
tagged with: java
upvote count: 1

http://stackoverflow.com/q/25043917
has comment: http://stackoverflow.com/comment/38953175
has comment: http://stackoverflow.com/comment/38956625
has answer: http://stackoverflow.com/a/52569113
favorite count: 0
has answer: http://stackoverflow.com/a/25044177
possible better answer: http://stackoverflow.com/a/25044056
answer count: 5
tagged with: android
tagged with: android-intent
has title: Android App crashing when opening a new intent
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25044153
has answer: http://stackoverflow.com/a/25044668
score: 1
upvote count: 3
has comment: http://stackoverflow.com/comment/38953993
tagged with: java
downvote count: 2
tagged with: eclipse
accepted answer: http://stackoverflow.com/a/25044177
type: Question
has body: I'm new to to android programming. I've been using eclipse and trying to develop a two player tic tac toe game, but the app keeps crashing whenever a player wins. I try to open a new activity - a dialog saying player x wins and two buttons saying play again or exit. PlayerOne and PlayerTwo classes just sets the content view to the dialogs. I tried putting try and catch around the startActivity methods but then nothing happens I get three X's or O's in a row, the game just keeps running without any dialogs showing. So can anyone help me? Here is me code: package com.rohan.tictactoe; import android.app.Activity; import android.content.Intent; import android.graphics.Color; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; public class Main extends Activity implements OnClickListener{ Button t1,t2,t3,t4,t5,t6,t7,t8,t9; int turn = 1; int status = 0; String s1,s2,s3,s4,s5,s6,s7,s8,s9 = ""; Intent i = new Intent("com.rohan.tictactoe.PlayerOne"); Intent x = new Intent("com.rohan.tictactoe.PlayerTwo"); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); initiallize(); } @Override public void onClick(View v) { switch(v.getId()){ case R.id.t1: if (turn ==1){ t1.setText("X"); turn =2; s1 = "X"; } else if(turn == 2){ t1.setText("O"); turn =1; s1= "O"; } winner(); break; case R.id.t2: if (turn ==1){ t2.setText("X"); turn =2; s2 = "X"; } else if(turn == 2){ t2.setText("O"); turn =1; s2 = "O"; } winner(); break; case R.id.t3: if (turn ==1){ t3.setText("X"); turn =2; s3 = "X"; } else if(turn == 2){ t3.setText("O"); turn =1; s3 = "O"; } winner(); break; case R.id.t4: if (turn ==1){ t4.setText("X"); turn =2; s4 = "X"; t4.setEnabled(false); } else if(turn == 2){ t4.setText("O"); turn =1; s4 = "O"; t4.setEnabled(false); } winner(); break; case R.id.t5: if (turn ==1){ t5.setText("X"); turn =2; s5 = "X"; t5.setEnabled(false); } else if(tu…
has answer: http://stackoverflow.com/a/25044056

http://stackoverflow.com/comment/86669099
score: 1
has text: Sure! It's been a long time so I can't remember exactly how all of this works, but this is what I've got right now. Code posted above.
type: AnswerComment
comment on: http://stackoverflow.com/a/25080684
type: Comment

http://stackoverflow.com/a/25038118
has body: use this regex: ^[^.]*(?:(?:\.[^\.]*){0,1})$ took a lot of time to figure this one out demo here: http://regex101.com/r/kP4mF3/1
type: Answer
answers question: http://stackoverflow.com/q/25037393
score: 0

http://stackoverflow.com/comment/38907905
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25019324
type: Comment
has text: Are the items fixed or can they be added and removed?

http://stackoverflow.com/q/24985985
has answer: http://stackoverflow.com/a/24986081
tagged with: java
tagged with: javafx
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/24986060
accepted answer: http://stackoverflow.com/a/24986060
possible better answer: http://stackoverflow.com/a/24986076
type: AnsweredQuestion
has title: Why is my Thread making my JavaFX Application lag?
tagged with: multithreading
type: Question
has answer: http://stackoverflow.com/a/24986076
has body: I'm trying to make an JavaFX application that tracks the movement of my mouse for this im using this code in the controller class: new Thread(new Runnable() { @Override public void run() { while (Main.running) { Platform.runLater(new Runnable() { @Override public void run() { try { label.setText(MouseInfo.getPointerInfo().getLocation().toString()); Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); } } }); } } }).start(); But it couses my application to lag big time. How should i fix this lag problem? Thanks i fixed it: new Thread(new Runnable() { @Override public void run() { while (Main.running) { Platform.runLater(new Runnable() { @Override public void run() { label.setText(MouseInfo.getPointerInfo().getLocation().toString()); } }); try { Thread.sleep(200); } catch (InterruptedException e) { e.printStackTrace(); } } } }).start();

http://stackoverflow.com/comment/38779293
type: Comment
comment on: http://stackoverflow.com/a/24950475
score: 1
has text: Skeet's answer is much better than this, but I'll change mine with your suggestion anyways.
type: AnswerComment

http://stackoverflow.com/a/25020699
has body: You can take a look at the bits. Using two's complement notation, the bits for -4 and -5 are, showing only the last 8 bits for brevity: -4: 1111 1100 -5: 1111 1011 Bit shifting to the right 2 positions, with sign extension: -4 &gt;&gt; 2: 1111 1111 (-1) -5 &gt;&gt; 2: 1111 1110 (-2) Normally, you think of &gt;&gt;&gt; not using sign extension, and this is true, but in this case: r &gt;&gt;&gt;= 2; ... the value r is promoted to int for the bit-shift operation using binary numeric promotion, but the compound assignment operator casts the returned value back to byte, and the shifted-in zero "disappears". byte r = -5; // 1111 1100 r &gt;&gt;&gt;= -2; // promoted to int: 11111111 11111111 11111111 11111010 // bit shift: 00111111 11111111 11111111 11111110 // cast back to byte: 11111110 (-2) The JLS, Section 15.26.2, talks about the casting operation done in compound assignment operators: A compound assignment expression of the form E1 op= E2 is equivalent to E1 = (T) ((E1) op (E2)), where T is the type of E1, except that E1 is evaluated only once. That is, in this case, the result of the bit-shift is casted back to byte. The same cast-back-to-byte operation occurs when the value of r is -4. Note that if the assignment part wasn't done, then you wouldn't see the same answer, because it wouldn't cast the result back to byte: System.out.println(r &gt;&gt;&gt; 2); Then you would see: 1073741822
upvote count: 7
type: Answer
has comment: http://stackoverflow.com/comment/38910161
accepted answer of: http://stackoverflow.com/q/25020583
downvote count: 0
has comment: http://stackoverflow.com/comment/38910049
score: 7
has comment: http://stackoverflow.com/comment/38909929
answers question: http://stackoverflow.com/q/25020583
has comment: http://stackoverflow.com/comment/38910201
type: AcceptedAnswer

http://stackoverflow.com/comment/38700656
has text: if u just don't know the answer then plz don't put a negative vote. Plz explain me the reason.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24909272

http://stackoverflow.com/q/24942527
type: AnsweredQuestion
score: 1
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/24974240
has comment: http://stackoverflow.com/comment/38762975
has comment: http://stackoverflow.com/comment/38763920
has comment: http://stackoverflow.com/comment/38763083
answer count: 1
downvote count: 0
favorite count: 0
tagged with: android-asynctask
tagged with: android-handler
has comment: http://stackoverflow.com/comment/38763695
tagged with: multithreading
has title: Update views from second Thread in Android Application
tagged with: android
upvote count: 1
has body: In my application, two things are happening at once. There is a clock hand ImageView in the activity that is constantly being turned, and the user can also press action bar buttons. The updating of the clock's hand is drastically slowing down the performance of the app, and the buttons take several seconds to respond. I need to be able to run the clock rotation on another thread, but so far I could not accomplish this. The first thing I tried was to use a Handler: class MainActivity extends ActionBarActivity() { Handler handler; @Override protected void onCreate(Bundle savedInstanceState) { ... handler = new Handler(); startRotation(); } private void startRotation() { Runnable r = new Runnable() { // do stuff to the UI here }; handler.postDelayed(r, 100); } } But since that runs on MainActivity's thread, it slowed everything down. Next, I used an AsyncTask, but you can't update the UI from an AsyncTask without calling: MainActivity.this.runOnUiThread(new Runnable() {}); It still ran on the main thread and slowed the app down. So my goal is this: To be able to update the clock's hand completely on one thread so that the main thread is used only for the user interaction, that way they both run smoothly. Thank You EDIT: My Code for rotating the clock's minute hand (updates every 100 millis): Runnable r = new Runnable() { ImageView minute_hand = (ImageView) findViewById(R.id.clock_hand_minute); Calendar c = Calendar.getInstance(); float angle = 360f * ((float) c.get(Calendar.MINUTE) / 60f); // minSdk is 11, so this works: minute_hand.setRotation(angle); };
has answer: http://stackoverflow.com/a/24974240

http://stackoverflow.com/q/24964639
linked to: http://stackoverflow.com/q/1049228
answer count: 4
has comment: http://stackoverflow.com/comment/38804084
type: AnsweredQuestion
has body: I have String containing zeros, ones and unfortunately a lot of white spaces. I want to write method which will get rid of all the white spaces and return String with just ones and zeros. How can I do that? String example= new String("1 011 01 1"); String shouldReturnStringWithoutWhiteSpaces(String given){ String cleanString //some action which will "transform "1 011 01 1" into "1011011" return cleanString; }
duplicate of: http://stackoverflow.com/q/5455794
type: Question
has answer: http://stackoverflow.com/a/24964734
has answer: http://stackoverflow.com/a/24964669
has title: How to cut off all the white spaces from String?
score: 0
has answer: http://stackoverflow.com/a/24964695
has answer: http://stackoverflow.com/a/24964725
has comment: http://stackoverflow.com/comment/38804289
has comment: http://stackoverflow.com/comment/38804343
possible better answer: http://stackoverflow.com/a/24964695
accepted answer: http://stackoverflow.com/a/24964669
tagged with: java
linked to: http://stackoverflow.com/q/5455794

http://stackoverflow.com/comment/39176183
score: 0
comment on: http://stackoverflow.com/a/25119176
type: Comment
has text: On the first step we'll keep old versioned process instances running until they are finished (as suggested).The idea of using event triggers for some kind of technical/manual instance control sounds good.I think we'll give this approach a try the next step. For clarification just to be clear about this:forwarding a process instance programmatically to a given task/activity means that one knows about the very process definition. Let's say a sequence or path of starting and completing tasks and setting variables. Shortly: This forwarding is non generic/automatic and process definition specific?
type: AnswerComment

http://stackoverflow.com/comment/38980776
score: 0
has text: why do you need these global variable? Try to avoid such cases.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25058763

mocking
tags question: http://stackoverflow.com/q/25062082
tags question: http://stackoverflow.com/q/25069564
tag name: mocking
type: Tag

http://stackoverflow.com/comment/38834947
type: QuestionComment
has text: yes, I did @DeepanshuBedi, but that link is explaining JNDI Naming services, which I know alread, I want some information about JNDI Directory services. Thanks for suggestion.
comment on: http://stackoverflow.com/q/24981139
score: 0
type: Comment

http://stackoverflow.com/q/24954552
has answer: http://stackoverflow.com/a/24956359
has comment: http://stackoverflow.com/comment/38785805
tagged with: jcombobox
type: AnsweredQuestion
score: 2
has body: I try to implements mechanism which will prevent before multiple clicks (I use popupListeners) on JComboBox and executing included for that event listeners. For example: public class SomeClass{ protected boolean semaphore = false; public void initComboBox() { JComboBox targetControllersComboBox = new JComboBox(); // combobox object targetControllersComboBox.addPopupMenuListener(new PopupMenuListener() { @Override public void popupMenuWillBecomeVisible(PopupMenuEvent event) { if (semaphore == false) { semaphore = true; // here acquired semaphor // HERE SOME CODE // semaphore = false; // here release semaphor } } } } I would like to avoid run code in popupListener before already running code in before executed popupListener. When popUplistener finish working than user can execute next popUplistener. My example unfortunately doesn't prevent about this situation. Anyone can help? I will great full for help. UPDATE: FOLLOW (maris) RESLOVE PROBLEM: @Override public void popupMenuWillBecomeVisible(PopupMenuEvent event) { JComboBox comboBox = (JComboBox) event.getSource(); comboBox.removePopupMenuListener(this); // some code .... // now Listener is disabled and user cant execute next listener until this listener not stop working comboBox.addPopupMenuListener(this); // after some code we add again listener, user now can use again listener }
downvote count: 0
tagged with: java
tagged with: swing
type: Question
upvote count: 2
accepted answer: http://stackoverflow.com/a/24956359
has title: How to prevent multiple clicks on JComboBox
answer count: 1
favorite count: 0
tagged with: listener

http://stackoverflow.com/q/25031756
has comment: http://stackoverflow.com/comment/38931140
has title: FileUtils.copyUrlToFile is not working
accepted answer: http://stackoverflow.com/a/25032772
tagged with: java
type: Question
score: 9
upvote count: 9
has comment: http://stackoverflow.com/comment/38930925
has comment: http://stackoverflow.com/comment/38930306
has comment: http://stackoverflow.com/comment/38930533
has comment: http://stackoverflow.com/comment/38930993
has comment: http://stackoverflow.com/comment/38930807
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/25032772
favorite count: 0
has body: I have fairly basic question i'm trying to download a PDF from this URL using java: http://kundservice.svd.se/ui/templates/HttpHandler/PDFTidningen/PDFTidningen.ashx?date=2014-07-27&amp;file=SVD_D_BILAGA_2014-07-27.pdf&amp;mac=92267fcd3c75feff13154ba66870a523&amp;free=True here is my code "very basic": public class Main { private static final String PATH = "C:\\project\\DownloadTest\\src\\main\\resources\\tmp\\"; private static final String FILENAME = "data.pdf"; private static final String SvDPDFURL = "http://kundservice.svd.se/ui/templates/HttpHandler/PDFTidningen/PDFTidningen.ashx?date=2014-07-27&amp;file=SVD_D_BILAGA_2014-07-27.pdf&amp;mac=92267fcd3c75feff13154ba66870a523&amp;free=True"; public static void main(String[] args) throws Exception{ File file = new File(PATH + FILENAME); URL url = new URL(SvDPDFURL); FileUtils.copyURLToFile(url, file); } } the problem is that file is empty, what i'm i doing wrong.
has comment: http://stackoverflow.com/comment/38930128
has comment: http://stackoverflow.com/comment/38931063
has comment: http://stackoverflow.com/comment/38930203
tagged with: apache-commons-io
type: AnsweredQuestion

http://stackoverflow.com/comment/38848325
type: AnswerComment
has text: Great! Yes you don't need that, Hibernate fetches the right dependency for the current core one.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24979080

http://stackoverflow.com/a/25041562
has comment: http://stackoverflow.com/comment/39018836
has comment: http://stackoverflow.com/comment/39014470
has body: It you don't need a parallel stream you can use the length of the map as an index counter: collection.stream().forEach(i -&gt; map.put(i, map.size() + 1));
upvote count: 7
downvote count: 1
has comment: http://stackoverflow.com/comment/38987778
has comment: http://stackoverflow.com/comment/39054549
type: Answer
score: 6
has comment: http://stackoverflow.com/comment/39014739
answers question: http://stackoverflow.com/q/25041177
has comment: http://stackoverflow.com/comment/39015040
has comment: http://stackoverflow.com/comment/38958805

http://stackoverflow.com/comment/38910734
comment on: http://stackoverflow.com/q/25021285
has text: I already tried... the company that developed the portal, don't let the source go.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38875731
type: Comment
has text: Nope...I already tried that. If I put it in a loop, the console goes wild. It keeps asking for age until I stop the console. Also if I put in your code it takes the value of age as 0, no matter what I have inputted initially. i.e. if I input 5.89...this line keeps getting repeated in the console: Please Enter Your Age :Your Age is : 0
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25002852

http://stackoverflow.com/q/25046843
score: 1
tagged with: java
tagged with: hibernate
tagged with: http://stackoverflow.com/tag/json
accepted answer: http://stackoverflow.com/a/25047306
upvote count: 1
type: Question
has body: I am using Hibernate to save my entities to database. For simple example I have two entities: Car: @Entity @Table(name = "car") public class Car implements Serializable { @Id @GeneratedValue private long id; private String name; @OneToMany(cascade = CascadeType.PERSIST) private List&lt;Wheel&gt; wheelList; public Car() { } public Car(String name, List&lt;Wheel&gt; wheelList) { this.name = name; this.wheelList = wheelList; } and Wheel: @Entity @Table(name = "wheel") public class Wheel implements Serializable { @Id @GeneratedValue private long id; private int size; @ManyToOne(cascade = CascadeType.PERSIST) private Car car; public Wheel() { } public Wheel(int size, Car car) { this.size = size; this.car = car; } I am using Spring Framework (MVC) to create REST client, from which I return JSON. And now: I created simple @Repository and @Service. I wanted to try if saving works, so I created simple Car object with its wheel list etc. and then, in @Service layer I have persisted it and returned car object into the controller. Finally, when i run the url from the controller, I recieve HUGE json, because every Car object has wheel list, and then, every wheel has its car, which again has list, and in list are wheels which has cars and so on.. thats why my JSON is so big. {"id":1,"name":"SomeName","wheelList":[{"id":1,"size":1,"car":{"id":1,"name":"SomeName","wheelList":[{"id":1,"size":1,"car":{"id":1,"name":"SomeName","wheelList":[{"id":1,"size":1,"car":{"id":1,"name":"SomeName","wheelList":[{"id":1,"size":1,"car":{"id":1,"name":"SomeName","wheelList":[{"id":1,"size":1,"car":{"id":1,"name":"SomeName","wheelList":[{"id":1,"size":1,"car":{"id":1,"name":"SomeName","wheelList":[{"id":1,"size":1,"car":{"id":1,"name":"SomeName","wheelList":[{"id":1,"size":1,"car":{"id":1,"name":"SomeName","wheelList":[{"id":1,"size":1,"car":{"id":1,"name":"SomeName","wheelList":[{"id":1,"size":1,"car":{"id":1,"name":"SomeName","wheelList":[{"id":1,"size":1,"car":{"id":1,"name":"SomeName","wheelList…
has title: Huge JSON while saving and returning entity using Hibernate
has comment: http://stackoverflow.com/comment/38960064
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/38960672
favorite count: 0
tagged with: spring
has answer: http://stackoverflow.com/a/25047306
type: AnsweredQuestion

http://stackoverflow.com/a/55349585
type: AcceptedAnswer
has body: If you happen to use Apache Commons IO, then you can re-use StringBuilderWriter which is described as follows: Writer implementation that outputs to a StringBuilder. NOTE: This implementation, as an alternative to java.io.StringWriter, provides an un-synchronized (i.e. for use in a single thread) implementation for better performance. For safe usage with multiple Threads then java.io.StringWriter should be used. Its implementation is also straightforward as expected, so you can pattern from it and implement it yourself without adding a new dependency.
answers question: http://stackoverflow.com/q/24955072
type: Answer
score: 3
accepted answer of: http://stackoverflow.com/q/24955072
upvote count: 3
downvote count: 0

http://stackoverflow.com/comment/38848823
type: Comment
score: 0
type: AnswerComment
has text: I'm getting links from a JSON. so there are so many. Some of them are flv and some of them are not. I want to play the videos that are only flv.how do i do that?
comment on: http://stackoverflow.com/a/24988446

http://stackoverflow.com/a/24934420
score: 1
downvote count: 0
has body: change this code mViewPager = new ViewPager(this); mViewPager.setId(R.id.pager); setContentView(mViewPager); mTabsAdapter = new TabsAdapter(this, mViewPager); **mTabsAdapter.addTab(barra.newTab().setIcon(R.drawable.clientes).setText(" Clientes"), ClienteActivity.class, null);** barra = getSupportActionBar(); barra.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); to mViewPager = new ViewPager(this); mViewPager.setId(R.id.pager); setContentView(mViewPager); barra = getSupportActionBar(); barra.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); mTabsAdapter = new TabsAdapter(this, mViewPager); **mTabsAdapter.addTab(barra.newTab().setIcon(R.drawable.clientes).setText(" Clientes"), ClienteActivity.class, null);** Hope this helps...
answers question: http://stackoverflow.com/q/24934291
type: Answer
upvote count: 1

http://stackoverflow.com/q/25006618
has comment: http://stackoverflow.com/comment/38882922
answer count: 0
tagged with: scala
tagged with: java
type: Question
score: 0
has body: I am printing value of scala Map in Java class like below Option&lt;Object&gt; data = JSON.parseFull((String)zkClient.readData(statePath)); scala.collection.immutable.Map&lt;String, Object&gt; leaderInfo = scala.collection.immutable.Map&lt;String, Object&gt;) data.get(); System.out.println(leaderInfo.toString(); But I am surprised that sometimes the value comes as floating point number controller_epoch -&gt; 6.0, leader -&gt; 1.0, version -&gt; 1.0, leader_epoch -&gt; 4.0, isr -&gt; List(1.0) and sometimes as Integer. controller_epoch -&gt; 6, leader -&gt; 1, version -&gt; 1, leader_epoch -&gt; 4, isr -&gt; List(1) I want the data to be always parsed as Integer. Is there any way to do that?
linked to: http://stackoverflow.com/q/18945949
has comment: http://stackoverflow.com/comment/38882942
duplicate of: http://stackoverflow.com/q/18945949
type: UnansweredQuestion
has title: Scala Map values getting printed as float and integer randomly
tagged with: dictionary

http://stackoverflow.com/comment/38952256
type: Comment
has text: I will give it a shot, I have some experience with swing worker so it should be straight forward. On another note, I am creating my colored boxes by using a gridlayout with textboxes that I simply set to a black background. Is there a better way to get simple colored boxes? I tried labels but the system can't handle that many(30,000ish).
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25043007

hql
tag name: hql
tags question: http://stackoverflow.com/q/25032768
tags question: http://stackoverflow.com/q/24934187
tags question: http://stackoverflow.com/q/24917093
type: Tag
tags question: http://stackoverflow.com/q/24919960

http://stackoverflow.com/comment/38911179
score: 2
has text: put it under heavy load with many threads calling it. There should be a difference. You don't need the setVal methods to be synchronized and it should save you some time under heavy load.
comment on: http://stackoverflow.com/q/25021535
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38951660
comment on: http://stackoverflow.com/q/25032651
score: 0
type: Comment
type: QuestionComment
has text: But do have a look at [Failure initializing default system SSL context](http://mail-archives.apache.org/mod_mbox/jena-users/201404.mbox/%3C93E5AB0411004A43A48B3682BB41530D4683A89D%40SDEOT808.hq.corp%3E) from the jena users mailing list.

http://stackoverflow.com/q/24938385
has body: I have following models: @Entity @Table(name = "feature") public class DbFeature { @Id @GeneratedValue public Long id; @ManyToOne public DbProduct product; } @Entity @Table(name = "product") public class DbProduct { @Id @GeneratedValue public Long id; @OneToMany(mappedBy = "product") public List&lt;DbFeature&gt; features; } How I can make Criteria query which will return me all products without features? Thank you!
score: 0
tagged with: java
tagged with: hibernate
answer count: 1
has title: Get entities if list attribute is empty
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24938726
has comment: http://stackoverflow.com/comment/38754621
type: Question

http://stackoverflow.com/q/24915345
downvote count: 0
has answer: http://stackoverflow.com/a/25199380
has title: How to properly apply and customize a global navigation drawer with Activities
tagged with: android
answer count: 1
favorite count: 0
upvote count: 2
accepted answer: http://stackoverflow.com/a/25199380
score: 2
type: AnsweredQuestion
tagged with: android-arrayadapter
tagged with: java
tagged with: navigation-drawer
type: Question
has body: I am working on a big app that has recently adapted the drawer navigation style and now I'm trying to customize some of the elements. Because of its great size and complexity it was decided to adapt the navigation drawer to Activities and Fragment Activites instead of Fragments as the extended standard use. For that I created a base Drawer activity called NavDrawer, which is inherited/extended by all of those activities that need to navigate with the Drawer. Every Activity that extends NavDrawer Activity calls NavDrawer onCreate method by calling super.onCreate(savedInstanceState, R.activity_layout) adding its layout_id instead of executing setContentView(R.layout_id). This base Activity also handles all the intent calls to the other different activities whenever the user clicks on one of the sections/textviews. I managed to make it work pretty well so far but I'm facing now a weird issue when customizing the Typeface of the TextViews inside the drawer. First time it is launched the app, I can see all the links without the proper style, but only after selecting one of the sections of the drawer, navigating to it and opening again the drawer, I see the textviews properly formated with my custom font. I have been struggling with it for a few days already, and I am sure it has to be a stupid rookie mistake but I can´t figure it out what it is. This is the NavDrawer class OnCreate method: protected void onCreate(Bundle savedInstanceState, int resLayoutID) { super.onCreate(savedInstanceState); setContentView(resLayoutID); AC = (ApplicationController)getApplicationContext(); mModel = AC.getModel(); //Setting up controls for the navigation drawer if(AC.getModel().hasRatedApp() != null &amp;&amp; AC.getModel().hasRatedApp()){ mLinksTitles = getResources().getStringArray(R.array.menu_links_has_rated); } else mLinksTitles = getResources().getStringArray(R.array.menu_links_has_not_rated); mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); mDrawerContainer = (Line…

http://stackoverflow.com/comment/38873199
has text: @Minotaur try this. your optionpane wants to know what is the message is it an error message or an information message etc..
type: Comment
comment on: http://stackoverflow.com/a/25001415
score: 0
type: AnswerComment

http://stackoverflow.com/q/25002458
has comment: http://stackoverflow.com/comment/38877170
favorite count: 0
has comment: http://stackoverflow.com/comment/38959353
tagged with: wicket
accepted answer: http://stackoverflow.com/a/25046771
type: AnsweredQuestion
score: 3
tagged with: list
upvote count: 3
tagged with: java
type: Question
has title: Making a model of an item from a list model in wicket
answer count: 2
has answer: http://stackoverflow.com/a/25029457
downvote count: 0
has answer: http://stackoverflow.com/a/25046771
possible better answer: http://stackoverflow.com/a/25029457
has body: Wicket Version: 6.14 I have a LoadableDetachableModel&lt;List&lt;Foo&gt;&gt; I am trying to use the model with a wizard but each page of the wizard will use a single item of the list. I want to get a model of each in the list and change the model between each screen in the wizard. Ideally I could do something like this: PropertyModel&lt;Foo&gt; fooItemModel = new PropertyModel&lt;Foo&gt;(fooItems, "get(0)"); One other idea I have had is to roll my own ListItemModel and make it take an IModel&lt;List&lt;?&gt;&gt; instead of a ListView. public ListItemModel(final ListView&lt;T&gt; listView, final int index) { this.listView = listView; this.index = index; } /** * @see org.apache.wicket.model.IModel#getObject() */ @Override public T getObject() { return listView.getModelObject().get(index); } /** * @see org.apache.wicket.model.IModel#setObject(java.lang.Object) */ @Override public void setObject(T object) { listView.getModelObject().set(index, object); } Any advice is appreciated in advanced

http://stackoverflow.com/q/25036039
answer count: 1
has body: I'm trying to load an application context which is inside a jar as a plugin. I use this to load the context: ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("classpath*:**my-context.xml"); When I load the jar through pom.xml, it works fine. Then I add it directly in the classpath using eclipse instead of maven to avoid to compile every time (ultimate goal is the shared lib folder in tomcat, not working too). Now spring is unable to find it and return a default context (no exception) I checked that it's correctly insert in the classpath using: InputStream in1 = this.getClass().getClassLoader().getResourceAsStream("my-context.xml"); It works. I checked logs. Using the pom.xml, spring is correctly searching in the jar Searching directory [...target\classes\META-INF\maven\x.y.z] for files matching pattern [...\x.y.z/target/classes/**/my-context.xml] Searching directory [...ehealth.poc.module1] for files matching pattern [D:/JRB/Projects/Vivates/workspaces/default/extcom/ehealth.poc.module1/target/classes/**/ecm-context.xml] ... Resolved location pattern [classpath*:**/my-context.xml] to resources [file [...\target\classes\my-context.xml]] Loading XML bean definitions from file [...\target\classes\my-context.xml] ... In the second case, nothing in the log about my jar. Why spring does not have the same behavior when I use maven or directly the classpath? I maven doing something else than simple adding dependencies location in the classpath?
has comment: http://stackoverflow.com/comment/38972310
tagged with: applicationcontext
accepted answer: http://stackoverflow.com/a/25057729
tagged with: maven
has comment: http://stackoverflow.com/comment/38939827
tagged with: spring
tagged with: java
has title: Loading a jar's context.xml from classpath
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38972865
has comment: http://stackoverflow.com/comment/38968884
has answer: http://stackoverflow.com/a/25057729
has comment: http://stackoverflow.com/comment/38973698
score: 0
has comment: http://stackoverflow.com/comment/38967704

http://stackoverflow.com/a/25051919
has comment: http://stackoverflow.com/comment/38973868
has comment: http://stackoverflow.com/comment/38973009
has comment: http://stackoverflow.com/comment/38968270
answers question: http://stackoverflow.com/q/25051827
downvote count: 0
has comment: http://stackoverflow.com/comment/38973156
has comment: http://stackoverflow.com/comment/38973272
type: Answer
has body: In this code while(rsms.next() || rsmo.next()){ if rsms.next() is evaluated to true, then rsmo.next() will not even be called and may be false. In you while loop, when would rsms or rsmo suddenly become null? while (true) { boolean foundms = false; boolean foundmo = false; if (rsms.next()) { // do stuff foundms = true; } if (rsmo.next()) { // do stuff foundmo = true; } if (!foundms &amp;&amp; !foundmo) break; } If this is still not working, then borrowing try (from Darshan's answer ) ResultSet rsmo = dmdo.getColumns(null, null, ORACLETABLENAME, null); ResultSetMetaData md = rsmo.getMetaData(); for (int i=1; i&lt;=md.getColumnCount(); i++) { System.out.println(md.getColumnName(i)); }
has comment: http://stackoverflow.com/comment/38968498
has comment: http://stackoverflow.com/comment/38968782
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/38973093
has comment: http://stackoverflow.com/comment/38968613

http://stackoverflow.com/comment/38901728
type: Comment
score: 0
comment on: http://stackoverflow.com/q/25016172
type: QuestionComment
has text: Eliot I will be adding the saveCollection() to the original post. @Holger I thought so, issue I previously had was that the openCollection() would keep throwing me an EOFException cause like you said, there isn't a direct method that actually knows how 'many' objects there are in your file, so readObject() would ran out of objects and throw the exception which I found very annoying and couldn't leave it throwing that exception in the console all the time

http://stackoverflow.com/comment/38880264
has text: Is this a fancy way of asking if a node is the root of a full subtree?
comment on: http://stackoverflow.com/q/25005165
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38844691
comment on: http://stackoverflow.com/q/24986226
type: QuestionComment
type: Comment
has text: The question is/should be/being changed to: How can I track indices in java?
score: 0

http://stackoverflow.com/comment/38839617
has text: That is a clear violation of Google's terms of use. If you want to share code, post it in your question. But it's really better if you don't. You should really only give us the minimum amount of code that's needed to answer your question.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24978806
type: Comment

http://stackoverflow.com/comment/38773184
has text: Do Python arrays start at one or zero?
score: 0
comment on: http://stackoverflow.com/q/24948099
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24932550
score: 1
answers question: http://stackoverflow.com/q/24932425
upvote count: 1
has body: This is because your log4j jar is not there in the classpath while running your code. Try adding the log4j jar in your classpath (in -cp switch).
type: Answer
downvote count: 0

http://stackoverflow.com/comment/38717848
type: Comment
has text: yes drew you are right it is a assignment
score: 0
comment on: http://stackoverflow.com/q/24918539
type: QuestionComment

build-tools
tags question: http://stackoverflow.com/q/24931340
type: Tag
tag name: build-tools

http://stackoverflow.com/a/25010140
score: 1
answers question: http://stackoverflow.com/q/25009950
downvote count: 0
type: Answer
has body: I did the same by converting to RGB using libyuv library. But I had to do it frame by frame.
upvote count: 1

http://stackoverflow.com/a/24969393
answers question: http://stackoverflow.com/q/24969326
has body: You are missing hibernate.connection.password property. Try adding it and see if it helps.
has comment: http://stackoverflow.com/comment/38813435
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/38813650

http://stackoverflow.com/comment/38911013
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25021376
has text: Save yourself a lot of time and effort and just use a library to do the json parsing. I have had great success with Google Gson (https://code.google.com/p/google-gson/). You create Classes and map the json to them directly.
score: 0

http://stackoverflow.com/comment/38930647
type: Comment
comment on: http://stackoverflow.com/q/25032083
score: 0
type: QuestionComment
has text: please show us the initial query used to retrieve those 4 rows in your example!

http://stackoverflow.com/q/24984729
tagged with: apache-tomee
favorite count: 0
has body: I'm trying to configure an example JPA application in Eclipse, and deploy it to TomEE+. The datasource is container managed. I keep seeing the following error when attempting to create the EntityManager: The persistence provider is attempting to use properties in the persistence.xml file to resolve the data source. A Java Database Connectivity (JDBC) driver or data source class name must be specified in the openjpa.ConnectionDriverName or javax.persistence.jdbc.driver property. The following properties are available in the configuration: "org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl@414793b4". Any idea what is wrong with this configuration? Below is the code. tomee.xml JdbcDriver com.microsoft.sqlserver.jdbc.SQLServerDriver JdbcUrl jdbc:sqlserver://localhost:1433/db_dev UserName user Password password JtaManaged true DefaultAutoCommit false persistence.xml org.apache.openjpa.persistence.PersistenceProviderImpl jdbc/MyAppDS social.Media Media.java package social; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.Table; @Entity @Table(name = "media") public class Media { @Id @Column(name = "id") private String id; private String description; private String title; public String getId() { return id; } public void setId(String id) { this.id = id; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } } Controller.java package social; import javax.inject.Inject; import javax.persistence.EntityManager; import javax.persistence.EntityManagerFactory; import javax.persistence.Persistence; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; @Path("/hello") public class Controller { @Inject private Media media; @GET @Produces(MediaType.TEXT_PLAIN) public Strin…
has answer: http://stackoverflow.com/a/24990407
tagged with: openjpa
upvote count: 1
type: Question
type: AnsweredQuestion
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/24990407
has title: TomEE + OpenJPA: Error creating EntityManager using container managed DataSource
tagged with: openejb
answer count: 1
downvote count: 0

http://stackoverflow.com/comment/38713849
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24913833
score: 0
has text: Check that multicast is enabled on your network interface

jtable
tags question: http://stackoverflow.com/q/24975286
tags question: http://stackoverflow.com/q/25068976
tags question: http://stackoverflow.com/q/25015951
tags question: http://stackoverflow.com/q/24943190
tags question: http://stackoverflow.com/q/24989521
tags question: http://stackoverflow.com/q/24916011
tags question: http://stackoverflow.com/q/24968748
tags question: http://stackoverflow.com/q/24957727
tags question: http://stackoverflow.com/q/25018084
tags question: http://stackoverflow.com/q/25004987
tags question: http://stackoverflow.com/q/25007660
tags question: http://stackoverflow.com/q/25057782
type: Tag
tags question: http://stackoverflow.com/q/25032052
tags question: http://stackoverflow.com/q/24930545
tags question: http://stackoverflow.com/q/25066696
tags question: http://stackoverflow.com/q/25016497
tags question: http://stackoverflow.com/q/24918884
tags question: http://stackoverflow.com/q/25057107
tags question: http://stackoverflow.com/q/24940806
tags question: http://stackoverflow.com/q/24995971
tags question: http://stackoverflow.com/q/24986087
tags question: http://stackoverflow.com/q/25043191
tag name: jtable
tags question: http://stackoverflow.com/q/24976142
tags question: http://stackoverflow.com/q/25005302
tags question: http://stackoverflow.com/q/24953653
tags question: http://stackoverflow.com/q/24966974
tags question: http://stackoverflow.com/q/24952514
tags question: http://stackoverflow.com/q/24992469
tags question: http://stackoverflow.com/q/24932977
tags question: http://stackoverflow.com/q/25002050
tags question: http://stackoverflow.com/q/24981422
tags question: http://stackoverflow.com/q/24981478
tags question: http://stackoverflow.com/q/25015808
tags question: http://stackoverflow.com/q/24964856

http://stackoverflow.com/comment/38887357
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24989905
has text: Also, the substring method is one less than the final character, I have tested it on an online compiler and (0,4) should give me 4 letters.
score: 0

http://stackoverflow.com/a/24952793
answers question: http://stackoverflow.com/q/24952500
has comment: http://stackoverflow.com/comment/38781680
type: Answer
has body: What do you mean by My code is not working? Are you getting any error?. If so , what is that.? Can you post your Exception Trace. From your code Process proc = runtime.exec("powershell D:\\exportasxml.ps1"); Did you set powershell path to the environment variable? You need to make sure that the command you are executing is in the correct path.
score: 0

http://stackoverflow.com/a/24986783
answers question: http://stackoverflow.com/q/24986748
has body: try numeros.set(2, 12); to update ArrayList member
score: 0
type: Answer

http://stackoverflow.com/comment/38826620
has text: @NichoDiaz It depends on whether this value is constant across all characters of the same type (such as Warrior), or each character can have a different value. The former would imply a constant in the class, while the latter would imply a property in the CharacterType class, with a getter and setter.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24976677

http://stackoverflow.com/comment/38945575
type: QuestionComment
comment on: http://stackoverflow.com/q/25030857
score: 0
has text: thanks for reply Ruchira i just want to simulate the regex with simple java code and know this regex works fine
type: Comment

http://stackoverflow.com/a/25029353
answers question: http://stackoverflow.com/q/25029228
upvote count: 3
type: Answer
downvote count: 0
has body: No it wont. The maximum lower and upper limit for the integer (int) in Java is -2,147,483,648 to 2,147,483,647. Remember that 'int' consumes 4 Bytes (32 Bits). Lets put this in Binary now..It is: 1111111 11111111 11111111 11111111 7 bits 8 bits 8 bits 8 bits In total it is 31 bits (the first column has only 7 bits). The remaining one bit is the Sign bit - The sign bit indicates the sign. If set(ie. 1), it is negative, if not - positive. So for positive number (max) it would be 01111111 11111111 11111111 11111111 and for negative it would be 11111111 11111111 11111111 11111111 So the sizes are going to be the same. Languages like C,C++ and C# - support unsigned integers (uint) which is also 32 bits and have a range of 0 to 4,294,967,295. It discards the sign bit and counts it in.
score: 3

http://stackoverflow.com/comment/38972832
type: Comment
comment on: http://stackoverflow.com/a/25053767
has text: i'm sorry... and i just did. thanks in adv
score: 0
type: AnswerComment

http://stackoverflow.com/a/25065559
answers question: http://stackoverflow.com/q/25065275
type: Answer
has comment: http://stackoverflow.com/comment/38994582
score: 0
has comment: http://stackoverflow.com/comment/38994642
has body: Try this: Query query = getEntityManager.createQuery( "select DISTINCT TRUNC(src.CreationDate) from myTable src ORDER by src.CreationDate" ); List&lt;Object[]&gt; rows = query.list(); for (Object[] row: rows) { System.out.println("My date" + row[0]); }

http://stackoverflow.com/comment/38759819
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24939955
has text: @user3771297 There are ways to disable certificate verification, but they're a terrible idea 99.9999999% of the time. It *feels* like a quick way, but it leads to more trouble later on: you'll either have to remove that code before it goes into production, or you'll forget and leave a security hole in your application (remember that you're turning off an "alarm" without addressing the problem, it's likely not to get noticed before a release). Neither are good options.

http://stackoverflow.com/q/24956968
possible better answer: http://stackoverflow.com/a/24960310
has answer: http://stackoverflow.com/a/24957059
downvote count: 0
has answer: http://stackoverflow.com/a/24960310
linked to: http://stackoverflow.com/q/1458048
tagged with: traveling-salesman
favorite count: 0
accepted answer: http://stackoverflow.com/a/24957059
tagged with: c++
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
has title: Implementation of a particular Travelling-Salesman variation
type: Question
tagged with: algorithm
has body: I'm looking for an algorithm(C/C++/Java - doesn't matter) which will resolve a problem which consists of finding the shortest path between 2 nodes (A and B) of a graph. The catch is that the path must visit certain other given nodes(cities). A city can be visited more than once. Example of path(A-H-D-C-E-F-G-F-B) (where A is source, B is destination, F and G are cities which must be visited). I see this as a variation of the Traveling Salesman Problem but I couldn't find or write a working algorithm based on my searches. I was trying to find a solution starting from these topics but without any luck: https://stackoverflow.com/questions/24856875/tsp-branch-and-bound-implementation-in-c and Variation of TSP which visits multiple cities
answer count: 2

http://stackoverflow.com/a/25008323
answers question: http://stackoverflow.com/q/25008310
score: 2
downvote count: 0
upvote count: 2
type: Answer
has body: getInput() is a static method in another class, you should call it as follows: String s1 = Menu.getInput("Enter a numeric value: "); // ^ the name of the class should come before the method name

http://stackoverflow.com/a/25041673
answers question: http://stackoverflow.com/q/25041477
type: AcceptedAnswer
downvote count: 0
has body: Hyperthreading is enabled by the fact that all modern JVMs use native threads, thus this is a OS/CPU config setting. However Hyperthreading does not give you extra cores, it permits fine grained timeshare of the four cpus that you have. That is, while one thread is stalled, say waiting for a page of memory to be flown into the cache then another thread can swoop in and make use of parts of the CPU. It adds about 10% extra to the size of a CPU core due to more complex scheduling requirements and does not benefit all applications. If you have maxed out the four cpus with four threads, then that is possible with hyperthreading turned on or off. It just means that those threads are running hot, without blocking much. The reason that Java reports an 8 core CPU, rather than 4 is because the OS tells Java that the CPU has 8 cores. The OS believes that because the OS has been told to schedule threads as though it was an 8 core CPU, this made adding support of hyperthreading to OSes much simpler. The OS carries on managing threads as before, oblivious to much of the inner workings of hyperthreading and lets the CPU manage the low level scheduling of the assembly as and when parts of the cpu become available. A more detailed discussion, with benchmarks can be read here
upvote count: 8
type: Answer
score: 8
accepted answer of: http://stackoverflow.com/q/25041477
has comment: http://stackoverflow.com/comment/76057072

http://stackoverflow.com/comment/38932876
has text: Would string.removeAll("mig:") be an option?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25033285

http://stackoverflow.com/a/25464530
score: 5
upvote count: 5
type: Answer
downvote count: 0
has body: In short, having a meta model of your entities available at compile time helps you reduce the number of run-time errors. Specifically, with a meta model you may (list is by far not exhaustive) ensure the syntactical correctness of a broader range of queries at compile time (compared to pure JPQL queries) build dynamic, type safe queries (using e.g. Spring Data JPA >= 1.5) take advantage when e.g. specifying the sort order as you can't introduce any typos as in the case with strings Cf. Dynamic, typesafe queries in JPA 2.0 and Spring Data JPA
answers question: http://stackoverflow.com/q/25014572

http://stackoverflow.com/q/25020501
has title: #sinfonier BOLT - Adding a jarray object to output
type: Question
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/26650133
has body: If I make JSONArray array = new JSONArray(); [...] this.addField("array", array); it generates: {..., "array":"[\"x\", \"y\"]" } When it should be: {..., "array": ["x", "y"] } The sinfonier probably calls toString on the jarray object. I think it should create a full json and then call toString on the full json. Is there any other way to do this? (this is a sinfonier specific question, sorry, but no sinfonier tag available yet)
has answer: http://stackoverflow.com/a/25122811
type: UnansweredQuestion
tagged with: java

http://stackoverflow.com/comment/38969865
has text: Tell them not to do that? Seriously, get everyone to use the same character encoding - anything else will lead to madness. Pretty much *everything* supports UTF-8 these days, so why not just standardize on that?
type: QuestionComment
comment on: http://stackoverflow.com/q/25052796
score: 5
type: Comment

http://stackoverflow.com/comment/38863071
type: AnswerComment
comment on: http://stackoverflow.com/a/24994747
score: 0
type: Comment
has text: I tried but the problem remains, i modified it to this:

http://stackoverflow.com/q/24918579
tagged with: facebook-apps
score: 0
has answer: http://stackoverflow.com/a/24918827
answer count: 1
type: UnansweredQuestion
tagged with: facebook
tagged with: java
has title: Facebook application issue with callbackurl?
has body: In facebook application i define Deauthorize Callback URL - http://www.domainname.com/3c/login/fblogin.xhtml Valid OAuth redirect URIs - http://www.domainname.com/3c/login/fblogin.xhtml -Site URL - http://www.domainname.com now if someone access website like http://domainname.com/3c i am getting exception Warning Given URL is not allowed by the Application configuration.: One or more of the given URLs is not allowed by the App's settings. It must match the Website URL or Canvas URL, or the domain must be a subdomain of one of the App's domains. Any one know how to resolve this issue
type: Question

http://stackoverflow.com/comment/38899913
type: Comment
comment on: http://stackoverflow.com/a/25015708
has text: Make sure when you run with "Web Service" program, that it actually pays attention to `-Xmx512m`. If you pass this option to Netbeans, that won't give more memory to Java code started by Netbeans. You'll have to specify this option in the launch configuration (somewhere in the "Run" dialog)!!
score: 0
type: AnswerComment

http://stackoverflow.com/comment/55405312
type: Comment
has text: @agf sorry to ask different thing , How can we know that payment done by client is using Paypal or credit card ?
comment on: http://stackoverflow.com/a/25024771
type: AnswerComment
score: 0

http://stackoverflow.com/comment/38808676
type: QuestionComment
comment on: http://stackoverflow.com/q/24967153
has text: It looks like he's using libgdx (AWT doesn't have a Screen interface)
score: 0
type: Comment

http://stackoverflow.com/q/24945153
tagged with: android
has comment: http://stackoverflow.com/comment/38768585
has title: Android: PointF exception
answer count: 0
type: UnansweredQuestion
tagged with: multithreading
has body: My android app with SurfaceView, Thread and OnTouch with PointF randomly trashes it doesn't happen quite often but it's annoying in logcat this is what I get: 07-24 23:51:54.330 13133-13216/com.moving.igra.app W/dalvikvm﹕ threadid=11: thread exiting with uncaught exception (group=0x41580ba8) 07-24 23:51:54.330 13133-13216/com.moving.igra.app E/AndroidRuntime﹕ FATAL EXCEPTION: Thread-1385 Process: com.moving.igra.app, PID: 13133 java.lang.ClassCastException: java.lang.Object cannot be cast to android.graphics.PointF at com.moving.igra.app.SurfaceViewThread.onDraw(SurfaceViewThread.java:105) at com.moving.igra.app.SurfaceViewThread.run(SurfaceViewThread.java:154) at java.lang.Thread.run(Thread.java:841) Logcat says that the problem is in line 105: PointF First_Touch= mActivePointers.valueAt(0); PointF Second_Touch= mActivePointers.valueAt(1); //This is the code in OnDraw So far I didn't find any solutions for this Exception, literature about PointF is not extensive. Thank you for answers
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/38792578
tagged with: surfaceview
has comment: http://stackoverflow.com/comment/38767955
score: 0

http://stackoverflow.com/comment/39219940
has text: could you check if the view_departure_details.xml file has any margins? I would remove those
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25113632

http://stackoverflow.com/q/25043465
type: Question
has answer: http://stackoverflow.com/a/25251946
tagged with: java
has body: Trying to insert message loaded from MimeMessage (as shown in gmail api example), some messages are passing fine, but some throws this: com.google.api.client.googleapis.json.GoogleJsonResponseException: 400 Bad Request <TITLE>Bad Request Bad Request Error 400 at com.google.api.client.googleapis.json.GoogleJsonResponseException.from(GoogleJsonResponseException.java:145) at com.google.api.client.googleapis.services.json.AbstractGoogleJsonClientRequest.newExceptionOnError(AbstractGoogleJsonClientRequest.java:113) at com.google.api.client.googleapis.services.json.AbstractGoogleJsonClientRequest.newExceptionOnError(AbstractGoogleJsonClientRequest.java:40) at com.google.api.client.googleapis.services.AbstractGoogleClientRequest$1.interceptResponse(AbstractGoogleClientRequest.java:312) at com.google.api.client.http.HttpRequest.execute(HttpRequest.java:1049) at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:410) at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:343) at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.execute(AbstractGoogleClientRequest.java:460) The code is next: final ByteArrayOutputStream baos = new ByteArrayOutputStream(); mime.writeTo(baos); String encodedEmail = Base64.encodeBase64URLSafeString(baos.toByteArray()); tmpMail = new Message(); tmpMail.setRaw(encodedEmail); client.users().messages().insert(this.taskInfo.getTargetAccount(), tmpMail).execute(); Without any other information, what could be a possible reason for that error ? Thanks. UPD. Looks like messages larger than 10Mb are giving this error. Google guys, can you advise ? Thanks
upvote count: 2
answer count: 2
tagged with: google-api-java-client
favorite count: 0
tagged with: gmail-api
has title: Gmail API insert message throws - Bad Request (400)
has comment: http://stackoverflow.com/comment/38977148
has answer: http://stackoverflow.com/a/25124669
has comment: http://stackoverflow.com/comment/38952686
score: 2
downvote count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38952743

http://stackoverflow.com/comment/38766529
type: QuestionComment
comment on: http://stackoverflow.com/q/24944304
has text: @TJ-: Yes, I do have control over shell script
score: 0
type: Comment

http://stackoverflow.com/comment/38741676
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24931776
score: 1
has text: you can either subclass the broadcast receiver inside your activity, or, use the delegation pattern

http://stackoverflow.com/comment/38791950
has text: not really no, plus I am missing the follow up events, now
type: Comment
comment on: http://stackoverflow.com/a/24958282
score: 0
type: AnswerComment

http://stackoverflow.com/comment/38830755
type: Comment
comment on: http://stackoverflow.com/a/24978959
has text: is this a limitation of the logger, that it will crash, or not log, at least, when hit with an exception? Seems rather pointless if the **logger** fails to write an exception to the log file. Why didn't it write that error to the file? It had no problem dumping it to the console.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/38734596
has text: Yup you can use JPanel for that
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24927826
score: 0

http://stackoverflow.com/a/24933812
type: Answer
has comment: http://stackoverflow.com/comment/38746150
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/38745886
upvote count: 2
accepted answer of: http://stackoverflow.com/q/24933253
has body: Your working solution is fine (and similar to what I've used before). If you only want to bind once you can use a CTE or inline view to provide the value to the real query: WITH CTE AS ( SELECT ? AS REAL_VALUE FROM DUAL ) SELECT C.* -- but not * really, list all the columns FROM CTE JOIN CUSTOMERS C ON (CTE.REAL_VALUE IS NULL AND C.CUSTOMER_ID IS NULL) OR C.CUSTOMER_ID = CTE.REAL_VALUE So there is only one placeholder to bind. I don't really see a problem with a branch on the Java side though, unless your actual query is much more complicated and would lead to significant duplication.
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24933253

http://stackoverflow.com/comment/38886689
type: QuestionComment
comment on: http://stackoverflow.com/q/25006488
has text: `ClassNotFoundException` basically some path problem post the project structure
score: 0
type: Comment

http://stackoverflow.com/a/25043134
has comment: http://stackoverflow.com/comment/59123715
upvote count: 20
has body: It's possible that your 'src' directory isn't set as a source directory? Your IDE seems to be seeing your com.example.fovoapp as a simple directory structure instead of a package. Also looking at your linked image, the little "J" on the java files tells me that also. When a java file is set as source usually it shows up as a Class "C". I could be wrong but make sure you set your src directory as source and that should fix the issue.
score: 20
downvote count: 0
answers question: http://stackoverflow.com/q/25041104
type: Answer

http://stackoverflow.com/a/25002713
answers question: http://stackoverflow.com/q/25002281
has comment: http://stackoverflow.com/comment/38875564
has body: You can't call runOnUiThread from the UI thread. You need to call it from a separate thread. Try this To edit @Gintas_ answer: public static void setInVisLife3C() { new Thread(new Runnable() { public void run() { runOnUiThread(new Runnable() { public void run() { life3C.setVisibility(View.INVISIBLE); } }); } }).start;
score: 0
type: Answer

http://stackoverflow.com/comment/38748719
comment on: http://stackoverflow.com/q/24922539
type: Comment
type: QuestionComment
has text: Your current solution of using large PNG shapes would not produce blurry edges if you use filter (MipMapLinearLinear, Linear). Make sure you load the Texture with `useMipMaps` set to true.
score: 0

http://stackoverflow.com/q/24939312
downvote count: 0
has title: Log4 logging HTTP responses with HEX codes
score: 6
has comment: http://stackoverflow.com/comment/39111248
has answer: http://stackoverflow.com/a/25130061
tagged with: logging
type: Question
tagged with: java
upvote count: 6
has comment: http://stackoverflow.com/comment/39111249
answer count: 2
has comment: http://stackoverflow.com/comment/38818932
tagged with: httpclient
has body: The HTTP client requests are logged in regular ASCII, but the responses are getting logged in hex codes. I set up my log4j file just like another application that doesn't have this problem. httpclient.wire.content &gt;&gt; &lt;/soap:Envelope&gt; ... httpclient.wire.content &lt;&lt; "[0x1f][0x8b][0x8][0x0][0x0][0x0][0x0][0x0][0x0][0x0]}[0x93][0xc1]N[0xc3]0[0xc][0x86][0xef]&lt;E[0xe9][0xbd]M[0xcb][0xc4][0xa5]*E m[0x82][0x3]Lb[0xbc]@XM[0x89][0xd4]&amp;!N[0xd3][0x8d][0xa7]G[0xed][0x9a]-[0xe9][0xd6][0xdd][0xe2][0xdf][0x9f][0xed]8vr[0x14]TfKn[0xa0][0x16][0x12][0x82]]Ss[0xcc]z[0xed]![0xfc][0xd1]Zf[0x84]t][0x17]w[0x8b]X[0xa8][0x8a][0xdc]%[0xc9][0x82]$[0xf7][0xa4][0xf7]G0[0xc6][0x84]c[0x90]I[0x8f]![0x86][0x81][0xc2][0xd8][0xd0][0xb8][0x12][0x86][0xc0]7"1iX[0xdc][0x4]A[0x90][0xf][0xe5]^[0x80][0x96][0xa0][0x88][0xa3]&lt;[0x8b]r?[0x98][0xbd]b[0xd2][0xc][0xdb][0xaf][0x86][0xe9][0x95]P[0xcd][0x7][0xa0][0x14][0x1c][0xe1][\r][0x10]i[0x5][0x16][0x1a]9[0xa1]X[0xc5]8[0xd5]L[0xf0][0xd7][0xb2]x[0xcc][0xc9][0x99][0xe6][0xf3]C^D[0x17][0xf7]$[0x9f][0xd6][0x8a]r[0x9c][0xf2][0x13][0xd1][0x8f]P[0xf0][0xdb][0x2][0xea]#|[0xb2]g[0xee][0xcd][0xab][0xb5][0xaa](g^?[0xc3]}[0xdf]i[0x3][0xd3]..[0x10]N[0xae][0xdb
has comment: http://stackoverflow.com/comment/39111062
favorite count: 0
tagged with: apache-httpclient-4.x
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39110951
has answer: http://stackoverflow.com/a/70421345
has comment: http://stackoverflow.com/comment/39111641
tagged with: log4j

http://stackoverflow.com/comment/38791547
comment on: http://stackoverflow.com/q/24958214
score: 0
type: Comment
has text: The shadow process has received part of a call from the client process (for example, SQL*Plus, Pro*C, and JDBC) in the first network package and is waiting for more data for the call to be complete. Examples are large SQL or PL/SQL block and insert statements with large amounts of data.
type: QuestionComment

http://stackoverflow.com/a/25013702
type: Answer
answers question: http://stackoverflow.com/q/25011089
has body: My sound Manager didn't work because i havent called assetManager.update() in render method.
score: 0

http://stackoverflow.com/comment/38808983
comment on: http://stackoverflow.com/q/24967352
type: QuestionComment
type: Comment
has text: You mean serialize from `package`?
score: 0

http://stackoverflow.com/q/24981625
has comment: http://stackoverflow.com/comment/38861073
has comment: http://stackoverflow.com/comment/38871749
type: UnansweredQuestion
tagged with: vim
score: 2
has body: executing :ProjectCreate /path -n android gives java.lang.RuntimeException: no command android list targets found while executing command (port: 9091): -editor vim -command android_list_targets
downvote count: 0
has comment: http://stackoverflow.com/comment/38839302
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/25953969
upvote count: 2
tagged with: eclim
tagged with: android
answer count: 1
has title: eclim android list targets command not found
favorite count: 0

http://stackoverflow.com/a/24936775
score: 0
has comment: http://stackoverflow.com/comment/38751394
has comment: http://stackoverflow.com/comment/38751690
has body: You can achieve in many ways: Use a config file Maybe you can use config file, for example, there is a config.properties, which has level = 10, you load it in a Listener when web server start, and store in memory via a Map, and you can change/access it any time, you can send the value via json to front-end too. Use Application scope variable in jsp/servlet
answers question: http://stackoverflow.com/q/24936521
type: Answer

http://stackoverflow.com/comment/38842940
type: Comment
comment on: http://stackoverflow.com/q/24971552
score: 0
has text: Yes the SAN is in the code: "ip:127.0.0.1,dns:localhost,uri:https://127.0.0.1:8112"
type: QuestionComment

http://stackoverflow.com/a/25052275
has comment: http://stackoverflow.com/comment/59991983
has comment: http://stackoverflow.com/comment/44951630
has comment: http://stackoverflow.com/comment/38994866
has comment: http://stackoverflow.com/comment/38991314
has comment: http://stackoverflow.com/comment/38999414
has comment: http://stackoverflow.com/comment/38983486
upvote count: 6
has comment: http://stackoverflow.com/comment/38987527
has comment: http://stackoverflow.com/comment/38985339
has comment: http://stackoverflow.com/comment/44950826
has comment: http://stackoverflow.com/comment/38986070
has body: Orcale 12c supports IDENTITY and SQL SERVER 2012 supports SEQUENCES. I believe a SEQUENCE is always a better choice than an IDENTITY. IDENTITY disables batching and SEQUENCES allow you to provide optimizers, such as the pooled-lo optimization strategy. This is how the actual identifier generator is chosen for the configured GenerationType value: switch ( generatorEnum ) { case IDENTITY: return "identity"; case AUTO: return useNewGeneratorMappings ? org.hibernate.id.enhanced.SequenceStyleGenerator.class.getName() : "native"; case TABLE: return useNewGeneratorMappings ? org.hibernate.id.enhanced.TableGenerator.class.getName() : MultipleHiLoPerTableGenerator.class.getName(); case SEQUENCE: return useNewGeneratorMappings ? org.hibernate.id.enhanced.SequenceStyleGenerator.class.getName() : "seqhilo"; } If you use the new identifier generators: properties.put("hibernate.id.new_generator_mappings", "true"); The AUTO will actually use a SequenceStyleGenerator and where the database doesn't support sequences, you end up using a TABLE generator instead (which is a portable solution but it's less efficient than IDENTITY or SEQUENCE). If you use the legacy identifier generators, you then end up with the "native" generation strategy, meaning: public Class getNativeIdentifierGeneratorClass() { if ( supportsIdentityColumns() ) { return IdentityGenerator.class; } else if ( supportsSequences() ) { return SequenceGenerator.class; } else { return TableHiLoGenerator.class; } } If a new Oracle12gDialect is going to be added and it will support IDENTITY, then AUTO might switch to IDENTITY rather than SEQUENCE, possibly breaking your current expectations. Currently there is no such dialect available so on Oracle you have SEQUENCE and in MSSQL you have IDENTITY. Conclusion: Try it like this: @Id @GenericGenerator(name = "native_generator", strategy = "native") @GeneratedValue(generator = "native_generator") private Long id; make the id a Long instead of Integer, and you can let the HBMDDL …
answers question: http://stackoverflow.com/q/25047226
has comment: http://stackoverflow.com/comment/38989993
score: 6
type: Answer
has comment: http://stackoverflow.com/comment/38983429
has comment: http://stackoverflow.com/comment/38986370
downvote count: 0

http://stackoverflow.com/comment/38782667
has text: `if(mat1[i][j] == mat2[i][j])` is just doing an int comparision. if mat1 is n_1 and mat2 is n_2 the loop is just check whether 10 == 13, 12 == -1 and so on.
comment on: http://stackoverflow.com/q/24953306
type: Comment
score: 2
type: QuestionComment

http://stackoverflow.com/a/24967302
accepted answer of: http://stackoverflow.com/q/24947428
has body: Authorization is done following the OAuth 2.0 protocol, once you have a token from that, you can use the Firebase API. The firebase protocol does not provide direct authorization.
answers question: http://stackoverflow.com/q/24947428
downvote count: 1
type: Answer
score: 1
upvote count: 2
type: AcceptedAnswer

http://stackoverflow.com/comment/38901332
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25015071
has text: Rounding and make the calculation is the way to go. Thanks for the suggestion. Writing off the balance. I updated the question as well.
score: 0

http://stackoverflow.com/q/25045003
has comment: http://stackoverflow.com/comment/38955440
has body: I'm downloading files from a remote location, and the download is complete for smaller sized files and in-complete for large sized files (>10 MB). Here is my code that i have used for downloading files from remote server . File dstFile = null; // check the directory for existence. String dstFolder = LOCAL_FILE.substring(0,LOCAL_FILE.lastIndexOf(File.separator)); if(!(dstFolder.endsWith(File.separator) || dstFolder.endsWith("/"))) dstFolder += File.separator; // Creates the destination folder if doesn't not exists dstFile = new File(dstFolder); if (!dstFile.exists()) { dstFile.mkdirs(); } try { URL url = new URL(URL_LOCATION); HttpURLConnection connection = (HttpURLConnection) url.openConnection(); connection.addRequestProperty("User-Agent", "Mozilla/4.76"); //URLConnection connection = url.openConnection(); BufferedInputStream stream = new BufferedInputStream(connection.getInputStream()); int available = stream.available(); byte b[]= new byte[available]; stream.read(b); File file = new File(LOCAL_FILE); OutputStream out = new FileOutputStream(file); out.write(b); } catch (Exception e) { System.err.println(e); VeBLogger.getInstance().log( e.getMessage()); }
tagged with: download
has comment: http://stackoverflow.com/comment/38955504
possible better answer: http://stackoverflow.com/a/25045101
type: Question
has answer: http://stackoverflow.com/a/25045101
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25045224
has answer: http://stackoverflow.com/a/25045180
upvote count: 5
tagged with: java
score: 5
downvote count: 0
tagged with: p2
has answer: http://stackoverflow.com/a/75527585
accepted answer: http://stackoverflow.com/a/25045224
favorite count: 0
has comment: http://stackoverflow.com/comment/38955334
has title: How to download large sized Files (size > 50MB) in java
answer count: 4

http://stackoverflow.com/q/24998247
tagged with: drools
tagged with: drools-guvnor
upvote count: 2
has comment: http://stackoverflow.com/comment/87280251
favorite count: 0
tagged with: classloader
has comment: http://stackoverflow.com/comment/47758717
score: 2
has title: Drools 6 with custom class loader
answer count: 0
downvote count: 0
type: UnansweredQuestion
tagged with: java
type: Question
has body: I have a class I would like to use in a Drools 6.0.1 decision table that is not in the default class loader. I created a custom class loader that I would like to use in Drools but I can only find the KieBaseConfiguration class to set it. This does not seem to have an effect on the KieBuilder which is returning an "Unable to find Class" error. How do I set the class loader for the builder? Code is below: // Create the classloader and make sure the class is available. ClassLoader loader = getClassLoader(); Class&lt;?&gt; clazz = loader.loadClass("actions.TestAction"); // Create the model KieServices kieServices = KieServices.Factory.get(); KieModuleModel kieModuleModel = kieServices.newKieModuleModel(); KieBaseModel kieBaseModel1 = kieModuleModel.newKieBaseModel( "KBase1") .setDefault( true ) .setEqualsBehavior( EqualityBehaviorOption.EQUALITY ) .setEventProcessingMode( EventProcessingOption.STREAM ); KieSessionModel model = kieBaseModel1.newKieSessionModel( "KSession1" ) .setDefault( true ) .setType( KieSessionModel.KieSessionType.STATELESS ) .setClockType( ClockTypeOption.get("realtime") ); // Create a new configuration with the new classloader. Does not seem to // do anything with regard to rule compilation. KieBaseConfiguration kbaseConf = kieServices.newKieBaseConfiguration( null, loader ); // Create a file system and load the rule. KieFileSystem kfs = kieServices.newKieFileSystem(); String decisionTable = ",RuleSet,\n"+ ",Import,conditions.test.TestCondition\n"+ ",Sequential,TRUE\n"+ ",,\n"+ ",RuleTable System Table,\n"+ ",CONDITION,ACTION\n"+ ",TestCondition,testAction\n"+ ",conditionID,test(\"$param\")\n"+ "Case,Table,Log\n"+ "Test,10027,Random Text\n"+ ",,\n"+ ",,\n"+ ",Variables,actions.TestAction testAction\n"; kfs = kfs.write("src/main/resources/KBase1.csv", decisionTable); // Build the rules. I get a compilation error here, actions.TestAction class // not found. KieBuilder kieBuilder = kieServices.newKieBuilder(kfs).buildAll();

http://stackoverflow.com/comment/38899099
type: Comment
score: 0
comment on: http://stackoverflow.com/a/25014168
type: AnswerComment
has text: right click on netbeans select prop>run in compatibility with window 7 or xp. try that @JerryGoyal

http://stackoverflow.com/a/24926515
downvote count: 0
score: 3
upvote count: 3
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24926438
has body: Use following code public List&lt;TimeSeriesPowerPK&gt; getPowerUsageForUser(String minutes) { Query query = sessionFactory.getCurrentSession().createQuery("From TimeSeriesPowerPK where dateTime &lt;=:param1 AND dateTime &gt;= :parma2 "); query.setParameter("param1",currentDateObject); query.setParameter("param2",userEnteredDateObject); List&lt;TimeSeriesPowerPK&gt; powerUsedList=query.list(); return powerUsedList; } Note that dateTime of the class must be mapped to createdOn column of database table. Hope it helps.
answers question: http://stackoverflow.com/q/24926438
type: Answer

http://stackoverflow.com/comment/38747166
comment on: http://stackoverflow.com/q/24934612
type: QuestionComment
type: Comment
has text: Add it to your LD_LIBRARY_PATH before starting Java. Also, get `libopencv_core.so.2.3` your application isn't linked with`libopencv_core.so.2.4`
score: 0

http://stackoverflow.com/a/24920543
answers question: http://stackoverflow.com/q/24914525
has comment: http://stackoverflow.com/comment/42822721
has comment: http://stackoverflow.com/comment/38737916
has comment: http://stackoverflow.com/comment/38762791
has comment: http://stackoverflow.com/comment/38727095
has comment: http://stackoverflow.com/comment/38756132
type: Answer
has comment: http://stackoverflow.com/comment/38762210
has comment: http://stackoverflow.com/comment/38751074
has comment: http://stackoverflow.com/comment/39134594
has comment: http://stackoverflow.com/comment/38764209
downvote count: 0
has body: Updates: Changes to C++ As written: Compilation Failure Replace math.h => cmath 27610 milliseconds Add -O3 flag 4416 milliseconds Replace std::list with std::vector 2294 milliseconds Replace Point with std::pair 2384 milliseconds Made verifierNonPrise const correct 2351 milliseconds Replaced loop in verifierNonPrise with std::find_if 929 milliseconds Replacing double with int (to make it equiv to Java) 549 milliseconds Changes to Java As written 3459 milliseconds Changes verifierNonPrise early return 368 milliseconds Java Vs C++ &gt; javac HuitDames.java &gt; time java HuitDames real 0m0.368s user 0m0.436s sys 0m0.042s &gt; g++ -O3 -std=c++11 HuitDames.cpp &gt; time ./a.out real 0m0.541s user 0m0.539s sys 0m0.002s Final Code: #include &lt;iostream&gt; #include &lt;vector&gt; #include &lt;cmath&gt; #include &lt;stdlib.h&gt; #include &lt;chrono&gt; #include &lt;algorithm&gt; using namespace std; typedef std::pair&lt;int, int&gt; Point; #define LARGEUR_GRILLE 22 vector&lt;Point&gt; positions; bool verifierNonPrise(Point const&amp; emplacement) { return std::find_if(positions.begin(), positions.end(), [&amp;emplacement](Point const&amp; val){ if (val.first != emplacement.first) { if ((val.second == emplacement.second) || (abs(val.second - emplacement.second) == abs(val.first - emplacement.first))) { return true; } } return false; }) == positions.end(); } bool placerDame(int i) { bool bonnePosition = false; for (int j = 1; j &lt;= LARGEUR_GRILLE &amp;&amp; !bonnePosition; j++) { Point emplacement(i,j); positions.push_back(emplacement); if (verifierNonPrise(emplacement) &amp;&amp; (i == LARGEUR_GRILLE || placerDame(i + 1))) { bonnePosition = true; } else { positions.pop_back(); } } return bonnePosition; } int main() { using std::chrono::system_clock; system_clock::time_point begin_time = system_clock::now(); int i = 1; placerDame(i); for (vector&lt;Point&gt;::iterator it = positions.begin(); it!= positions.end(); it++) { cout &lt;&lt; "(" &lt;&lt; it-&gt;first &lt;&lt; ";…
score: 89
has comment: http://stackoverflow.com/comment/38755744
has comment: http://stackoverflow.com/comment/38760975
upvote count: 89
has comment: http://stackoverflow.com/comment/38751344
has comment: http://stackoverflow.com/comment/38748868
has comment: http://stackoverflow.com/comment/42820681
has comment: http://stackoverflow.com/comment/38756215

http://stackoverflow.com/a/53724328
score: 3
upvote count: 3
answers question: http://stackoverflow.com/q/24926786
downvote count: 0
has body: If you are not bound to specifically use gson library you can solve this deserializing using jackson one as follow: new ObjectMapper().readValue(yourJson, new TypeReference&lt;Map&lt;String,Object&gt;&gt;() {}); Here a complete junit test that expose the differences between the two libraries deserializing an integer value: @Test public void integerDeserializationTest() throws Exception { final String jsonSource = "{\"intValue\":1,\"doubleValue\":2.0,\"stringValue\":\"value\"}"; //Using gson library "intValue" is deserialized to 1.0 final String gsonWrongResult = "{\"intValue\":1.0,\"doubleValue\":2.0,\"stringValue\":\"value\"}"; Map&lt;String,Object&gt; gsonMap = new Gson().fromJson(jsonSource, new TypeToken&lt;Map&lt;String, Object&gt;&gt;() { }.getType()); assertThat(new Gson().toJson(gsonMap),is(gsonWrongResult)); //Using jackson library "intValue" is deserialized to 1 Map&lt;String,Object&gt; jacksonMap = new ObjectMapper().readValue(jsonSource, new TypeReference&lt;Map&lt;String,Object&gt;&gt;() {}); assertThat(new ObjectMapper().writeValueAsString(jacksonMap),is(jsonSource)); }
type: Answer

http://stackoverflow.com/q/25037383
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38940295
has answer: http://stackoverflow.com/a/25037806
has title: Duplicate detection on very large data
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/38940728
has body: I'm very new to Java so forgive me if I'm doing something terribly wrong. I'm working on a project where I need to quickly scan a very large volume of data (CSV with 50 million lines or more, 5 entries per line) for repeats. I've resorted to using a HashMap, since its .contains() method is fast. However, I end up having to store a million keys or more in the map. Each key is associated with an int[] array, which would have from 1 to 100 entries as well. So obviously, I end up getting an OutOfMemory error unless I'm using a laptop with ~16 GB of RAM. I was thinking that once the HashMap gets more than N keys or a key gets more than N entries, I could write it somewhere and clear it. However, not all keys or values are found at once, so I need to be able to add to the written hashmap, and not overwrite it. I've searched far and wide and still can't find a way to do it, so thanks a lot to whoever can help!
tagged with: duplicates
score: 4
upvote count: 4
answer count: 3
has comment: http://stackoverflow.com/comment/38941480
downvote count: 0
linked to: http://stackoverflow.com/q/2594829
has answer: http://stackoverflow.com/a/25037968
linked to: http://stackoverflow.com/q/930044
has answer: http://stackoverflow.com/a/25037465
favorite count: 0
has comment: http://stackoverflow.com/comment/38940746
has comment: http://stackoverflow.com/comment/38940308
linked to: http://stackoverflow.com/q/4095523
tagged with: out-of-memory

http://stackoverflow.com/q/25016526
answer count: 0
type: UnansweredQuestion
tagged with: android
has title: Can't connect to db android because error parsing json
tagged with: php
has comment: http://stackoverflow.com/comment/38906598
tagged with: java
has comment: http://stackoverflow.com/comment/38901785
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/38901759
type: Question
has comment: http://stackoverflow.com/comment/38901912
score: 0
has comment: http://stackoverflow.com/comment/38901815
has body: I can't connect and display my json from my website because i get an error: java.lang.String cannot be converted to JSONArray this is the code: public class MainActivity extends Activity { /** Called when the activity is first created. */ private TextView results; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build(); StrictMode.setThreadPolicy(policy); results = (TextView) findViewById(R.id.results); results.setText(invioDati()); } public String invioDati() { String risultati = ""; String stringaFinale = ""; ArrayList&lt;NameValuePair&gt; nameValuePairs = new ArrayList&lt;NameValuePair&gt;(); nameValuePairs.add(new BasicNameValuePair("idnomerichiesto","1")); InputStream is = null; //HTTP post richiesta try { HttpClient httpClient = new DefaultHttpClient(); HttpPost httpPost = new HttpPost("http://www.davidedellai.net/jsonphp.php"); httpPost.setEntity(new UrlEncodedFormEntity(nameValuePairs)); HttpResponse response = httpClient.execute(httpPost); HttpEntity entity = response.getEntity(); is = entity.getContent(); } catch (Exception e) { Toast.makeText(this, "Errore connessione", Toast.LENGTH_SHORT).show(); e.printStackTrace(); } if (is != null) { // converto la risposta in stringa try { BufferedReader reader = new BufferedReader(new InputStreamReader(is, "utf-8"), 8); StringBuilder sb = new StringBuilder(); String line = null; while ((line = reader.readLine()) != null) { sb.append(line + "\n"); } is.close(); risultati = sb.toString(); }catch (Exception e) { // errore conversione in stringa Toast.makeText(this, "Errore stringa "+e.toString(), Toast.LENGTH_SHORT).show(); e.printStackTrace(); } // parsing dei dati dal json try { JSONArray jArray = new JSONArray(risultati); for (int i=0;i&lt;jArray.length();i++){ JSONObject json_data = jArray.getJSONObject(i); Log.i("Test", "post_title " + json_data.getString…

http://stackoverflow.com/q/24955972
has title: It finds a file but it does not "scan" it (Java, Eclipse)
type: Question
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/24956148
has body: I am using Eclipse Luna Java EE, and moved a previous project to it. I am trying to read a .txt file. I know that the program "sees" the file, but when it tests the scanner object to check if it "hasNext", the result is always false. Is there something I'm missing? package visualLaw; //package system; import java.io.*; import java.util.*; import java.io.FileWriter; import java.io.File; import java.io.FileReader; import java.io.FileNotFoundException; import java.io.FileInputStream; import java.io.IOException; import javax.swing.SwingUtilities; public class ParseFile { public static void main (String[] args){ File plan = new File("plan.txt"); final ReadFile rf = new ReadFile(plan); } } class ReadFile{ Scanner s =null; ReadFile(File file){ try { s = new Scanner (file); System.out.println(file.getAbsolutePath()); }catch (Exception e) { System.out.println("FEIL: argsfilen"); } In the above code, I get the url displayed correctly, and all. But when I execute the code below, it does not read a single line, and if I try it without testing, it gives me a nullpoint error. while(s.hasNext()) { System.out.println("Did I get here?"); try { tag = s.next(); }catch (Exception e) { System.out.println("FEIL: argsfilen"); } } } Any help would be greatly appreciated!
has answer: http://stackoverflow.com/a/24956148
type: AnsweredQuestion
tagged with: java.util.scanner
tagged with: java
tagged with: eclipse

http://stackoverflow.com/comment/38800964
score: 0
type: Comment
type: QuestionComment
has text: @HotLicks I understand what you are saying, however anything outside the above code should see the three methods exactly in the same way (they have the same signature and exactly functional behavior), being the reason I conclude whatever is impacting these numbers is having access to the implementation. In fact, if I switch the implementation but keep everything else the same, the numbers change accordingly.
comment on: http://stackoverflow.com/q/24960771

http://stackoverflow.com/comment/38976856
type: Comment
has text: @Silviu Burcea: Yes, thanks for this hint. It's the solution: `progressBar.setMinimumSize(progressBar.getPreferredSize());`
score: 1
comment on: http://stackoverflow.com/q/25055992
type: QuestionComment

http://stackoverflow.com/comment/39017326
score: 0
type: AnswerComment
has text: @sneha: change the variable `combined` as an array instead of string and you can achieve the result.
type: Comment
comment on: http://stackoverflow.com/a/25058025

http://stackoverflow.com/q/25054866
has comment: http://stackoverflow.com/comment/38973684
has comment: http://stackoverflow.com/comment/38973657
has comment: http://stackoverflow.com/comment/38973649
type: Question
has comment: http://stackoverflow.com/comment/38973881
has comment: http://stackoverflow.com/comment/38973985
tagged with: java
has comment: http://stackoverflow.com/comment/38973793
has comment: http://stackoverflow.com/comment/38973685
score: 0
has title: Declare String in class or method
answer count: 1
tagged with: string
has comment: http://stackoverflow.com/comment/38973734
has body: I just started thinking about this but can not come up with whats best. The string declared will only be used in one method and will never be changed. Should the string be declared in the method or as static final in the class? Example in class: public class DBHandler { final String sqlInsertHouse = "INSERT INTO " tableName + " VALUES (?,?)"; public void insertHouse(String name, String type) { //use sqlInsertHouse string in query. } } Example in method: public class DBHandler { public void insertHouse(String name, String type) { final String sqlInsertHouse = "INSERT INTO " tableName + " VALUES (?,?)"; //use sqlInsertHouse string in query. } } So which one should I use? If it depends on the situation then please give some examples.
has comment: http://stackoverflow.com/comment/38973784
has comment: http://stackoverflow.com/comment/38974093
has answer: http://stackoverflow.com/a/25055266
accepted answer: http://stackoverflow.com/a/25055266
type: AnsweredQuestion

http://stackoverflow.com/comment/38884347
has text: I'm thinking if the URL si also correct for accessing the resources?
comment on: http://stackoverflow.com/q/24954600
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26403975
answers question: http://stackoverflow.com/q/24952292
upvote count: 7
downvote count: 0
has comment: http://stackoverflow.com/comment/66259193
has body: Production mode is supported by Jhipster, it is the procedure detailed above which is simply not complete. Reason The -Pprod argument is used to profile the build for production mode, but it does not tell Tomcat to actually enable that mode so it falls back to the default `dev' mode. Solution As explained in Jhipster on-line documentation, to enable production mode, simply add -Dspring.profiles.active=prod to your JAVA_OPTS. You may achieve this by editing your &lt;tomcat-home&gt;/bin/setenv.sh / .bat file, for instance.
has comment: http://stackoverflow.com/comment/63038550
has comment: http://stackoverflow.com/comment/66592486
type: Answer
score: 7

http://stackoverflow.com/comment/38908520
type: QuestionComment
comment on: http://stackoverflow.com/q/25018627
has text: Are you sure there are 2 items in the collection?
score: 0
type: Comment

http://stackoverflow.com/comment/38732014
has text: With this i mean, that with every `writeObject()` call the object is appended to the file, instead of updating the object already in the file.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24925591

http://stackoverflow.com/q/24927283
favorite count: 0
has body: In an Android application that I am writing, I have a document image (jpeg) that is being uploaded to a server that recognizes the document and sends me back the relevant details. While all that is well and fine, the code in the server expects me to set the "Image DPI" meta-information as seen in mac like so, The "Image DPI" that is shown in the above screenshot, isn't exactly its value. I have written a method that calculates the dpi-value. How do I set the thusly calculated dpi-value to the meta-information of my jpeg document? I have been able to set this particular meta-information in the application's iOS counterpart, but in Android, two days of relentless trying has left my errand futile. I do know about ExifInterface, and I have been unlucky in using its setAttribute(String key,String value) method. (What should be the key? What should be the value? How do I set the unit? SHOULD I set the unit?). I have also seen Java-related solutions to this that suggest the use of javax.imageio.*package which is simply unavailable for Android. Has anyone faced issues like this? How do I go on about this issue?
upvote count: 2
tagged with: android
accepted answer: http://stackoverflow.com/a/28477733
tagged with: http://stackoverflow.com/tag/jpeg
has title: Setting the DPI meta-information for a jpeg file in Android
score: 2
type: AnsweredQuestion
tagged with: metadata
tagged with: java
type: Question
downvote count: 0
has comment: http://stackoverflow.com/comment/45278142
has answer: http://stackoverflow.com/a/28477733
has comment: http://stackoverflow.com/comment/45277416
has comment: http://stackoverflow.com/comment/45277549
answer count: 1

http://stackoverflow.com/a/24911159
upvote count: 10
has body: You can use a Supplier and constructor reference: public static void main(String[] args) { new Parser(new File[]{}, Template1::new); } Parser(File[] files, Supplier&lt;Template&gt; templateFactory) { for (File f : files) { Template t = templateFactory.get(); } } The Function type could be used for a one-argument constructor like Template1(File): public static void main(String[] args) { new Parser(new File[]{}, Template1::new); } Parser(File[] files, Function&lt;File, Template&gt; templateFactory) { for (File f : files) { Template t = templateFactory.apply(f); } } The Java 8 API provides a number of standard functional interfaces in the java.util.function package though these typically don't extend beyond two arguments. You can either use 3rd party nary functional interfaces (I made some for KludJe) or write your own. A custom implementation might look like this: public static void main(String[] args) { new Parser(new File[]{}, Template1::new); } Parser(File[] files, TemplateFactory templateFactory) { for (File f : files) { Template t = templateFactory.createFrom(f); } } public static interface TemplateFactory { Template createFrom(File file); }
answers question: http://stackoverflow.com/q/24911052
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/39167296
has comment: http://stackoverflow.com/comment/39166050
has comment: http://stackoverflow.com/comment/39164380
accepted answer of: http://stackoverflow.com/q/24911052
type: Answer
has comment: http://stackoverflow.com/comment/38703158
has comment: http://stackoverflow.com/comment/39162645
score: 10

http://stackoverflow.com/comment/38889519
type: Comment
comment on: http://stackoverflow.com/a/25006726
has text: was trying to figure out if it was picking up a different version somehow. What your version of Leiningen then ?
score: 0
type: AnswerComment

http://stackoverflow.com/comment/38907305
has text: @SamDufel I'm sorry but I didn't understand what do you mean..
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25005165
score: 0

http://stackoverflow.com/comment/38914413
type: QuestionComment
comment on: http://stackoverflow.com/q/25023132
has text: Could you please show the code which reads the properties-file?
score: 0
type: Comment

http://stackoverflow.com/comment/38955101
type: Comment
comment on: http://stackoverflow.com/a/25044748
score: 1
has text: @user3889083 What other problems? Your question only asks about 'cannot refer to non-static...'
type: AnswerComment

http://stackoverflow.com/q/24935235
accepted answer: http://stackoverflow.com/a/24935487
has answer: http://stackoverflow.com/a/24935391
has body: I am making a linked list program in Java. However when I invoke the method get_values(); it keeps asking for input. I can't seem to stop it. Since I can't figure out the problem in the code, I am pasting the whole program code here. import java.io.*; //Importing Java Input-Output Library class Node { int x; Node next; //Initializing Node data type named next Node() //method to set all values to 0 { x=0; next=null; } void get_data(int a) //get data from user { x=a; } int put_data() // print returned values { return x; } } class List { Node start; //Another node (user created variable) List() { start=null; } void Add_Node(int a) // Add or Creating new nodes and linking them { Node n=new Node(); n.get_data(a); if(start==null) { start=n; } else if(start!=null) { for(Node temp=start, prev=start; temp!=null; prev=temp, temp=temp.next) //sorting { if(temp.x&gt;n.x &amp;&amp; temp==start) { n.next=temp; start=n; } else if(temp.x&lt;n.x &amp;&amp; temp.next==null) { temp.next=n; } else if(temp.x&gt;n.x &amp;&amp; prev.x&lt;n.x) { n.next=temp; prev.next=n; } } } } void traverse() //printing traversed values { for(Node temp=start; temp!=null; temp=temp.next) { System.out.print(temp.put_data()+" "); } } void extraction(int b) throws IOException { InputStreamReader ist=new InputStreamReader(System.in); BufferedReader br=new BufferedReader(ist); int a; for(int i=0; i&lt;5; i++) { System.out.println("Enter the value for node "+i+":"); a=Integer.parseInt(br.readLine()); Add_Node(a); } traverse(); Node store_new=null; boolean match_check=false; for(Node temp=start, prev=start; temp!=null; prev=temp, temp=temp.next) { if(temp.x==b &amp;&amp; temp!=null) { match_check=true; store_new=temp; break; } else if(temp.x!=b) { //match_check=false; } } if(match_check==true) { System.out.println("Value found. The value address is: "+store_new+" and the value stored in it is: "+store_new.x); } else if(match_check==false) { System.out.println("Value not found in the list, please enter a value wh…
possible better answer: http://stackoverflow.com/a/24935326
has answer: http://stackoverflow.com/a/24935487
answer count: 3
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/24935326
tagged with: input
has title: LinkedList never terminates input taking in Java
score: 2
type: AnsweredQuestion
upvote count: 2
tagged with: java
type: Question

http://stackoverflow.com/q/24989527
upvote count: 1
tagged with: swing
has answer: http://stackoverflow.com/a/24989649
tagged with: jbutton
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24989563
score: 1
tagged with: java
type: Question
tagged with: actionlistener
has answer: http://stackoverflow.com/a/24989679
downvote count: 0
has title: How to make an action command for same buttons
has body: I have here just a snip of code for my button: up = new JButton(new ImageIcon("more_buttons\\up3.png")); up.setBackground(new Color(224,223,227)); up.setPreferredSize(new Dimension(5,15)); up.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { value1000++; if(value1000&gt;0) { number.setText(value1000+""); down.setEnabled(true); } } }); down = new JButton(new ImageIcon("more_buttons\\down3.png")); down.setBackground(new Color(224,223,227)); down.setPreferredSize(new Dimension(5,15)); down.setEnabled(false); down.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { value1000--; if(value1000&gt;0) { number.setText(value1000+""); } if(value1000==0) { number.setText(value1000+""); down.setEnabled(false); } } }); I'm wondering if I can make an action command for this button so that I won't have to repeat this code throughout my program. I only have to call the function like buttonaction(e) or something like that. I'm not used to creating action command but I have used it before but only for appending text. I'm not sure how to do that with a function like this. Is it possible? Or is there a more efficient way to do this?
accepted answer: http://stackoverflow.com/a/24989563
answer count: 3
favorite count: 0
possible better answer: http://stackoverflow.com/a/24989649

http://stackoverflow.com/comment/38988523
type: AnswerComment
score: 0
type: Comment
has text: Alright so let me get this straight, upon connection the server sends a symmetric secret key to the client, but the server cannot encrypt this secret key because the client has no way of decrypting it until it has this symmetric key?
comment on: http://stackoverflow.com/a/25062226

http://stackoverflow.com/comment/38771100
score: 0
type: Comment
has text: `new File(stringValue)`?
comment on: http://stackoverflow.com/a/24946401
type: AnswerComment

http://stackoverflow.com/a/24991091
answers question: http://stackoverflow.com/q/24953288
downvote count: 0
type: Answer
score: 2
upvote count: 2
has body: You should take a look at the Marshalling XML using O/X Mappers from the Spring reference. Perhaps you will find the answer. Another Option would be to use Jaxb with spring using java Pojo.

http://stackoverflow.com/comment/38818171
has text: This is the recursion formula for the polynomials for the intervals. The terms are added (more precisely, linear combinations), but there's no overall "sum" in the same quality as a Taylor series.
type: Comment
comment on: http://stackoverflow.com/a/24971702
type: AnswerComment
score: 0

jdbc
tags question: http://stackoverflow.com/q/25066798
tags question: http://stackoverflow.com/q/25010454
tags question: http://stackoverflow.com/q/25032252
tags question: http://stackoverflow.com/q/24954818
tags question: http://stackoverflow.com/q/24917917
tags question: http://stackoverflow.com/q/25058682
tags question: http://stackoverflow.com/q/24911183
tags question: http://stackoverflow.com/q/25001655
tags question: http://stackoverflow.com/q/25030650
tags question: http://stackoverflow.com/q/25044828
tags question: http://stackoverflow.com/q/24940217
tags question: http://stackoverflow.com/q/25024482
tags question: http://stackoverflow.com/q/25065241
tags question: http://stackoverflow.com/q/24987186
tags question: http://stackoverflow.com/q/25042763
tags question: http://stackoverflow.com/q/24934090
tags question: http://stackoverflow.com/q/24918353
tags question: http://stackoverflow.com/q/24926193
tags question: http://stackoverflow.com/q/25008939
type: Tag
tags question: http://stackoverflow.com/q/24935889
tags question: http://stackoverflow.com/q/25037522
tags question: http://stackoverflow.com/q/24937220
tags question: http://stackoverflow.com/q/25036439
tags question: http://stackoverflow.com/q/25009371
tags question: http://stackoverflow.com/q/24909476
tags question: http://stackoverflow.com/q/25024894
tags question: http://stackoverflow.com/q/25015868
tags question: http://stackoverflow.com/q/24971331
tags question: http://stackoverflow.com/q/25011968
tags question: http://stackoverflow.com/q/25031445
tags question: http://stackoverflow.com/q/24965775
tags question: http://stackoverflow.com/q/25003745
tags question: http://stackoverflow.com/q/25068178
tags question: http://stackoverflow.com/q/25057107
tags question: http://stackoverflow.com/q/24934243
tags question: http://stackoverflow.com/q/24942961
tags question: http://stackoverflow.com/q/25027739
tags question: http://stackoverflow.com/q/24971856
tags question: http://stackoverflow.com/q/24910827
tags question: http://stackoverflow.com/q/25034352
tags question: http://stackoverflow.com/q/24919678
tags question: http://stackoverflow.com/q/24949685
tags question: http://stackoverflow.com/q/24977748
tags question: http://stackoverflow.com/q/24966611
tags question: http://stackoverflow.com/q/24998959
tags question: http://stackoverflow.com/q/25032083
tags question: http://stackoverflow.com/q/25065473
tags question: http://stackoverflow.com/q/24916471
tags question: http://stackoverflow.com/q/25040344
tags question: http://stackoverflow.com/q/24978090
tag name: jdbc
tags question: http://stackoverflow.com/q/25039021
tags question: http://stackoverflow.com/q/24971384
tags question: http://stackoverflow.com/q/24943894
tags question: http://stackoverflow.com/q/24957727
tags question: http://stackoverflow.com/q/24909275
tags question: http://stackoverflow.com/q/24973259

http://stackoverflow.com/comment/38716686
score: 1
comment on: http://stackoverflow.com/q/24918124
type: Comment
type: QuestionComment
has text: You're using `==` instead of `.equals`. See here: http://stackoverflow.com/questions/513832/how-do-i-compare-strings-in-java

http://stackoverflow.com/a/26906447
upvote count: 1
type: Answer
has body: There is another workaround for you, if you don't want to change the ant path. Just change the env variable path with C:\Progra~1\apache.... and if your files are placed in program files(x86) then instead of Progra~1 , write Progra~2. But it's advisable to keep them in a path, with no space in the folder's name
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/25022892

http://stackoverflow.com/comment/38816806
type: Comment
type: QuestionComment
has text: Roger that sir! sorry for the misleading code I gave you before..I'm figuring how to use a jlabel
comment on: http://stackoverflow.com/q/24971336
score: 0

http://stackoverflow.com/comment/38884765
comment on: http://stackoverflow.com/q/25007475
score: 1
type: Comment
has text: What if you manually set some rendering hints? Such as `imageG.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);` `imageG.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);`
type: QuestionComment

http://stackoverflow.com/comment/38807226
type: Comment
type: QuestionComment
score: 0
has text: You can expose the action errors like any other field; check out the docs.
comment on: http://stackoverflow.com/q/24966334

http://stackoverflow.com/q/25042529
type: Question
has answer: http://stackoverflow.com/a/25060698
score: 0
tagged with: java
answer count: 1
tagged with: menuitem
has title: One key MenuItem.setAccelerator()
has body: I want to set one-key MenuItem accerelator. I know how to do this for KeyCombination, e.g: MenuItem.setAccelerator(new KeyCodeCombination(KeyCode.S, KeyCombination.CONTROL_DOWN)); ..but I'm stuck on one-key shortcut implementation, for example for F5, or ALT keys. I know, that I can get most of the one-key shortcut's functionality by using MenuItem.setOnKeyPressed(new EventHandler&lt;KeyEvent&gt;()); method, but I prefer to avoid this, and also, I like accelerator's text label on the right of related MenuItem:
type: UnansweredQuestion
tagged with: javafx-8
tagged with: keyboard-shortcuts

concurrency
tag name: concurrency
tags question: http://stackoverflow.com/q/25027835
tags question: http://stackoverflow.com/q/24923159
tags question: http://stackoverflow.com/q/25031383
tags question: http://stackoverflow.com/q/25010448
tags question: http://stackoverflow.com/q/25020305
tags question: http://stackoverflow.com/q/25062434
tags question: http://stackoverflow.com/q/25048385
tags question: http://stackoverflow.com/q/25001321
tags question: http://stackoverflow.com/q/25050574
tags question: http://stackoverflow.com/q/24976746
tags question: http://stackoverflow.com/q/24911333
tags question: http://stackoverflow.com/q/25001331
tags question: http://stackoverflow.com/q/25015803
tags question: http://stackoverflow.com/q/24918252
type: Tag
tags question: http://stackoverflow.com/q/24996260
tags question: http://stackoverflow.com/q/25014512
tags question: http://stackoverflow.com/q/24935533
tags question: http://stackoverflow.com/q/24981551

http://stackoverflow.com/q/25011089
answer count: 2
tagged with: assets
type: UnansweredQuestion
tagged with: android
has body: I found this solution to load my sounds, but it always writes "file not loaded". eatSound.wav is located in the assets folder. Am I using the correct path to eatSound? How can I know what is the correct path? private AssetManager assetManager; public SoundManager(){ assetManager = new AssetManager(); assetManager.load("eatSound.wav",Sound.class); } public boolean startMusic() { if(assetManager.isLoaded("eatSound.wav")) { Sound sound= assetManager.get("eatSound.wav", Sound.class); sound.play(); }else { System.out.println("not loaded yet"); return false; } return true; } When I use Sound sound = new Sound(Gdx.files.internal("eatSound.wav")); sound.play(); It starts to work correctly after 10/20 times I call play() method. So I have decided to use assetManager. But I am not sure if I am using the correct file path for my sound.
linked to: http://stackoverflow.com/q/20830760
has answer: http://stackoverflow.com/a/25013702
has answer: http://stackoverflow.com/a/25011316
has title: libgdx path to file when using assetManager.load();
type: Question
tagged with: libgdx
tagged with: java
has comment: http://stackoverflow.com/comment/38891799
score: 0

http://stackoverflow.com/comment/38847287
comment on: http://stackoverflow.com/a/24986130
score: 0
type: AnswerComment
has text: Personally, I think your question is fine now: it has a short piece of code that is complete, and you included the error and what you did to get it. For some people, your example didn't cause any problems because their default country settings use '.' for the decimal separator. But if you had known that this was the problem, you wouldn't have needed to post this question.
type: Comment

http://stackoverflow.com/a/25102224
type: Answer
answers question: http://stackoverflow.com/q/24955589
has body: check this out if you go here it will install the latest version of java and most things I use as a LAMP developer will now load, as it triggers a command line tool update to appear which i think is what is missing to get most dev things running. (PHPStorm, BREW, Oh MY ZSH etc) [http://support.apple.com/kb/DL1572][1] Also i noticed that once i installed JAVA and the command line tool update my user migrations now appear to complete and not fail.
score: 0

http://stackoverflow.com/comment/39000656
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25067915
type: Comment
has text: I am not sure about the stream process , what you mean. Please bear with me. Upto my understanding I am doing the same thing - reading a record , parsing it to a generic record , sending it to drools framework and then writing it to a file. what I am missing here ? Yes records are independent of each other. I have added the code for my mapper implementation.

http://stackoverflow.com/comment/38799143
type: Comment
has text: The `println()` loop also needs to account for the number of doubles actually read.
comment on: http://stackoverflow.com/a/24962097
type: AnswerComment
score: 0

http://stackoverflow.com/comment/38877739
comment on: http://stackoverflow.com/q/25003001
has text: When i restart the firewall device, mails start coming from application to my mailbox.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25058745
accepted answer: http://stackoverflow.com/a/25058776
favorite count: 0
upvote count: 1
has answer: http://stackoverflow.com/a/25058776
type: AnsweredQuestion
score: 1
tagged with: java
has title: various ways to get session access object in struts2 other than implementing SessionAware interface
has body: guys I'm beginner to Struts2 .i'm trying to use session but i could not create session object by implementing SessionAware So is there is any other way to creates session object other than SessionAware thanks in advance any help will be appreciated
type: Question
tagged with: session
tagged with: struts2
downvote count: 0
answer count: 1

http://stackoverflow.com/a/25057070
has body: The API for the split method states that "If the expression does not match any part of the input then the resulting array has just one element, namely this string." So, as the String blank doesn't contain a ",", a String[] with one element (i.e. blank itself) is returned. For the String comma, "nothing" is left of the original string thus an empty array is returned. This seems to be the best solution if you want to process the returned result, e. g. String[] splits = aString.split(","); for(String split: splits) { // do something }
answers question: http://stackoverflow.com/q/25056607
downvote count: 0
score: 1
upvote count: 1
type: Answer

http://stackoverflow.com/comment/38919876
type: Comment
comment on: http://stackoverflow.com/q/25006597
type: QuestionComment
has text: Between you and @recursivePointer, I was able to get my servlet running as expected. Thank you very much!
score: 0

http://stackoverflow.com/q/25059063
has comment: http://stackoverflow.com/comment/38981347
has comment: http://stackoverflow.com/comment/38981488
has answer: http://stackoverflow.com/a/25059093
answer count: 3
upvote count: 0
has title: this keyword accepted in onClick(View v) method
has comment: http://stackoverflow.com/comment/38982038
has body: I'm new to Android environment I'm just wondering why does the OnClick(View v) method accepts this if the required parameter is in type View and my method extends Activity? Is there a relationship between View and Activity? Please refer to the code to make the question clearer. ... public class MainActivity extends Activity implements OnClickListener { private Button btn1; private Button btn2; @Override protected void onCreate(Bundle savedInstanceState){ ... btn1 = (Button)findViewById(R.id.button1); btn2 = (Button)findViewById(R.id.button2); // Below are the methods calling which confuses me btn1.setOnClickListener(this); btn2.setOnClickListener(this); ... } public void onClick(View v) { int id = v.get(); switch(id) { case R.id.button1: //statement for button1 case R.id.button2: //statement for button2 ... } } } EDIT:This question is misleading, just caused by overlooking 'setOnClickListener(...)' is the same as 'onClick(...)'. I just don't know how to close this question.
favorite count: 0
has comment: http://stackoverflow.com/comment/38982432
has comment: http://stackoverflow.com/comment/38982873
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/1972579
tagged with: interface
has answer: http://stackoverflow.com/a/25059317
tagged with: android
has comment: http://stackoverflow.com/comment/38981838
linked to: http://stackoverflow.com/q/504904
has answer: http://stackoverflow.com/a/25059146
tagged with: java
downvote count: 2
type: Question
score: -2

http://stackoverflow.com/q/24973059
has comment: http://stackoverflow.com/comment/38820074
tagged with: listview-adapter
has body: I intend to add extra items to the ListView and then have the ListView refreshed to display these items. However, I believe that the items are being added (since when i rotate, the ListView is refreshed and shows the new items) but the refreshing is not currently occurring. To initially add items to the ListView. I use getData. After that, every time the "add more" item is clicked, data is retrieved from getDataMore. I have tried functions such as addAll() and notifyDataSetChanged() but i believe my structure is at fault. FragmentA - Fragment which contains the ListView with the click listener: public class FragmentA extends Fragment implements OnItemClickListener { getData data = getData.getMyData(); public Integer ArticleID; public CustomList adapter; public ListView listView; public View v; public View V; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { V = inflater.inflate(R.layout.fragment_a, container, false); listView = (ListView)V.findViewById(R.id.list); v = inflater.inflate(R.layout.single_row_loadmore, null); listView.addFooterView(v); adapter = new CustomList(getActivity(), data.Headline.toArray(new String[data.Headline.size()]), data.Description.toArray(new String[data.Description.size()]), data.BitmapList.toArray(new Bitmap[data.BitmapList.size()]), data.ArticleID.toArray(new Integer[data.ArticleID.size()])); listView.setAdapter(adapter); listView.setOnItemClickListener(this); return V; } @Override public void onItemClick(AdapterView&lt;?&gt; parent, View v, int position, long id) { if((position + 1) &lt; listView.getCount()){ // TODO Auto-generated method stub Integer IDPasser; Intent intent = new Intent(getActivity(), ArticleViewer.class); VariableStore.ArticleID = (Integer) data.ArticleID.toArray()[position]; // Log.e("Passer", IDPasser.toString()); startActivity(intent); }else{ Log.e("", "Load more has been clicked"); new getDataMore().runData(); adapter = new CustomList(getActivity(), da…
has comment: http://stackoverflow.com/comment/38820765
tagged with: arraylist
score: 0
tagged with: android-listview
answer count: 1
has comment: http://stackoverflow.com/comment/38820089
has title: ListView is not refreshing after adding additional items
has answer: http://stackoverflow.com/a/24973583
tagged with: android
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/24973583
linked to: http://stackoverflow.com/q/4088862
type: Question

http://stackoverflow.com/q/24948169
has comment: http://stackoverflow.com/comment/38773345
has answer: http://stackoverflow.com/a/24948261
has answer: http://stackoverflow.com/a/24980642
tagged with: java
has answer: http://stackoverflow.com/a/24948262
has title: i have a controller redirect to a url I want that parameters should not be displayed as a query string
type: Question
tagged with: jakarta-ee
has body: i am using sendRedirect("http://api.mVaayoo.com/mvaayooapi/MessageCompose?user=someuser@gmail.com:123456&amp;senderID=TEST SMS&amp;receipientno=0987654321&amp;dcs=0&amp;msgtxt="+ message + "&amp;state=4") to call mvaayoo api for sendind sms .But the parameters are displayed in address bar to the client . Is there a way to hide query string? I dont want to purchase SSL certificate.
has comment: http://stackoverflow.com/comment/38833517
score: 0
has answer: http://stackoverflow.com/a/24948238
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/24668988
answer count: 4

http://stackoverflow.com/q/25003745
type: AnsweredQuestion
tagged with: apache-poi
downvote count: 0
score: 1
has title: how to compare two HashMap<String, List<String>>
has comment: http://stackoverflow.com/comment/38879117
tagged with: excel
type: Question
has body: i want to compare data read from an excel file(key is column 1, value is column 2) that is being put into a HashMap with data obtained from SQL query. At first i did it using HashMap&lt; String, String> because i had to compare only &lt; key, value> pairs, but now i have to compare &lt; key, list> and i am a little stuck. Here is my code for reading the xls file: public class ReadExcel { HashMap&lt;String, List&lt;String&gt;&gt; result = new HashMap&lt;String, List&lt;String&gt;&gt;(); public HashMap&lt;String, List&lt;String&gt;&gt; process() { try { result.clear(); FileInputStream file = new FileInputStream(new File("C:/some.xlsx")); //Create Workbook instance holding reference to .xlsx file XSSFWorkbook workbook = new XSSFWorkbook(file); //Get first/desired sheet from the workbook XSSFSheet sheet = workbook.getSheetAt(0); //Iterate through each rows one by one Iterator&lt;Row&gt; rowIterator = sheet.iterator(); while (rowIterator.hasNext()) { List&lt;String&gt; xlsList = new ArrayList&lt;String&gt;(); Row row = rowIterator.next(); Cell cell = row.getCell(1); Cell cell2 = row.getCell(2); String key =""; String value=""; xlsList.clear(); switch (cell.getCellType()) { case Cell.CELL_TYPE_NUMERIC: key = getStringCellValue(cell); value = getNumericCellValue(cell2); break; case Cell.CELL_TYPE_STRING: key = getStringCellValue(cell); value = getStringCellValue(cell2); break; } xlsList.add(value); result.put(key, xlsList); } } } For example in my excel file for row 1: column 1 = car, column 2 = blue row 2: column 1 = car, column 2 = yellow. When i run the excel reader, it puts the values "blue, yellow" very nice under "car" key in the HashMap. When i have for example: row 1: column 1 = car, column 2 = blue row 2: column 1 = car, column 2 = yellow row 3: column 1 = year, column 2 = 1990 row 4: column 1 = year, column 2 = 1999 it displays only: car=[yellow], year=[1999]. It takes only the last values, this worked fine if it wasn't for the duplicate keys. First question: How…
has comment: http://stackoverflow.com/comment/38886846
tagged with: hashmap
has comment: http://stackoverflow.com/comment/38877532
tagged with: java
has answer: http://stackoverflow.com/a/25004036
accepted answer: http://stackoverflow.com/a/25004036
has comment: http://stackoverflow.com/comment/38877801
upvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/38877637
favorite count: 0
tagged with: jdbc

http://stackoverflow.com/comment/38989087
has text: yes i finally solved it this way. the following code solved the problem: @Uwe Allner Thank you too. `java.io.InputStream applStream = getClass().getClassLoader().getResourceAsStream(applPath); Reader applReader = new InputStreamReader(applStream, "UTF-8"); applBundle = new PropertyResourceBundle(applReader); `
score: 4
type: AnswerComment
comment on: http://stackoverflow.com/a/25054283
type: Comment

http://stackoverflow.com/q/24971666
favorite count: 0
has answer: http://stackoverflow.com/a/24971751
score: 2
upvote count: 2
tagged with: java
tagged with: javafx
type: Question
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24971751
has title: Finding a specific node in a node's children list in JavaFX
has body: Button A = new Button(); Button B = new Button(); Button C = new Button(); somePane.getChildren().add(A,B,C); Now, let's go to the far future. I have a reference to somePane, and I am interested in accessing button B. Technically, one could do something like somePane.getChildren().get(1); // returns the second button However, I am not comfortable with this since it seems to be prone to errors. It occurred to me that it would be pretty useful to have some sort of tag system. Like this: Button A = new Button(); Button B = new Button(); Button C = new Button(); A.tag = "A"; B.tag = "B"; C.tag = "C"; somePane.getChildren().add(A,B,C); Then you could do somePane.getChildren().getByTag("B"); // returns the second button Is there something like this for JavaFX? You might be wondering: Why don't I just make the button B a fixed property of my class? Those buttons and panes are created dynamically. I can have several panes, all with their own "B" button. Why don't I subclass the Button or Node class and add this functionality? Makes sense and I could do it. I would rather have a simpler solution though.
answer count: 1
downvote count: 0

http://stackoverflow.com/a/25005028
has body: Turns out it was a ProGuard issue. Fixed it by adding the following lines: -keepclassmembers class ** { @com.squareup.otto.Subscribe public *; @com.squareup.otto.Produce public *; }
has comment: http://stackoverflow.com/comment/57610167
accepted answer of: http://stackoverflow.com/q/25004921
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/25004921
type: Answer
has comment: http://stackoverflow.com/comment/57657908
upvote count: 7
score: 7

http://stackoverflow.com/a/25025255
has comment: http://stackoverflow.com/comment/38918454
type: Answer
downvote count: 1
has comment: http://stackoverflow.com/comment/38918781
has comment: http://stackoverflow.com/comment/38918617
upvote count: 0
score: -1
answers question: http://stackoverflow.com/q/25025167
has body: you could use db caching http://www.oracle.com/technetwork/articles/sql/11g-caching-pooling-088320.html if the app is making network roundtrip and caculating results, that will still eat considerable time

http://stackoverflow.com/q/25031633
answer count: 1
tagged with: http://stackoverflow.com/tag/xml
has body: I receive XML Invoice with Xades EPES signature and I have to control it. So I try to do that with Xades4j. I have fixed lot of error But I stuck on the error: errxades4j.verification.SignaturePolicyNotAvailableException: Verification failed for property 'SignaturePolicyIdentifier': signature policy document is not available at xades4j.verification.SignaturePolicyVerifier.verify(SignaturePolicyVerifier.java:67) at xades4j.verification.SignaturePolicyVerifier.verify(SignaturePolicyVerifier.java:38) at xades4j.verification.QualifyingPropertiesVerifierImpl.verifyProperties(QualifyingPropertiesVerifierImpl.java:58) at xades4j.verification.XadesVerifierImpl.verify(XadesVerifierImpl.java:202) Java code use to verify signature : FileInputStream fis = new FileInputStream("keystore.jks"); KeyStore trustAnchors = KeyStore.getInstance("jks"); trustAnchors.load(fis,"password".toCharArray()); fis.close(); CertificateValidationProvider certValidator = new PKIXCertificateValidationProvider(trustAnchors, false); XadesVerificationProfile p = new XadesVerificationProfile(certValidator); XadesVerifier v = p.newVerifier(); DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); dbf.setNamespaceAware(true); DocumentBuilder db = dbf.newDocumentBuilder(); FileInputStream is = new FileInputStream(filename); Document doc = db.parse(is); Element sigElem = (Element)doc.getElementsByTagNameNS(Constants.SignatureSpecNS, Constants._TAG_SIGNATURE).item(0); XAdESVerificationResult r = null; r = v.verify(sigElem,null); If necessary I can post an extract of kind of XML file I try to verify after anonymization. Thanks. I have looked and tried all i have found (on the net, xades4j example, xades4j junit class...) but nothing seems to resolve my error.
accepted answer: http://stackoverflow.com/a/25032296
has title: Xades4j - XML Signature Verification error - SignaturePolicyNotAvailableException
upvote count: 1
has answer: http://stackoverflow.com/a/25032296
type: AnsweredQuestion
score: 1
tagged with: java
type: Question
tagged with: xades4j
downvote count: 0
tagged with: verifyerror
favorite count: 0

http://stackoverflow.com/comment/38962613
type: Comment
type: QuestionComment
score: 1
has text: Consider providing a [runnable example](https://stackoverflow.com/help/mcve) which demonstrates your problem. This will result in less confusion and better responses
comment on: http://stackoverflow.com/q/25048691

http://stackoverflow.com/comment/38867628
type: Comment
comment on: http://stackoverflow.com/a/24998674
score: 0
has text: The thing is, this error happens when i launch the application, so this method is not called unless there is something in the database, and if there is its not null! Thats why i don't understand the error...
type: AnswerComment

http://stackoverflow.com/comment/69228876
type: AnswerComment
comment on: http://stackoverflow.com/a/27568606
has text: I tried in 4.1.1 but not working is there any other suggestion ??
type: Comment
score: 0

http://stackoverflow.com/q/24932956
type: UnansweredQuestion
tagged with: android
tagged with: drawable
has body: I am trying the create a button that has a ring around it (it is for a clicker-counter app). Currently I am creating this ring a drawable then setting the background of the button to the drawable. The code in the drawable is as follows: <?xml version="1.0" encoding="utf-8"?> <solid android:color="@color/large_circle" /> The Dimentions are in another dimens file, here they are 200dp 10dp The problem is, I need the be able to scale these drawables for different size android screens and I would like to be able to do this dynamically from code. I can not just scale the drawable because the thickness of the ring would be wrong. Can anyone help please?
answer count: 0
tagged with: android-drawable
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/38745733
has comment: http://stackoverflow.com/comment/38744297
has title: Dynamically creating drawables
has comment: http://stackoverflow.com/comment/38744818
has comment: http://stackoverflow.com/comment/38744348
score: 0
has comment: http://stackoverflow.com/comment/38744562

http://stackoverflow.com/a/25001763
upvote count: 0
score: -5
answers question: http://stackoverflow.com/q/25001716
has body: "this" is your activity, not a Listener. Try this: next.setOnClickListener(new OnClickListener() { public void onClick(View v) { // What do do when "next" is clicked } });
has comment: http://stackoverflow.com/comment/38873397
has comment: http://stackoverflow.com/comment/38873413
downvote count: 5
type: Answer

http://stackoverflow.com/comment/38818362
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24972309
score: 0
has text: One fine day, that user will read a file with an evil fourth line. - I'd scratch the first proposal.

http://stackoverflow.com/comment/38775796
has text: oh..thankx...I guess your code is okay.Still you can consult this...http://stackoverflow.com/questions/15532668/calculator-with-one-input-edittext-android
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24949149
type: Comment

http://stackoverflow.com/comment/38870972
comment on: http://stackoverflow.com/q/25000332
score: 0
type: QuestionComment
type: Comment
has text: You've copied the file incorrectly.

http://stackoverflow.com/q/25014727
favorite count: 0
has comment: http://stackoverflow.com/comment/38899476
tagged with: bankers-rounding
possible better answer: http://stackoverflow.com/a/25015004
score: 2
has comment: http://stackoverflow.com/comment/38900778
downvote count: 0
has comment: http://stackoverflow.com/comment/38901032
has answer: http://stackoverflow.com/a/25015004
has comment: http://stackoverflow.com/comment/38904392
type: AnsweredQuestion
tagged with: rounding
has answer: http://stackoverflow.com/a/25015071
accepted answer: http://stackoverflow.com/a/25015071
tagged with: java
has body: I have a data set which consists of BigDecimal numbers. I want to present this in a report. I have managed to generate a report with the following format. This is somewhat similar to a trial balance in accounting. But it is not! The data in the table have 4 decimal points in their values. But in the report it should be rounded to two decimal places. The report has to be accurate as well, hence the usage of BigDecimal. +--------+---------+--------+ |Account | Debits | Credits| +--------+---------+--------+ |A | 0.2760 | 0.1630 | +--------+---------+--------+ |B | 0.2770 | 0.2640 | +--------+---------+--------+ |Total | 0.5530 | 0.4270 | +--------+---------+--------+ The real issue is when it comes to displaying the totals. The totals won't add up properly, after rounded. +--------+---------+--------+ |Account | Debits | Credits| +--------+---------+--------+ |A | 0.28 | 0.16 | +--------+---------+--------+ |B | 0.28 | 0.26 | +--------+---------+--------+ |Total | 0.55 | 0.43 | +--------+---------+--------+ I am using the HALF_EVEN rounding mode because it is used for bookkeeping and also because this case involves financials as well. I can add it up after rounding the values. then the report calculations will be OK. But it will not represent the actual value which is in the database (.553 is close to .55, but if I add it up after rounding the result would be .56, .553 is not close to .56). Is there anyway to overcome this issue? I looked around to see how trial balance reports are made but I could not find any proper solution for this? EDIT 1 I have seen trial balance reports in financial systems like this, do they make the calculations after rounding? I keep comparing this to Trial Balance report since this report is similar to one. EDIT 2 Is it OK to make the calculation on rounded values? I have learnt that making the calculations on the rounded value is not recommended since the original values get discarded. EDIT 3 Based on @MarcioB, @user3679868 and @JoopEggen …
type: Question
upvote count: 2
answer count: 2
has comment: http://stackoverflow.com/comment/38902806
has title: Java rounding issue with BigDecimal and calculations
tagged with: bigdecimal
tagged with: rounding-error
has comment: http://stackoverflow.com/comment/38899309

http://stackoverflow.com/comment/38836299
has text: by "activity label", do you mean the ActionBar Title?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24982076

http://stackoverflow.com/a/24977865
answers question: http://stackoverflow.com/q/24977783
downvote count: 0
type: Answer
has body: If you use the classes you can try with regex or simple String String s = "aeiouaeiou";//string to count int count = 0; for (int i = 0; i &lt; s.length(); i++) { //One method if ("aeiou".indexOf( s.charAt(i) ) &gt;= 0) { count++; } //Another one if (Character.toString( s.charAt(i) ).matches("[aeiou]")) { count++; } }
score: 2
upvote count: 2

http://stackoverflow.com/a/25066217
type: Answer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/38997596
has body: Try This: package com.splash.smsManager; import android.app.Activity; import android.app.PendingIntent; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.os.Bundle; import android.telephony.SmsManager; import android.telephony.SmsMessage; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.Toast; public class SendingSmsWithReport extends Activity { String sendingSmsStatus = "SEND"; String deliverySmsStatus = "DELIVERED"; PendingIntent send, delivered; BroadcastReceiver sendReceiver, deliveredRecevier; @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.main_activity); send = PendingIntent.getBroadcast(this, 0, new Intent(sendingSmsStatus), 0); delivered = PendingIntent.getBroadcast(this, 0, new Intent( deliverySmsStatus), 0); Button sendSmsButton = (Button) findViewById(R.id.button1); sendSmsButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { // TODO Auto-generated method stub SmsManager sms = SmsManager.getDefault(); sms.sendTextMessage("5556", null, "Hello Welcome to Android", send, delivered); //5556 is Emulator Number. } }); } @Override protected void onPause() { // TODO Auto-generated method stub super.onPause(); unregisterReceiver(sendReceiver); unregisterReceiver(deliveredRecevier); } @Override protected void onResume() { // TODO Auto-generated method stub super.onResume(); sendReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { switch(getResultCode()) { case Activity.RESULT_OK: Toast.makeText(getBaseContext(), "Sms Sent Successfully", Toast.LENGTH_LONG).show(); break; case SmsManager.RESULT_ERROR_NO_SERVICE: Toast.makeText(getBaseContext(), "No Serice Found in your Device", Toast.LENGTH_LONG)…
has comment: http://stackoverflow.com/comment/38999029
accepted answer of: http://stackoverflow.com/q/25064355
has comment: http://stackoverflow.com/comment/38998311
upvote count: 1
has comment: http://stackoverflow.com/comment/38999516
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25064355
has comment: http://stackoverflow.com/comment/39008427
has comment: http://stackoverflow.com/comment/38998479
has comment: http://stackoverflow.com/comment/38999202

http://stackoverflow.com/a/25001527
has comment: http://stackoverflow.com/comment/38873629
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/38873676
has comment: http://stackoverflow.com/comment/38873808
upvote count: 2
has body: If you read the file and then translate the \ to a / before processing, that would work. So the library you are using has a method Ini#load(InputStream) that takes the INI file contents, call it like this: byte[] data = Files.readAllBytes(Paths.get("directory", "file.ini"); String contents = new String(data).replaceAll("\\\\", "/"); InputStream stream = new ByteArrayInputStream(contents.getBytes()); ini.load(stream); The processor must be doing the interpretation of the back-slashes, so this will give it data with forward-slashes instead. Or, you could escape the back-slashes before processing, like this: String contents = new String(data).replaceAll("\\\\", "\\\\\\\\");
type: Answer
answers question: http://stackoverflow.com/q/25001453
has comment: http://stackoverflow.com/comment/38873540

http://stackoverflow.com/a/24972730
type: Answer
answers question: http://stackoverflow.com/q/24963869
score: 1
upvote count: 1
has body: You're close. &lt;c:if test="${param.pieces &gt; 0 }"&gt; &lt;form:hidden path=.../&gt; &lt;/c:if&gt;
downvote count: 0

http://stackoverflow.com/comment/38728514
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/24924446
has text: See my edit. You will indeed want to have one SQL query when you call findWithTransactionData(). Then, you will have all of the Consumer's bills and receipts without having to hit the database every time you need to get the most recent bill/receipt. The latter part is where your performance gets a boost.
type: Comment

http://stackoverflow.com/q/25000986
accepted answer: http://stackoverflow.com/a/25003426
answer count: 1
linked to: http://stackoverflow.com/q/16738106
tagged with: javafx-2
has title: how to print a table in javafx
type: AnsweredQuestion
tagged with: javafx
type: Question
tagged with: java
has body: i had following codes to print a table public void print(final Node node) { Printer printer = Printer.getDefaultPrinter(); PrinterJob job = PrinterJob.createPrinterJob(); if (job != null) { boolean success = job.printPage(node); if (success) { job.endJob(); } } } on button click print(table); but it doesn't print all columns it cuts half of table and print the half table. I want to print the complete table. Is there any other codes to print a complete table. Please help me.
score: 0
tagged with: javafx-8
has answer: http://stackoverflow.com/a/25003426

http://stackoverflow.com/comment/38726130
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24923070
has text: @androidmaster If you're only calling a particular function from one place, then inlining it will probably not reduce the source file size by much. If you're calling it from multiple places, then inlining it will likely make the source file *larger*.

http://stackoverflow.com/comment/41179408
comment on: http://stackoverflow.com/q/24960959
type: Comment
type: QuestionComment
has text: @Gevorg I'm afraid at this point I quit trying to use Java with the Play framework. I took this as a chance to dive into Scala and found much more documentation and online discussion going on about the common roadblocks. Since then I've deployed my first Play-Scala based API. ;-)
score: 0

http://stackoverflow.com/comment/38719482
type: Comment
comment on: http://stackoverflow.com/a/24919453
has text: Thank you. i'm trying now..
type: AnswerComment
score: 0

http://stackoverflow.com/comment/69320791
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/29212126
type: Comment
has text: incremental is not tagged as deprecated

http://stackoverflow.com/a/24923422
has comment: http://stackoverflow.com/comment/38726921
has comment: http://stackoverflow.com/comment/38726903
type: Answer
has comment: http://stackoverflow.com/comment/38726959
answers question: http://stackoverflow.com/q/24923403
has body: Kill... while(true) { repaint(); //my paint method doesn't touch the JMenuBar or JMenu } This is blocking the Event Dispatching Thread, making it impossible for the system to paint, well, anything... Also... menu.setVisible(true); menuBar.setVisible(true); Swing components are visible by default, so the above is pointless, I know, you were scratching at crumbs, but you should beware that this is very rarely the problem import java.awt.BorderLayout; import java.awt.EventQueue; import java.io.IOException; import java.util.logging.Level; import java.util.logging.Logger; import javax.swing.JFrame; import javax.swing.JMenu; import javax.swing.JMenuBar; import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException; public class TestWindow extends JFrame { //class variables JMenuBar menuBar; JMenu menu; TestWindow() throws IOException { menuBar = new JMenuBar(); menu = new JMenu("A Menu"); menuBar.add(menu); this.setJMenuBar(menuBar); // this.add(menuBar); //I've tried with and without this // menu.setVisible(true); // menuBar.setVisible(true); this.setVisible(true); // while (true) { // repaint(); //my paint method doesn't touch the JMenuBar or JMenu // } } public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { @Override public void run() { try { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) { } TestWindow frame = new TestWindow(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true); } catch (IOException ex) { ex.printStackTrace(); } } }); } }
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/38726882
has comment: http://stackoverflow.com/comment/38726941
upvote count: 2

http://stackoverflow.com/comment/38903628
comment on: http://stackoverflow.com/q/25017551
has text: I don't think that can work. It sounds like you need to first install the JDK, and then install a separate JRE. Why are you installing the JDK that way?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38931351
comment on: http://stackoverflow.com/a/24973890
has text: @Stuart Marks: it could have a practical use if the optimizer is capable of utilizing SSE. Then calculating in 32-Bit rather than 64-Bit means doubling the number of possible parallel computations.
type: Comment
score: 1
type: AnswerComment

http://stackoverflow.com/comment/38992483
type: AnswerComment
type: Comment
has text: errrr currently it just checks for the entire line if it matches the word you provided, and that word has no whitespace in the specification. Program arguments, if you run the code from Eclipse for example then there's an option for it to specify it, albeit in Eclipse what I tend to do is export the file as a Runnable JAR File then run it using 'java -jar exported.jar argument1 argument2' in command line
comment on: http://stackoverflow.com/a/25061628
score: 0

http://stackoverflow.com/comment/38800382
type: Comment
type: QuestionComment
has text: http://stackoverflow.com/questions/20541636/compare-non-primitive-data-type-long-values-in-java
score: 3
comment on: http://stackoverflow.com/q/24962630

http://stackoverflow.com/comment/39044802
comment on: http://stackoverflow.com/q/25000930
score: 0
has text: You are right in all senses. What I don't understand though is why doesn't the application hang when scanning local network.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/89433457
comment on: http://stackoverflow.com/a/51212804
has text: Or better yet actually use a version that is current and supported by IBM in the event you run into problems. 7.0.1.x has been out of support since 2015. 8.0 and later are the only currently supported versions. 8.0 goes out of support in less than 2 years, better to use 9.0 which has not had an announced end of support. 9.1 will be released by the end of this month as well.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/24959040
type: AcceptedAnswer
upvote count: 6
answers question: http://stackoverflow.com/q/24958900
type: Answer
score: 6
has body: Not only you should erase the ; after the if-statement where you look for level2, but if I look into your code correctly, you should close your if-statement where you look for level1 before asking for level2 and use else if for the level2. Also go for curly braces after the level2 if: if(level == 1 &amp;&amp; expmn == 500){ lvl.setText("2"); ExpMin.setText("501"); ExpMax.setText("1000"); JOptionPane.showMessageDialog(null,"" + "levevlup!" ,"Para Yok",JOptionPane.PLAIN_MESSAGE); }// &lt;-- close level1 here because you want to check for a new level afterwards else if(level == 2 &amp;&amp; expmn == 1000){ //&lt;-- here was your ;, which was wrong lvl.setText("3"); ExpMin.setText("1001"); ExpMax.setText("2500"); } else{ JOptionPane.showMessageDialog(null,"" + "leveladssadaup" ,"Para Yok",JOptionPane.PLAIN_MESSAGE); }
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24958900

http://stackoverflow.com/a/25066395
accepted answer of: http://stackoverflow.com/q/25045621
type: Answer
has comment: http://stackoverflow.com/comment/139318051
score: 8
has body: Meo is right, from what I learned when I developed plugins for custom languages, IntelliJ does not compile anything until you explicitly make your project. While you are typing, its lexer/parser detects any invalid token or code construct. In the meantime, it maintains an index of every class and method in your project and its dependencies, along with their signature, etc. After you stop typing, you'll see a little colored eye in the top part of the right gutter. It indicates that the IDE is running "annotators" and "code inspections". They are able to tell whether or not classes, methods and variable are valid based on the current index and the current state of your file (imports, declarations, etc.). The same goes for unused variables, invalid parameters in method calls, etc. Pros: annotators work directly on what they call a PSI tree, which is basically an enhanced AST representing your current file it may be faster that compiling every time (it uses an index and does not need to recompile every dependent class) annotators can detect things javac don't care about, such as potential bugs (e.g. using = instead of == in a while condition) Cons: that's a loooot of work, basically they need to rewrite the logic to find every error that javac can produce (which is why you can find many issues on their bugtracker labelled "good code is red" or "bad code is green", meaning there is a difference between what they detect and what the compiler would output) TL;DR: it does not produce any .class until you make your project, everything is done "by hand"
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/25045621
upvote count: 8

http://stackoverflow.com/comment/38878386
has text: Of course :) for both ... should i've to declare a specific package or name-space?
score: 0
type: Comment
comment on: http://stackoverflow.com/q/24975765
type: QuestionComment

http://stackoverflow.com/a/24997998
score: 3
answers question: http://stackoverflow.com/q/24997934
upvote count: 3
has body: SQLite is a native library and does not use Java heap space; it uses the native heap.
downvote count: 0
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/24997934

http://stackoverflow.com/a/25028122
type: Answer
answers question: http://stackoverflow.com/q/25028067
has body: Funnily enough, that's what the JVM does behind the scenes - there's even a method named '' that corresponds to the constructor. However, constructors aren't there to just help out with setting the parameters, they're there so that the system can guarantee that some parameters (or a valid combination of them) has been set.
score: 0

http://stackoverflow.com/comment/38774924
score: 1
comment on: http://stackoverflow.com/q/24948791
type: QuestionComment
has text: @markspace: Yes my future plan is to test it by experiment. I will update my findings later.
type: Comment

http://stackoverflow.com/comment/38813632
type: QuestionComment
comment on: http://stackoverflow.com/q/24969942
score: 0
type: Comment
has text: Avoid using `Math.random` and multiplying - use `new Random()` and `nextInt`. Use one instance of `Random` for the entire application.

http://stackoverflow.com/a/25024673
accepted answer of: http://stackoverflow.com/q/25024606
score: 0
type: Answer
has body: Alright, well it seems that IntelliJ is creating those line breaks because the contents of my "details" are sufficiently long. There appears to be a small bug where, after shortening the "details" String literal and then reapplying code styles, the line break does not revert.
answers question: http://stackoverflow.com/q/25024606
type: AcceptedAnswer

http://stackoverflow.com/q/25012002
tagged with: calendar
type: Question
linked to: http://stackoverflow.com/q/20165564
tagged with: gregorian-calendar
score: 0
duplicate of: http://stackoverflow.com/q/20165564
answer count: 1
type: UnansweredQuestion
has body: I have two time stamps in date format. How can I get the number of days that are present in the given range ? SimpleDateFormat sdf = new SimpleDateFormat("dd MM yyyy HH:mm:ss"); Date begin=sdf.parse("27 02 2014 23:00:00"); Date end=sdf.parse("01 03 2014 00:00:10"); In the above case it must be 3, that is (27th Feb , 28th Feb and 1st Jan) int days = (int) (end.getTime() - begin.getTime())/(1000*3600*24) ; The above method doesn't help as it considers the whole time stamp.
has title: Finding number of days
has answer: http://stackoverflow.com/a/25012081
tagged with: java

http://stackoverflow.com/a/25054340
score: 2
answers question: http://stackoverflow.com/q/25054274
downvote count: 0
has body: Override means that you change the functionality of a method (you overwrite what that method does). Overload means that you keep the method name and return type , but you have different input paremeters. The two concepts are very different. While in override you have a different functionality for the SAME method, with overload you have two DIFFERENT methods with the SAME name . !EDIT You can overload a method to have a different return type only if you have different input parameters. You cannot overload a method by only changing it's return type.
has comment: http://stackoverflow.com/comment/38972687
has comment: http://stackoverflow.com/comment/38973237
upvote count: 2
has comment: http://stackoverflow.com/comment/38973900
type: Answer

http://stackoverflow.com/comment/38862938
type: Comment
comment on: http://stackoverflow.com/q/24996050
has text: @sunrize920 it's not possible to read bytes from a bufferedreader so i need to read them directly from the inputstream
score: 0
type: QuestionComment

http://stackoverflow.com/a/25088692
accepted answer of: http://stackoverflow.com/q/24962604
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/24962604
has body: Figured this out. Instead of &lt;jsp:useBean id="actionBean" class="stripesbook.action.InitialInfoActionBean" /&gt;` I needed to be using &lt;stripes:useActionBean beanclass="stripesbook.action.InitialInfoActionBean" executeResolution="false" event="populate" var="actionBean" /&gt; Apparently the regular useBean tag doesn't populate the context.
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/comment/38882504
type: QuestionComment
has text: Yes I did.Actually my oscPortOut (the osc sender object) is working fine. But not the receiver with the listener part.
comment on: http://stackoverflow.com/q/25005751
score: 0
type: Comment

http://stackoverflow.com/a/25024222
type: AcceptedAnswer
has body: After a while checking things out I figured out that the issue was simply with my deobscuring method. I have now edited it and replace it with the following: /** * @param str Obscured String * @return Unobscured String */ private String deobscure(String s){ if (s.startsWith(__OBFUSCATE)) s = s.substring(4); byte[] b = new byte[s.length() / 2]; int l = 0; for (int i = 0; i &lt; s.length(); i += 4) { if (s.charAt(i)=='U') { i++; String x = s.substring(i, i + 4); int i0 = Integer.parseInt(x, 36); byte bx = (byte)(i0&gt;&gt;8); b[l++] = bx; } else { String x = s.substring(i, i + 4); int i0 = Integer.parseInt(x, 36); int i1 = (i0 / 256); int i2 = (i0 % 256); byte bx = (byte) ((i1 + i2 - 254) / 2); b[l++] = bx; } } return new String(b, 0, l,StandardCharsets.UTF_8); } Original Profile name: "Admin" Obscured Profile name: "OBF:1npu1toa1w8v1tok1nsc After de-obscuring Profile name: "Admin" Thus the method now works as intended.
type: Answer
accepted answer of: http://stackoverflow.com/q/25016172
answers question: http://stackoverflow.com/q/25016172
score: 0

http://stackoverflow.com/q/25045167
type: Question
has comment: http://stackoverflow.com/comment/38956491
tagged with: iterator
answer count: 2
has comment: http://stackoverflow.com/comment/38956146
score: 0
tagged with: interface
has body: I have a problem with an interface. I have an Iterator interface like this: package com.wrox.algorithms.iteration; import com.wrox.algorithms.lists.IteratorOutOfBoundsException; public interface Iterator { public void first(); public void last(); public void isDone(); public void next(); public Object current() throws IteratorOutOfBoundsException; } After that I create test class and test the iteration in an empty list: package com.wrox.algorithms.lists; import com.wrox.algorithms.iteration.Iterator; ..... public void testForwardIteration() { Lists list = createList(); Iterator iterator = list.iterator(); // &lt;- ERROR } I get this error: Type mismatch: cannot convert from java.util.Iterator to com.wrox.algorithms.iteration.Iterator Have you any idea where my mistake is? Thank you for your support!
tagged with: type-mismatch
has answer: http://stackoverflow.com/a/25045210
type: UnansweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/25046478
has comment: http://stackoverflow.com/comment/38955699
has title: Type mismatch with Iterator interface

http://stackoverflow.com/a/24998851
has body: As i mentioned some code for inspiration (SLIGHTLY improved your code. Not something i would want to see in production!) // Use the domain-agnostic API private Connection connection;ery private Session session; private MessageProducer producer; private Queue queue; public void init(Context ctx, String queueName) { try { ConnectionFactory cnf = (QueueConnectionFactory) ctx.lookup(JMS_FACTORY); queue = (Queue) ctx.lookup(queueName); connection = cnf.createConnection("user", "user123"); session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); producer = session.createProducer(queue); connection.start(); } catch (NamingException e) { throw new RuntimeException(e); } catch (JMSException e) { throw new RuntimeException(e); } } And make your send like this (don't reuse the same Message object, but create a new one for each message you are sending) public void send(String message) throws JMSException { TextMessage msg = session.createTextMessage(); msg.setText(message); producer.send(msg); } Put a try..finally around the code in your main method: try { readAndSend(qs); } finally { qs.close(); } The code you are using is not very good (understatement). It is programmed too brittle for a production system. You should not use state the way this program does. Also there is no need to use the domain specific JMS API. You can use the domain (queue/topic) agnostic one. When you run the program pass in the JNDI URL for your TIBCO server.
downvote count: 1
upvote count: 5
answers question: http://stackoverflow.com/q/24936259
type: Answer
score: 4

http://stackoverflow.com/q/24952514
tagged with: jtable
answer count: 1
has body: I need the x and y coordinates of the table because I want to draw an object over the table. Is it possible to draw a canvas object over a table at all?
favorite count: 0
upvote count: 5
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/22245463
tagged with: swing
downvote count: 0
tagged with: java
tagged with: coordinates
type: Question
has comment: http://stackoverflow.com/comment/38781912
has comment: http://stackoverflow.com/comment/38784322
score: 5
has answer: http://stackoverflow.com/a/24952801
has comment: http://stackoverflow.com/comment/38783880
has title: How can I get the coordinates of a cell in a JTable?
has comment: http://stackoverflow.com/comment/38783014

http://stackoverflow.com/comment/38971162
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25053400
score: 0
has text: possible duplicate of [Creating a composite Unique constraints on multiple columns](http://stackoverflow.com/questions/8245935/creating-a-composite-unique-constraints-on-multiple-columns)

http://stackoverflow.com/comment/38701632
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24910487
has text: where do you instanciate (or something simular) your buttons ?

http://stackoverflow.com/comment/38933842
type: QuestionComment
score: 0
has text: You can consider using Hibernate's annotation `@Where(clause="status<>5")` (above the entity class)
comment on: http://stackoverflow.com/q/25029906
type: Comment

http://stackoverflow.com/q/24934138
possible better answer: http://stackoverflow.com/a/24934285
upvote count: 2
tagged with: java
answer count: 2
has answer: http://stackoverflow.com/a/24934285
tagged with: locale
has title: java.util.Locale does not recognize Austria
type: AnsweredQuestion
score: 2
has comment: http://stackoverflow.com/comment/38746393
has answer: http://stackoverflow.com/a/24934370
has comment: http://stackoverflow.com/comment/38746408
has body: Would need on identifying what is the locale id for Austria. I have tried with de_AT/at/at_at as mentioned here But it seems Locale API doesn't recognize these locale, any pointers..? Exception when trying with de_AT: java.util.MissingResourceException: Couldn't find 3-letter language code for de_at at java.util.Locale.getISO3Language(Unknown Source) at com.test.rupesh.CQInstanceHelper.language(Main.java:74) at com.test.rupesh.Main.main(Main.java:20)
downvote count: 0
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/38746566
accepted answer: http://stackoverflow.com/a/24934370

http://stackoverflow.com/a/34429453
has body: In your build.gradle file add the following. android { sourceSets { main.java.srcDirs += 'src/&lt;YOUR DIRECTORY NAME&gt;' } ... ... }
score: 0
answers question: http://stackoverflow.com/q/25041104
type: Answer

http://stackoverflow.com/comment/38964792
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25050002
has text: HI there, tq for your helpful info, may i know the intent.putStringArrayListExtra("list", dataList); is it correct in this form ? how about if 2 array list going to be transfer... does it means i jsut pput another intent.putStringArrayListExtra("alist", atList); ?
type: AnswerComment

http://stackoverflow.com/comment/38843612
has text: http://math.stackexchange.com/
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24985751
score: 0

http://stackoverflow.com/comment/38737790
comment on: http://stackoverflow.com/q/24929359
has text: I change `portId.open("Main", 9600);` to `portId.open(null, 0);` and the result no changed. So what usage of this things?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25057410
accepted answer of: http://stackoverflow.com/q/25055951
downvote count: 0
score: 1
upvote count: 1
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/25055951
has body: It would appear that you can't code to some scala interfaces in Java! This code compiles and executes correctly in Sun and Eclipse. Note the use of HashSet on the left hand side of the assignment import scala.collection.HashSet; public class TestCase1 { public static void main(String[] args) { HashSet&lt;String&gt; set2 = new HashSet&lt;String&gt;(); HashSet&lt;String&gt; set4 = set2.$plus("test"); System.out.println(set2.size()); System.out.println(set4.size()); } } Why is this the case? I believe it has something to do with Scalas ability to inherit multiple traits, which java eclipse doesn't understand. For instance, HashSet extends AbstractSet, Set, GenericSetTemplate,SetLike, FlatHashTable, CustomParallelizable, Serializable some of which are interfaces some of which are AbstractClasses. The .$plus() Method would appear to come from SetLike, not Set, which would explain why calling the method on the Set Supertype would cause this error. That said I still can't refer to HashSet using the Supertype SetLike as that still fails, and thats as far as I can go. I think the main problem here is Elipse somehow misrepresenting the Supertype as having as those methods, which is wrong.

http://stackoverflow.com/comment/38844815
has text: Yes But How do I do that for DrowRanger? like DrowRanger.getHealth();
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24986042

http://stackoverflow.com/comment/38785620
type: Comment
score: 1
has text: What exactly you want to acheive?..I opine that perfomance difference is very minimal whether you use stringbuffer or stringbuilder. (Again that depends on your application)
comment on: http://stackoverflow.com/q/24955072
type: QuestionComment

http://stackoverflow.com/comment/38867831
comment on: http://stackoverflow.com/a/24998785
type: Comment
has text: I tried to traverse using - this=this.next() but it does not compile.
score: 0
type: AnswerComment

http://stackoverflow.com/q/25044416
type: Question
has body: I have a JMS Listener, inside the listener I'm using an ExecutorService to run a worker on a fixed number of threads. like so: public void onMessage(Message m) { executor.execute(new Worker(m)); } This executor has 10 threads, if I get 100 messages in at the same time and it takes a few seconds for each of these workers to run, am I going to have 90 JBoss JMS threads waiting on the 10 active Worker? So do each of these incoming messages get their own thread and eat up my resources while waiting? Am I doing it completely wrong, is there a better way? I'm using JBoss EAP and HornetQ
tagged with: java
tagged with: jboss
has title: JMS onMessage JBoss, how many threads are used?
has answer: http://stackoverflow.com/a/25047633
downvote count: 0
answer count: 1
tagged with: jms
favorite count: 0
linked to: http://stackoverflow.com/q/4973549
score: 2
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25047633
upvote count: 2

http://stackoverflow.com/q/24959128
tagged with: heap-memory
has answer: http://stackoverflow.com/a/51751398
has answer: http://stackoverflow.com/a/79062602
has answer: http://stackoverflow.com/a/43211979
has body: WildFly 8 is started on a linux server with standalone.sh. I noticed that the server was started with very few heap memory space. I need to increase the heap memory space for the server and for applications, which are running on the server. How can I do it?
accepted answer: http://stackoverflow.com/a/24960585
type: AnsweredQuestion
tagged with: java
tagged with: wildfly
type: Question
answer count: 8
tagged with: performance
has answer: http://stackoverflow.com/a/43251015
score: 79
has answer: http://stackoverflow.com/a/24960585
has answer: http://stackoverflow.com/a/46487636
upvote count: 79
has answer: http://stackoverflow.com/a/32149981
downvote count: 0
has title: How to increase heap memory for WildFly?
possible better answer: http://stackoverflow.com/a/52366005
favorite count: 0
has answer: http://stackoverflow.com/a/52366005

http://stackoverflow.com/comment/38715875
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24917656
score: 0
has text: This isn't specific to the `wait` method. All instance method calls (not called on an object variable) have an implicit `this.` on the front. Often I will type `this.` just to get a list of available methods for the current object

http://stackoverflow.com/comment/38779150
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24949338
has text: what is the error you are getting?

http://stackoverflow.com/q/25066097
has title: REGEX with two capturing groups
type: AnsweredQuestion
has body: I need some help for a regular expression: I have this example code in regex101: http://regex101.com/r/iW8hP4/4 dsgssgdfgdsfg &lt;result1&gt;A1&lt;result1&gt; anythingiwith&lt;&gt;and"234and newlinesandsoon &lt;result&gt;B1&lt;result&gt; againanything dsgssgdfgdsfg &lt;result1&gt;A2&lt;result1&gt; anythingiwith&lt;&gt;and"234and newlinesandsoon againanything dsgssgdfgdsfg &lt;result1&gt;A3&lt;result1&gt; anythingiwith&lt;&gt;and"234and newlinesandsoon &lt;result&gt;B3&lt;result&gt; againanything As Result i want 3 Results and 2 capturing groups (here: CG) and it should be Result1: 1CG: A1 2CG: B1 Result2: 1CG: A2 2CG: null or just empty Result3: 1CG: A3 2CG: B3 How to solve this and how to get null/empty when something doesnt exist?
accepted answer: http://stackoverflow.com/a/25066297
tagged with: java
downvote count: 5
type: Question
has answer: http://stackoverflow.com/a/25066297
answer count: 1
has comment: http://stackoverflow.com/comment/38994948
upvote count: 1
tagged with: regex
has comment: http://stackoverflow.com/comment/38995040
favorite count: 0
score: -4

jython-2.5
tag name: jython-2.5
type: Tag
tags question: http://stackoverflow.com/q/25031057

http://stackoverflow.com/q/25042514
tagged with: android
possible better answer: http://stackoverflow.com/a/25042585
has answer: http://stackoverflow.com/a/25042585
has body: I have a file (more specifically a .txt file) that I need to access. I tried creating my own resources folder then accessing it with BufferedReader but got a null pointer error. So question: Where is the best way to store this file and still use BufferedReader to access it?
has title: Where to store files in an Android project to be accessed by the BufferedReader?
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25042650
tagged with: java
tagged with: file
tagged with: eclipse
type: Question
has answer: http://stackoverflow.com/a/25047810
tagged with: bufferedreader
accepted answer: http://stackoverflow.com/a/25042650
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/38950313

http://stackoverflow.com/a/24983883
has body: Use Calendar.HOUR_OF_DAY that is used for the 24-hour clock. int hours = c.get(Calendar.HOUR_OF_DAY);
has comment: http://stackoverflow.com/comment/38839951
score: 1
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24983869
answers question: http://stackoverflow.com/q/24983869
type: Answer
upvote count: 1

http://stackoverflow.com/a/25029316
upvote count: 1
type: AcceptedAnswer
type: Answer
has body: To modify existing file, use InputStream and OutputStream. File file = new File("test.xlsm"); FileInputStream inputStream = new FileInputStream(file); OPCPackage.open(inputStream); ...... FileOutputStream fileOut=new FileOutputStream("test.xlsm"); wb.write(fileOut); fileOut.close(); For more sure, before to write the file close the InputStream.
downvote count: 0
has comment: http://stackoverflow.com/comment/38926054
score: 1
accepted answer of: http://stackoverflow.com/q/25029058
has comment: http://stackoverflow.com/comment/99473119
answers question: http://stackoverflow.com/q/25029058

http://stackoverflow.com/comment/38966260
comment on: http://stackoverflow.com/a/25042343
score: 0
type: Comment
has text: Please ask a fresh question showing your code and exception stack trace.
type: AnswerComment

http://stackoverflow.com/comment/39000105
score: 0
type: AnswerComment
type: Comment
has text: Please also refer to this [answer](http://stackoverflow.com/questions/21098202/is-atg-dms-true-jms-implementation/21106733#21106733) which talks about synchronous vs asynchronous messaging in ATG.
comment on: http://stackoverflow.com/a/25018642

http://stackoverflow.com/comment/38857423
comment on: http://stackoverflow.com/a/24992942
type: AnswerComment
score: 0
has text: i was going to but it asked me to stay 8 mints to accept :)
type: Comment

http://stackoverflow.com/comment/38705018
score: 1
comment on: http://stackoverflow.com/q/24912168
type: Comment
type: QuestionComment
has text: http://stackoverflow.com/questions/2420389/static-initialization-blocks

http://stackoverflow.com/a/25060398
answers question: http://stackoverflow.com/q/25059964
downvote count: 0
has comment: http://stackoverflow.com/comment/38992511
type: Answer
upvote count: 1
score: 1
has body: You can try to play with something like this: s.replaceAll( "[^\x{0410}-\x{042F}\x{0430}-\x{044F}]*([\x{0410}-\x{042F}\x{0430}-\x{044F}])?", "$1" ).length() The idea was borrowed from here: Simple way to count character occurrences in a string

http://stackoverflow.com/comment/38759156
has text: I honestly don't know. I'm very new to this and a lot of the work has been referencing on lectures. It's very likely I'm throwing in stuff that doesn't belong there, but I don't have enough experience with this to know what. I'm just trying to find a way to take in a text file through JFileChooser and input the data into the text fields. I'm honestly confused with most of this.
score: 0
comment on: http://stackoverflow.com/q/24940551
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38976154
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25033850
has text: Thanks @AmitChotaliya, would you know how to fit this into my method above (I've updated my post)? Thanks
type: AnswerComment

http://stackoverflow.com/comment/39264746
has text: Do some or all of these 38 messages have attachments? I'd like to have some idea of the size of the messages you are inserting.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25022618

http://stackoverflow.com/comment/38952215
comment on: http://stackoverflow.com/q/25043428
has text: regex is probably the best way. look at this [link](http://stackoverflow.com/questions/335250/parsing-xml-with-regex-in-java)
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24950435
has answer: http://stackoverflow.com/a/24950475
type: Question
tagged with: boolean
has answer: http://stackoverflow.com/a/24950467
downvote count: 0
has body: Is there a utility method in Java which converts Boolean into boolean and automatically handles null reference to Boolean as false?
possible better answer: http://stackoverflow.com/a/24952058
has answer: http://stackoverflow.com/a/24950508
has answer: http://stackoverflow.com/a/78660737
accepted answer: http://stackoverflow.com/a/24950467
has answer: http://stackoverflow.com/a/24952058
linked to: http://stackoverflow.com/q/27647407
has title: Utility method to convert Boolean into boolean and handle null in Java
has comment: http://stackoverflow.com/comment/38777920
upvote count: 50
has comment: http://stackoverflow.com/comment/38777593
answer count: 7
has answer: http://stackoverflow.com/a/66780952
favorite count: 0
has answer: http://stackoverflow.com/a/24950486
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/38777539
score: 50
linked to: http://stackoverflow.com/q/3882095
tagged with: utility-method

http://stackoverflow.com/q/24917753
has title: pattern search with special chars
has answer: http://stackoverflow.com/a/24918113
score: -1
type: Question
answer count: 2
upvote count: 0
possible better answer: http://stackoverflow.com/a/24918113
tagged with: regex
accepted answer: http://stackoverflow.com/a/24918154
favorite count: 0
tagged with: pattern-matching
has comment: http://stackoverflow.com/comment/38716057
has answer: http://stackoverflow.com/a/24918154
has body: Hi I want to search and get the index all special chars within a complex string like this String textWithSpecialChars = "text here |*more*| text some other |@tags@|..."; Im trying to search all patterns like this |* |_ |= |@ and *| _| =| @| I try this patterns public int getIndexOfPat(String s){ Pattern startPat = Pattern.compile("\\|[\\*_@=]"); Matcher matcher = pattern.matcher(s); return matcher.find() ? matcher.start() : -1; } String textWithSpecialChars = "text here |*more*| text some other |@tags@|..."; int i = getIndexOfPat(textWithSpecialChars); textWithSpecialChars = textWithSpecialChars.substring(i+2); //I get error here i = getIndexOfPat(textWithSpecialChars); // var i still is the first one value but this only get the first one even if I delete it of the original string with the
downvote count: 1
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/q/25023996
duplicate of: http://stackoverflow.com/q/16369146
has body: I am trying to understand how to write simplest application with one selector and multiple channels. After incredible effort I was able to write following code: server: private static byte[] data = new byte[255]; public static void main(String[] args) throws IOException { for (int i = 0; i &lt; data.length; i++) data[i] = (byte) i; ServerSocketChannel server = ServerSocketChannel.open(); server.configureBlocking(false); server.socket().bind(new InetSocketAddress(9000)); Selector selector = Selector.open(); server.register(selector, SelectionKey.OP_ACCEPT); while (true) { selector.select(); Set readyKeys = selector.selectedKeys(); Iterator iterator = readyKeys.iterator(); while (iterator.hasNext()) { SelectionKey key = (SelectionKey) iterator.next(); iterator.remove(); if (key.isAcceptable()) { SocketChannel client = server.accept(); System.out.println("Accepted connection from " + client); client.configureBlocking(false); ByteBuffer source = ByteBuffer.wrap(data); SelectionKey key2 = client.register(selector, SelectionKey.OP_WRITE); key2.attach(source); } else if (key.isWritable()) { SocketChannel client = (SocketChannel) key.channel(); ByteBuffer output = (ByteBuffer) key.attachment(); if (!output.hasRemaining()) { output.rewind(); } client.write(output); } key.channel().close(); } } } client(sender): public static void main(String[] argv) throws Exception { SocketChannel sChannel = SocketChannel.open(); sChannel.configureBlocking(false); sChannel.connect(new InetSocketAddress("localhost", 9000)); ByteBuffer buf = ByteBuffer.allocateDirect(1024); buf.put((byte) 0xFF); buf.flip(); int numBytesWritten = sChannel.write(buf); } my steps: run server run client After this step in server console I see following: Accepted connection from java.nio.channels.SocketChannel[connected local=/127.0.0.1:9000 remote=/127.0.0.1:49184] In client console I see following: Exception in thread "main" java.nio.channels.NotYetConnectedException at sun.nio.ch.SocketChannelImpl.ensureWriteOp…
score: 0
tagged with: client-server
answer count: 1
type: UnansweredQuestion
tagged with: channel
has answer: http://stackoverflow.com/a/25026920
has title: java. nio. connect multiple channels to one selector
type: Question
linked to: http://stackoverflow.com/q/16369146
tagged with: java
tagged with: selector
tagged with: nio

http://stackoverflow.com/a/24934651
downvote count: 0
answers question: http://stackoverflow.com/q/24934498
score: 4
has body: try just Transport.send(message); instead
type: Answer
upvote count: 4

gradle
tags question: http://stackoverflow.com/q/24931176
tags question: http://stackoverflow.com/q/25029779
tags question: http://stackoverflow.com/q/24924932
tags question: http://stackoverflow.com/q/25039021
tags question: http://stackoverflow.com/q/24911012
type: Tag
tags question: http://stackoverflow.com/q/24909667
tags question: http://stackoverflow.com/q/24938123
tags question: http://stackoverflow.com/q/25040445
tags question: http://stackoverflow.com/q/24941750
tags question: http://stackoverflow.com/q/25003272
tags question: http://stackoverflow.com/q/24928481
tags question: http://stackoverflow.com/q/25021284
tag name: gradle
tags question: http://stackoverflow.com/q/25005492
tags question: http://stackoverflow.com/q/24940815
tags question: http://stackoverflow.com/q/25063113
tags question: http://stackoverflow.com/q/24925175
tags question: http://stackoverflow.com/q/24975745
tags question: http://stackoverflow.com/q/25021151
tags question: http://stackoverflow.com/q/25011224
tags question: http://stackoverflow.com/q/25001914
tags question: http://stackoverflow.com/q/25007433
tags question: http://stackoverflow.com/q/25006537
tags question: http://stackoverflow.com/q/25005057
tags question: http://stackoverflow.com/q/24912919
tags question: http://stackoverflow.com/q/25002338
tags question: http://stackoverflow.com/q/25012199
tags question: http://stackoverflow.com/q/25001857

http://stackoverflow.com/comment/38759981
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24940883
has text: @MindPeace I'm sorry I used generic names for the service thats not actually what I am connecting to
score: 0

http://stackoverflow.com/comment/38768333
score: 0
comment on: http://stackoverflow.com/q/24943894
has text: don't know exactly what you want to do... you could just try the DBMS native dump command (all decent DBMSes have one), which is probably easier and faster to use.
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24991654
type: Answer
has body: Thanks all for the help and advice, I've managed to duplicate the function in Java using Map. if (pValues != null) { Set vSet = pValues.entrySet(); Iterator vIt = vSet.iterator(); while(vIt.hasNext()) { Map.Entry m =(Map.Entry)vIt.next(); vSQL = vSQL.replace("{" + (String)m.getKey() + "}", "'" + (String)m.getValue() + "'"); vSQL = vSQL.replace("[" + (String)m.getKey() +"]", (String)m.getValue()); } }
score: 1
answers question: http://stackoverflow.com/q/24991192
upvote count: 1
accepted answer of: http://stackoverflow.com/q/24991192
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/25036957
answers question: http://stackoverflow.com/q/25036297
has comment: http://stackoverflow.com/comment/38941732
score: 0
has body: You could try this nombre = (new StringBuilder(tipoAbreviado)).toString();
type: Answer
has comment: http://stackoverflow.com/comment/38985671

http://stackoverflow.com/q/25037522
has comment: http://stackoverflow.com/comment/38941369
tagged with: jdbc
has comment: http://stackoverflow.com/comment/38940899
has answer: http://stackoverflow.com/a/25041600
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/38940991
tagged with: jtds
upvote count: 1
has title: JDBC iso-8859-1 encoding
has answer: http://stackoverflow.com/a/42440040
type: Question
tagged with: encoding
has answer: http://stackoverflow.com/a/25040996
has body: In my program, I'm connecting to a Microsoft SQL database using JTDS (http://jtds.sourceforge.net/). The encoding of my database is iso-8859-1. However, to send queries in Java, I have to use Strings (which are normally encoded with UTF). Is it possible to send a Query with a different encoding than UTF? EDIT: The results are displayed wrong after I use INSERT or UPDATE. If I only select from the database, special characters are displayed right.
tagged with: sql-server
answer count: 3
has comment: http://stackoverflow.com/comment/38940710
has comment: http://stackoverflow.com/comment/38941524
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/38968949
type: UnansweredQuestion

http://stackoverflow.com/a/24935686
type: Answer
score: 9
has body: Thanks for all the help guys! @izstas "they should operate on the elements" helped a lot :). Actually this is what I was looking for to be exact public static void test2 (){ Function&lt;Entry&lt;String, List&lt;String&gt;&gt;, String&gt; key = (entry) -&gt; { return entry.getKey(); }; Function&lt;Entry&lt;String, List&lt;String&gt;&gt;, List&lt;String&gt;&gt; value = (entry) -&gt; { return new ArrayList&lt;String&gt;(entry.getValue()); }; BinaryOperator&lt;List&lt;String&gt;&gt; merge = (old, latest)-&gt;{ old.addAll(latest); return old; }; Map&lt;String, List&lt;String&gt;&gt; map1 = new HashMap&lt;&gt;(); map1.put("A", Arrays.asList("A1", "A2")); map1.put("B", Arrays.asList("B1")); map1.put("D", Arrays.asList("D1")); Map&lt;String, List&lt;String&gt;&gt; map2 = new HashMap&lt;&gt;(); map2.put("C", Arrays.asList("C1","C2")); map2.put("D", Arrays.asList("D2")); Stream&lt;Map&lt;String, List&lt;String&gt;&gt;&gt; stream =Stream.of(map1, map2); System.out.println(stream.flatMap((map)-&gt;{ return map.entrySet().stream(); }).collect(Collectors.toMap(key, value, merge))); }
upvote count: 9
downvote count: 0
answers question: http://stackoverflow.com/q/24917053

http://stackoverflow.com/comment/38836493
type: Comment
comment on: http://stackoverflow.com/a/24982130
has text: @Matt333 only one activity is visible at a time so I dont think changing the title of another activity is a good idea. You can send the title you want in a bundle and set it when your activity starts
type: AnswerComment
score: 0

http://stackoverflow.com/q/25037509
has comment: http://stackoverflow.com/comment/38945504
type: Question
possible better answer: http://stackoverflow.com/a/25040317
has comment: http://stackoverflow.com/comment/38940454
has answer: http://stackoverflow.com/a/25038675
has answer: http://stackoverflow.com/a/25040317
score: 0
answer count: 2
has title: Java System.arraycopy resizes destination to source size?
has body: Hi I am trying to use System.arraycopy to copy a smaller array to a bigger one. This does work, but the destination is auto-resized to the source dimension. I have to copy together a table for printing data. I want to copy 3 columns from table A into table C and than in a second step table B's 4th column als 4th column in C. The number of rows are in all cases the same. This idea fails because array copy seems to enforce the source dimensionality on the destination. This is kind of unexpected. I do not want to iterate as this will take a long time if I use production-size data (>1 million or more rows)). I thought arracopy would be nice and fast solution.... any work arounds? public class Test { public static void main(String[] args) { Integer[][] s = new Integer[2][2]; Integer[][] d = new Integer[3][3]; System.out.println(d.length + " " + d[0].length); System.arraycopy(s, 0, d, 0, 2); System.out.println(d.length + " " + d[0].length); } } This is how I call the API, anything wrong or is this resize avoidable?
accepted answer: http://stackoverflow.com/a/25038675
type: AnsweredQuestion
tagged with: java
tagged with: memory

http://stackoverflow.com/comment/38699442
has text: Thanks a lot - this solved the issue! I assumed that JDBC took care of that since it was a String, but I guess not.
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/24909399
type: Comment

http://stackoverflow.com/q/24953321
tagged with: filelock
possible better answer: http://stackoverflow.com/a/24954317
tagged with: synchronization
favorite count: 0
has answer: http://stackoverflow.com/a/24954317
upvote count: 5
has comment: http://stackoverflow.com/comment/38782862
has comment: http://stackoverflow.com/comment/38783218
has body: Process A writes in a file XYZ, when executed. There are processes B and C, which when executed, reads the file XYZ. So, while process A is up, B and C should wait for A to complete. To provide synchronization can I use java.nio package? or I should use something like FileLock or sockets? Can we mention the time to wait for the second process to wait? Edited: The file is created during the first write process. In such case, can I make it shared resource?
has comment: http://stackoverflow.com/comment/38785527
has comment: http://stackoverflow.com/comment/38783185
has comment: http://stackoverflow.com/comment/38853365
has answer: http://stackoverflow.com/a/25014354
tagged with: java.nio.file
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25014354
tagged with: java
tagged with: process
has answer: http://stackoverflow.com/a/24956042
type: Question
score: 4
has comment: http://stackoverflow.com/comment/38783414
answer count: 3
has title: Process Synchronization in java
downvote count: 1

http://stackoverflow.com/comment/43773347
has text: unfortunately i have now downloaded the stable version of Android Studio and it is working gud :)
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27665627
type: Comment

http://stackoverflow.com/comment/38977011
comment on: http://stackoverflow.com/q/25056483
type: Comment
type: QuestionComment
score: 0
has text: How did you calculate `21124` ? and have you checked spellings of strings in arrays ?

http://stackoverflow.com/q/24933917
type: UnansweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/24934014
type: Question
has comment: http://stackoverflow.com/comment/38746463
has comment: http://stackoverflow.com/comment/38746807
has answer: http://stackoverflow.com/a/24934015
score: 4
has comment: http://stackoverflow.com/comment/38745932
upvote count: 4
has title: Number and loop issue
downvote count: 0
favorite count: 0
answer count: 5
has answer: http://stackoverflow.com/a/24934043
has body: I am new to programming and am having difficulty with this problem. I am trying to build a wall based on the number entered in the JTextField but the number cannot exceed 20. I cannot get my error message to display nor can I get my brick wall to build. Could someone please help me figure out what I am doing wrong? public class Wall extends JApplet implements ActionListener { JTextField enter; Boolean submit; JLabel bricks; JButton build; JPanel top; Image zombie; int value; public void init() { setLayout(new BorderLayout()); top = new JPanel(); build = new JButton("AHHHHHH...ZOMBIES!"); //button for building wall bricks = new JLabel("Enter between 1 &amp; 20 rows to contruct:"); enter = new JTextField(2); top.add(build); //add zombie button top.add(bricks); //add intructions top.add(enter); //add text field add(top, BorderLayout.NORTH); build.addActionListener(this); } public void actionPerformed(ActionEvent ae) { if (ae.getSource() == build) { int value = Integer.parseInt(build.getText()); if (value &gt; 0 &amp;&amp; value &lt; 21) { submit = true; repaint(); } else { submit = false; repaint(); } } } public void paint(Graphics g) { super.paint(g); //add zombie image Image zombie = getImage(getCodeBase(), "Zombie.jpg"); g.drawImage(zombie, 0, 45, this); if (submit = false) //add error message { g.setColor(Color.WHITE); g.setFont(new Font("TimesRoman", Font.BOLD, 40)); g.drawString("You must enter a number between 1 &amp; 20!", 400, 100); //add message } int brick_width = 50; int brick_height = 20; int spacing = 1; int x = 0; while (x &lt; 21) { drawBrick(g, nextInt(brick_width + spacing), nextInt(brick_height + spacing)); x = x + getWidth() + 50; x = x - 25 + getWidth() + 50; x++; } } public void drawBrick(Graphics g, int x, int y) { g.setColor(new Color(150, 0, 0)); g.fillRect(0, 635, 50, 20); } }
has answer: http://stackoverflow.com/a/24934056
linked to: http://stackoverflow.com/q/21356277
has answer: http://stackoverflow.com/a/24934039

http://stackoverflow.com/comment/38926676
type: QuestionComment
has text: Another "small" thing: when implementing a benchmark - you should provide a "warmup".
comment on: http://stackoverflow.com/q/25029785
score: 4
type: Comment

http://stackoverflow.com/comment/38953892
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25043988
has text: @CAustin Yes it's another alternative. I included it as well. Thanks for your comment.

http://stackoverflow.com/a/25057535
type: Answer
has comment: http://stackoverflow.com/comment/42851985
answers question: http://stackoverflow.com/q/25057365
has body: did you missed type casting the character to integer? try this: int ascii = (int) convert;
downvote count: 1
score: -1
upvote count: 0

http://stackoverflow.com/comment/38904022
has text: Glasfish? Where I can modify this value in GlassFish? Before, I have modify the heap memory on my project (until 8192MB) but I get error. I don't have modify in Glassfish.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25015708
type: Comment

http://stackoverflow.com/a/25051426
score: 4
upvote count: 4
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: JFileChooser allows you to supply a accessory Component which is added to the JFileChooser component, on the right side under Windows. What you could do is ... Create a JList and ListModel, set the JList as the JFileChoosers accessory (wrapping it in JScrollPane) Each time you select a file, add it to a Set Each time your go to open the JFileChooser, update the JList's model with the values from the Set (or back the model with the Set). Each time the user selects a value from the list, you will need to change the JFileChoosers selectedFile property to reflect the change... For more details, take a look at Providing an Accessory Component for more details... Updated import java.awt.BorderLayout; import java.awt.Component; import java.awt.Dimension; import java.awt.EventQueue; import java.awt.GridBagLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.File; import java.util.ArrayList; import java.util.List; import javax.swing.AbstractListModel; import javax.swing.DefaultListCellRenderer; import javax.swing.Icon; import javax.swing.JButton; import javax.swing.JFileChooser; import javax.swing.JFrame; import javax.swing.JList; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.ListSelectionModel; import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException; import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; import javax.swing.filechooser.FileSystemView; public class TestFileChooser { public static void main(String[] args) { new TestFileChooser(); } public TestFileChooser() { EventQueue.invokeLater(new Runnable() { @Override public void run() { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) { } JFrame frame = new JFrame("Testing"); frame.setDefaultCloseOperation(JFr…
accepted answer of: http://stackoverflow.com/q/25051305
answers question: http://stackoverflow.com/q/25051305

http://stackoverflow.com/a/24925878
downvote count: 0
score: 4
has comment: http://stackoverflow.com/comment/38731328
has comment: http://stackoverflow.com/comment/38731537
type: Answer
has body: Because in most applications, processing a request involves accessing some shared data that may also be accessed by other threads handling other requests at the same time. HTTP sessions are a prime example: all requests in the same session share the same HttpSession object, so if a browser sends two requests at the same time, the two threads handling those requests may try to access the same HttpSession object at the same time. You need synchronization to avoid corrupting the session.
has comment: http://stackoverflow.com/comment/38731814
answers question: http://stackoverflow.com/q/24925733
has comment: http://stackoverflow.com/comment/38749654
accepted answer of: http://stackoverflow.com/q/24925733
upvote count: 4
type: AcceptedAnswer

http://stackoverflow.com/comment/38859794
type: Comment
score: 0
type: AnswerComment
has text: Well, a memory barrier by itself is little descriptive. A fence is established between instructions. If there was another `volatile` variable `z` in the above example and you would read `z` instead of `x`, no guarantees were given.
comment on: http://stackoverflow.com/a/24993468

http://stackoverflow.com/comment/38866067
comment on: http://stackoverflow.com/q/24994122
score: 0
type: Comment
type: QuestionComment
has text: No, there are not many sources to get the driver. To get the MySQL driver you go to the MySQL website. To get the Oracle driver you go to the Oracle website. To get the PostgreSQL driver you go to the PostgreSQL website. etc. etc. Its just as clear as that you go to the nVidia website to get a driver for your nVidia videocard, you don't go try and installing AMD drivers.

http://stackoverflow.com/comment/38906632
type: Comment
has text: `Select Name from dual` and not `Select Name from people`
comment on: http://stackoverflow.com/a/25018717
score: 0
type: AnswerComment

http://stackoverflow.com/comment/38706994
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24913072
score: 0
has text: Can you print output of `normalizeWildcards(pattern)` call?

http://stackoverflow.com/q/25050918
score: 0
has body: I create Conversations for VersionOne Assets programatically using the Java API. When checking the conversations on the Web UI, I see that the assets mentioned are alphabetically arranged. I would like to know if there is a way to override the default arrangement of the mentions. The target arrangement would be from Parent Asset -> Children. Something like this: Default: Add reset Button (Task), Add submit Button (Task), Create UI (Story) Target: Create UI (Story), Add reset Button (Task), Add submit Button (Task) Some things I tried: Looking at the Expression and Message metadata. Can't find anything related to either sorting or ordering. Adding the Parent Asset 1st followed by the children: // create a new conversation; this will act as the container of the expression (message) IAssetType conversationType = super.connection.metaModel.getAssetType(CONVERSATION); Asset conversationAsset = super.connection.services.createNew(conversationType, Oid.Null); super.connection.services.save(conversationAsset); // create a new expression containing the error message IAssetType expressionType = super.connection.metaModel.getAssetType(EXPRESSION); IAttributeDefinition expressionContentAttr = super.connection.metaModel.getAttributeDefinition(EXPRESSION_CONTENT); IAttributeDefinition expressionBelongsTo = super.connection.metaModel.getAttributeDefinition(EXPRESSION_BELONGS_TO); IAttributeDefinition expressionMentionsAttr = super.connection.metaModel.getAttributeDefinition(EXPRESSION_MENTIONS); Asset expressionAsset = super.connection.services.createNew(expressionType, Oid.Null); // set the message expressionAsset.setAttributeValue(expressionContentAttr, message); // add the message to the conversation expressionAsset.setAttributeValue(expressionBelongsTo, conversationAsset.oid); // set the context of the expression to belong to the VersionOne record Oid oid = Oid.fromToken(entity.oid, super.connection.metaModel); expressionAsset.addAttributeValue(expressionMentionsAttr, oid); //…
tagged with: versionone
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/25265795
type: Question
has title: How do I rearrange the order of the Mentions in a Expression in VersionOne?
answer count: 1
tagged with: rest
accepted answer: http://stackoverflow.com/a/25265795

http://stackoverflow.com/q/24946476
has answer: http://stackoverflow.com/a/24946549
linked to: http://stackoverflow.com/q/23424379
has answer: http://stackoverflow.com/a/24946574
answer count: 3
upvote count: 1
favorite count: 0
tagged with: timer
has answer: http://stackoverflow.com/a/53655527
type: UnansweredQuestion
has body: I am trying to implement a 24 hour countdown timer with three separate textviews one holds hours, one holds minutes, and one holds seconds. When the start time button is pushed I want the timer to count down. I have done a lot of research on this and tried to implement many examples, learn from the documentations and modify it to my liking, but I couldn't produce a solid solution. Countdown timer in HH:MM:SS format in Android Display timer in textview contain days, hours, minutes and seconds in android The problem is that for the countdown timer in android it is usually implemented with just one textview treated as a long string with the time and then it counts down from there. I am not sure how I would approach the 24 hour countdown timer in my case since I have three separate textviews. I'm surprised I couldn't find much about this problem. I.E. For example here I have a countdown timer, but this is only using one textview. How would I make something that takes in consideration my three separate textviews for hours, minutes, and seconds and countsdown accordingly. Button buttonStartTime; // clicking this button will start time count down TextView textViewShowTime; // will show the time CountDownTimer countDownTimer; // built in android class CountDownTimer long totalTimeCountInMilliseconds; // total count down time in milliseconds long timeBlinkInMilliseconds; // start time of start blinking boolean blink; // controls the blinking .. on and off /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); getReferenceOfViews (); // get all views setActionListeners (); // set action listerns totalTimeCountInMilliseconds = 60 * 1000; // time count for 3 minutes = 180 seconds timeBlinkInMilliseconds = 30 * 1000; // blink starts at 1 minutes = 60 seconds } private void setActionListeners() { buttonStartTime.setOnClickListener(new View.OnClickListener() { …
tagged with: android
downvote count: 0
score: 1
tagged with: java
has title: 24 Hour CountDown Timer with three separate textviews for hours, minutes, second
linked to: http://stackoverflow.com/q/15404143
type: Question

http://stackoverflow.com/comment/38805168
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24965215
has text: @user3ffgfgfgfgfg50064 yes, something like a calculator parser! i have serious mental block, i can't think of how to decode it
type: Comment

http://stackoverflow.com/q/25033600
tagged with: jsp
tagged with: alloy-ui
score: 0
has answer: http://stackoverflow.com/a/25076387
accepted answer: http://stackoverflow.com/a/25076387
has title: Liferay + JSP + AlloyUI: Button as link and submit
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/38938110
type: Question
tagged with: liferay
has body: I use Liferay 6.2 on JBoss 7.1.1. Also I am using a JSP as view with AlloyUI. I want a button as a link and as a submitter of a value to a method in the MVCPortlet class. The link is inside a java array. The attribute that is passed to the java method is inside a input field. It works if I use just one of this two. I tried to combine them but it doesn't work. I tried this: &lt;a href="&lt;%=unread[i][k]%&gt;" target="_blank" &gt; &lt;aui:button type="submit" /&gt; &lt;/a&gt; It calls the method but it doesnt opens a new tab in my browser. In my browser I can see that it is a link, if I click right on it -> new tab, it opens it correctly in a new tab. But not if I just click on the button. Second way: &lt;aui:button type="submit" onclick="window.open('http://www.google.de', '_blank', ''); return false;"/&gt; It just opens google but doesn't calls the method. Also it is not possible to get an Java attribute inside of a Javascript, but I could get the value out of a hidden input field. But still there would be the problem that it doesn't call the method.
answer count: 1

http://stackoverflow.com/comment/38936805
type: Comment
has text: Swing Timer doesn't guarantee that event will be executed at the end of EDT, this is job for invokeLater otherwise isn't possible to ordering for one event, DocumentFilter is mentioned there as notifier for listening the changes inside Document with intention to change/modify/append, I see there many times (I think this is mistake because DocumentListener is designated to distribute an event from/out of Document to GUI not to itself) to use DocumentListener and to invoke events back, to own Document and delayed by Swing Timer or invokeLater,
comment on: http://stackoverflow.com/a/25034293
type: AnswerComment
score: 0

http://stackoverflow.com/comment/38910709
type: Comment
comment on: http://stackoverflow.com/a/25016089
has text: Thanks.. Then how can I solve this? What should I do in client side? How ever I could send outputstream instead of byte[]. then no issue.
score: 1
type: AnswerComment

http://stackoverflow.com/a/24955174
downvote count: 0
score: 1
has body: You need jdk1.7 + to run tomcat 8, if you are using jdk1.6, you need tomcat 7-. See this: http://tomcat.apache.org/whichversion.html This make me remember back in collage, it took me 2 days to finish jdk/tomcat hello world, :) , what a good time it is. Just make sure, open a command line, input java --version to check whether you jdk is configured well, and which version it is in use. Just to be sure, in some case you need to re-login or reboot to make your new configured jdk work. Believe me, if you configured jdk well, you don't need to change anything of the tomcat, just unzip it, and start it, it would work, unless the port 8080 is already taken.
answers question: http://stackoverflow.com/q/24954994
upvote count: 1
type: Answer

http://stackoverflow.com/comment/38738644
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24929852
has text: How could I fix this?
score: 0

http://stackoverflow.com/q/25060813
tagged with: shell
has title: How to make argument mandatory for script to run java application
tagged with: unix
has body: My script is called report_startDate It has the following line: $JRE_ROOT/bin/java -cp /home/me/report/config/:/home/me/report/jar/reporting-1.0-SNAPSHOT.jar com.me.project.report.Main $1 $1 makes it possible to for me to run the script as ./report_startDate 20140717. But the script also runs without the date. I want to make it mandatory for whoever runs this script to supply the date. What could I replace $1 with to make it mandatory to supply date. I do not want to add logic to code, rather add logic to shell script as there are multiple scripts one with date one without date.
type: UnansweredQuestion
tagged with: java
tagged with: classpath
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/25062304
has answer: http://stackoverflow.com/a/25060882
score: 0

http://stackoverflow.com/a/24931644
has body: For convolution the no of output points is equal to: N_out = N_in + K + 1 where: N_out = no of output points N_in = no of input points K = kernel size So it looks like you are convolving your 256x256 image with a 304x25 kernel. As for the PFA algorithm, this is just an implementation detail - the FFT dimension is broken down into powers of small primes. The end result is the same as for a DFT though.
has comment: http://stackoverflow.com/comment/38754263
type: Answer
has comment: http://stackoverflow.com/comment/38749653
has comment: http://stackoverflow.com/comment/38745190
has comment: http://stackoverflow.com/comment/38756636
has comment: http://stackoverflow.com/comment/38756650
has comment: http://stackoverflow.com/comment/38753780
score: 0
answers question: http://stackoverflow.com/q/24929341

http://stackoverflow.com/comment/38730096
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24924942
score: 0
has text: I resolved it myself. Weird that I need to prepend my getters name with "get" .Like for Id I had to change it to getId.

http://stackoverflow.com/comment/38910577
has text: Start by getting rid of the openjpa.RuntimeUnenhancedClasses property. It is quite likely that is the root of your problems.
comment on: http://stackoverflow.com/q/25020393
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25048123
type: Answer
has comment: http://stackoverflow.com/comment/38961683
has comment: http://stackoverflow.com/comment/38961940
answers question: http://stackoverflow.com/q/25047981
has comment: http://stackoverflow.com/comment/38961806
score: 0
has comment: http://stackoverflow.com/comment/38961346
has body: First the image can't be seen and Constant Value: -256 (0xffffff00) is Yellow https://developer.android.com/reference/android/graphics/Color.html use this code to convert to hex value String hexColor = String.format("#%06X", (0xFFFFFF &amp; intColor)); checkout this link here : How to convert a color integer to a hex String in Android?

http://stackoverflow.com/q/25051149
tagged with: datetime
has answer: http://stackoverflow.com/a/25051170
accepted answer: http://stackoverflow.com/a/25051209
has comment: http://stackoverflow.com/comment/38968340
has answer: http://stackoverflow.com/a/25051643
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/47074612
has answer: http://stackoverflow.com/a/53202040
tagged with: java
linked to: http://stackoverflow.com/q/4216745
upvote count: 7
type: Question
possible better answer: http://stackoverflow.com/a/53202040
linked to: http://stackoverflow.com/q/13051298
linked to: http://stackoverflow.com/q/15459001
has answer: http://stackoverflow.com/a/25051289
has answer: http://stackoverflow.com/a/25051209
has answer: http://stackoverflow.com/a/25051602
has answer: http://stackoverflow.com/a/46662011
downvote count: 0
answer count: 10
score: 7
has answer: http://stackoverflow.com/a/25051262
favorite count: 0
has answer: http://stackoverflow.com/a/25051177
has body: I wanted to display time in AM / PM format. Example : 9:00 AM I wanted to perform addition subtraction operation as well. My event will start from 9:00 AM all time. I wanted to add minutes to get the result schedule event. How can I do that other then making a custom Time class? Start 9:00 AM Add 45 min, after addition Start Time 9:45 AM
has title: How can I display time in AM/PM format

http://stackoverflow.com/q/24918584
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/24918847
type: Question
has body: Why does the below java code compilation result in an error? I'm using java 8, if that matters. public class SimpleTest { private static boolean isPresent(int []... arrays, int number){ boolean isPresent = true; for(int i=0;i&lt;arrays.length;i++){ //isPresent = doBinarySearch(arrays[i], number); if(!isPresent){ break; } } return isPresent; } } And here is the error I am getting: SimpleTest.java:3: error: ')' expected private static boolean isPresent(int []... arrays, String number){ ^ SimpleTest.java:3: error: ';' expected private static boolean isPresent(int []... arrays, String number){ ^ 2 errors
has comment: http://stackoverflow.com/comment/38717544
possible better answer: http://stackoverflow.com/a/24918847
score: 0
answer count: 2
has title: Why this java Class doesn't compile
tagged with: variadic-functions
accepted answer: http://stackoverflow.com/a/24918813
has answer: http://stackoverflow.com/a/24918813

http://stackoverflow.com/comment/38702328
type: AnswerComment
comment on: http://stackoverflow.com/a/24910643
has text: yes, if you set str value to "\n command1\n command2 \n" it would work as you say.
type: Comment
score: 0

http://stackoverflow.com/a/25026376
has body: Don't test "has exactly 2 divisors", test "is not divisible by numbers other than 1 and itself". Don't test all values <= k as divisors, test all values <= sqrt(k). (If a number is divisible by a number greater than sqrt(k), then the result of the division is also an divisor, but would have been found earlier) Maybe reuse already calculated primes; You only need to test prime numbers as possible divisors. However you need to be careful. If you e.g. search in range 9999-9999, it doesn't make sense to calculate all the smaller primes, however if the range is 1-9999, it reduces the number of checks you have to make. You could combine both approaches and test numbers smaller than n1 the "normal" way and test all larger divisors using the primes you already found. Your loop can be rewritten like this to apply 1. and 2.: int k=Math.max(2, n1); // 0 and 1 are no prime int count1 = 0; while(k <= n2 && count1 <= n) { final int sqrt = (int) Math.sqrt(k); count1++; // asume it's a prime for(int i = 2; i <= sqrt; i++) { if(k % i == 0) { // divisible by number other than 1 and itself -> not a prime count1--; break; } } k++; } This reduces the running time from O((n2)² - (n1)²) to
answers question: http://stackoverflow.com/q/25025676
score: 0
type: Answer

http://stackoverflow.com/comment/38927909
type: Comment
comment on: http://stackoverflow.com/a/24996322
has text: Can you suggest any better design to make my methods more robust?
type: AnswerComment
score: 0

http://stackoverflow.com/a/25008256
score: 0
has body: You can submit your jsp page to servlet. For this use&lt;form&gt; tag. And to redirect use: response.sendRedirect("servleturl")
type: Answer
accepted answer of: http://stackoverflow.com/q/25008252
answers question: http://stackoverflow.com/q/25008252
type: AcceptedAnswer

http://stackoverflow.com/comment/38844300
type: QuestionComment
score: 0
has text: Describe _didn't let me_. You can go through the Help Center. It explains how to post code.
comment on: http://stackoverflow.com/q/24986083
type: Comment

serialization
tags question: http://stackoverflow.com/q/25067746
tags question: http://stackoverflow.com/q/24936776
tags question: http://stackoverflow.com/q/25022127
tags question: http://stackoverflow.com/q/24978461
tags question: http://stackoverflow.com/q/24985231
tags question: http://stackoverflow.com/q/25001866
tags question: http://stackoverflow.com/q/25064203
tags question: http://stackoverflow.com/q/24952582
tags question: http://stackoverflow.com/q/25021203
tag name: serialization
tags question: http://stackoverflow.com/q/25000558
tags question: http://stackoverflow.com/q/24932383
tags question: http://stackoverflow.com/q/25004418
tags question: http://stackoverflow.com/q/25003431
tags question: http://stackoverflow.com/q/25002595
tags question: http://stackoverflow.com/q/25042692
tags question: http://stackoverflow.com/q/25005935
tags question: http://stackoverflow.com/q/25015411
type: Tag
tags question: http://stackoverflow.com/q/25024632
tags question: http://stackoverflow.com/q/24987851
tags question: http://stackoverflow.com/q/24976211
tags question: http://stackoverflow.com/q/24956164
tags question: http://stackoverflow.com/q/25055280
tags question: http://stackoverflow.com/q/25016172
tags question: http://stackoverflow.com/q/24988527
tags question: http://stackoverflow.com/q/24981501

http://stackoverflow.com/q/24920014
tagged with: sqlite
has answer: http://stackoverflow.com/a/24927405
has body: Any idea how to update a sqlite database created with openorcreatedatabase. The problem is that already published in market the app. And to the new version of the app is added fields to the database. I tried this way package com.example.database1; import android.app.ProgressDialog; import android.content.Context; import android.content.Intent; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteDatabase.CursorFactory; import android.database.sqlite.SQLiteOpenHelper; import android.net.ConnectivityManager; import android.net.NetworkInfo; import android.util.Log; import android.widget.Toast; public class ManagerDB extends SQLiteOpenHelper { private static final String dropTablaUser = "drop table if exists user;"; private static final String createTablaUser = "create table if not exists user(userid integer primary key);"; public ManagerDB(Context contexto, String namedb, CursorFactory factory, int version) { super(contexto, namedb, factory, version); } @Override public void onCreate(SQLiteDatabase db) { try { db.execSQL(createTablaUser); } catch (Exception e) { Log.i(TAG, "Error to open or create the database" + e); } } @Override public void onUpgrade(SQLiteDatabase db, int versionafter, int newversion) { try { db.execSQL(dropTablaUser); db.execSQL(createTablaUser); } catch (Exception e) { Log.i(TAG, "Error to open or create the database" + e); } } } But those who have the older version will not update the database because it was not created in this way but with openorcreatedatabase
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38733983
tagged with: oncreate
has title: Is it possible to upgrade a database created with openorCreatedatabase sqlite?
tagged with: java
type: Question
score: 0
answer count: 1
tagged with: android

http://stackoverflow.com/comment/38824535
score: 0
type: Comment
type: QuestionComment
has text: btw http://b128.ve.vc/b/data/128/1735/asd.mp3 is invalid link ... i am using a valid link instead of that...i.e instead of asd.mp3 i have a name that is actually there which i thought not important to disclose.
comment on: http://stackoverflow.com/q/24975455

http://stackoverflow.com/q/25025617
tagged with: jprofiler
has answer: http://stackoverflow.com/a/31424682
has body: I am new to JProfiler. I am leaning this software to give a presentation. I run the class file by starting a new session. JProfiler displayed all classes on the dynamic live memory screen. However, when I tried to show in heap walker, a error message dialog box appeared. Which says... "No objects of java.lang.Objects could be found in heap snapshot" java.lang.Objects is the class the i tried to view in heap walker. Can anyone please let why is this showing and how to solve it? Thank you in advance
tagged with: memory-leaks
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25026149
type: Question
tagged with: java
has title: "No object of java.lang.Objects could be found in heap snapshot" in JProfiler
tagged with: class
score: 0
answer count: 2

http://stackoverflow.com/comment/38862480
has text: Some sample code would be helpful.
comment on: http://stackoverflow.com/q/24995971
score: 4
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25009488
answers question: http://stackoverflow.com/q/25007286
has body: Just a complement to the other answers. Spring documentation is explicit : Spring does its best to retrieve correct parameters : if using Java 8 it uses Java 8 reflection if classes are compiled in debug mode, parameter name is present and spring uses it, same if ajc (aspectJ compiler) has been used) it can eventually uses @Param annotations it uses the type if not ambiguous
score: 0
type: Answer

http://stackoverflow.com/comment/38882748
score: 0
comment on: http://stackoverflow.com/a/25006641
type: AnswerComment
type: Comment
has text: The compiler in most of the case can analyze if the return value by the post increment is used, if not optimize as if were pre-increment. The other problem with new compiler is data dependency, when using pre-increment the cpu has to wait for the result of the operation to use the value in other instructions, with post increment, it could continue execution until the value is needed, all this in parallel.

http://stackoverflow.com/comment/38924798
score: 0
type: Comment
type: QuestionComment
has text: I believe so, it then asked if I wanted to close the workbench? Is that the same error?
comment on: http://stackoverflow.com/q/25028669

http://stackoverflow.com/q/24964361
tagged with: elasticsearch
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/24967359
upvote count: 10
type: Question
answer count: 2
downvote count: 0
score: 10
has title: Elasticsearch aggregation using Java api
has answer: http://stackoverflow.com/a/37730489
has answer: http://stackoverflow.com/a/24967359
favorite count: 0
has body: Hi I am trying to do query on elastic search by following the sql query and I want to implement same logic using Java API select dttime, avg(cpu) from table cpustats where server="X" and dttime="Y" group by dttime,cpu Now I have the following Java code but it does not return expected output SearchResponse response = client.prepareSearch("cpuindex") .setTypes("cputype") .setQuery(QueryBuilders.matchAllQuery()) .addAggregation(AggregationBuilders.terms("cpu_agg") .field("cpu").size(100)) .execute().actionGet(); Please guide I am new to Elastic search. Thanks in advance.
possible better answer: http://stackoverflow.com/a/37730489

http://stackoverflow.com/comment/38973649
score: 1
type: Comment
type: QuestionComment
has text: Why declare it at all? Just place it inline at the use site.
comment on: http://stackoverflow.com/q/25054866

http://stackoverflow.com/q/24929852
upvote count: 3
tagged with: java
tagged with: bukkit
tagged with: mysql
type: Question
score: 3
has answer: http://stackoverflow.com/a/25333505
has comment: http://stackoverflow.com/comment/39494800
has title: Java - MySQL - Error while connecting to MySQL database
has comment: http://stackoverflow.com/comment/38738644
answer count: 1
downvote count: 0
accepted answer: http://stackoverflow.com/a/25333505
favorite count: 0
has body: I'm trying to make a Bukkit plugin with MySQL support. The plugin that I'm making is a eco plugin, so I have to put all the names of the players in a MySQL table. I'm using a PlayerJoinEvent to register the player in the database if they haven't been registered yet. When I enable my plugin it isn't giving any errors, but when a player joins(that is when the PlayerJoinEvent gets fired) an error appears. The connect() method is being called in the onEnable() The error that I am getting [19:07:54 INFO]: UUID of player behhhans is da772a82-cdc9-3b79-962b-4cdc7623dd7a [19:07:54 ERROR]: Could not pass event PlayerLoginEvent to Tokeconomy v1.0 org.bukkit.event.EventException at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.ja va:294) ~[spigot.jar:git-Spigot-1523] at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.jav a:62) ~[spigot.jar:git-Spigot-1523] at org.bukkit.plugin.TimedRegisteredListener.callEvent(TimedRegisteredLi stener.java:30) ~[spigot.jar:git-Spigot-1523] at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.j ava:502) [spigot.jar:git-Spigot-1523] at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.j ava:487) [spigot.jar:git-Spigot-1523] at net.minecraft.server.v1_7_R3.PlayerList.attemptLogin(PlayerList.java: 400) [spigot.jar:git-Spigot-1523] at net.minecraft.server.v1_7_R3.LoginListener.c(LoginListener.java:97) [ spigot.jar:git-Spigot-1523] at net.minecraft.server.v1_7_R3.LoginListener.a(LoginListener.java:43) [ spigot.jar:git-Spigot-1523] at net.minecraft.server.v1_7_R3.NetworkManager.a(NetworkManager.java:187 ) [spigot.jar:git-Spigot-1523] at net.minecraft.server.v1_7_R3.ServerConnection.c(ServerConnection.java :81) [spigot.jar:git-Spigot-1523] at net.minecraft.server.v1_7_R3.MinecraftServer.v(MinecraftServer.java:7 20) [spigot.jar:git-Spigot-1523] at net.minecraft.server.v1_7_R3.DedicatedServer.v(DedicatedServer.java:2 83) [spigot.jar:git-Spigot-1523] at net.minecraft.server.v1_7_R…
has comment: http://stackoverflow.com/comment/38738485
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38740322

http://stackoverflow.com/comment/38856751
type: Comment
comment on: http://stackoverflow.com/q/24936259
has text: can u modify my code given above with the credentials and post it as an answer pls ??
score: 0
type: QuestionComment

http://stackoverflow.com/comment/38717194
comment on: http://stackoverflow.com/a/24914586
type: AnswerComment
score: 22
type: Comment
has text: @Jakub Good point. Java code with `int` vs. C++ code with `double` isn't a fair comparison.

http://stackoverflow.com/comment/38887904
type: Comment
comment on: http://stackoverflow.com/q/25009164
type: QuestionComment
has text: The LinearLayout is a waste in the overall layout, it serves no purpose as it hosts a single child and that child is set to `fillParent`. While it may seem insignificant, these types of wasteful layouts can cause more processing time and memory and should be removed. The layout parameters for the child are RelativeLayout.LayoutParameters, which is invalid.
score: 0

http://stackoverflow.com/a/24931069
has body: Just blogged the steps to make it done with my working code for you. Context Menu or Right Click Handler in GWT. Here is the essential part of that code. lable.sinkEvents(Event.ONCONTEXTMENU); lable.addHandler( new ContextMenuHandler() { @Override public void onContextMenu(ContextMenuEvent event) { event.preventDefault(); event.stopPropagation(); popupMenu.setPopupPosition( event.getNativeEvent().getClientX(), event.getNativeEvent().getClientY()); popupMenu.show(); } }, ContextMenuEvent.getType() );
downvote count: 0
type: Answer
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/24927977

http://stackoverflow.com/q/24998257
has comment: http://stackoverflow.com/comment/38867185
score: 0
tagged with: android
type: UnansweredQuestion
tagged with: soap
has title: Android SOAP request containing Date gives an error: The conversion of a datetime2 data type to a datetime data type resulted in an out-of-range value
answer count: 0
tagged with: java
tagged with: date
has body: Using HTTPPost I am sending the following SOAP request to a WCF .Net server: <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tem="http://tempuri.org/" xmlns:arr="http://schemas.microsoft.com/2003/10/Serialization/Arrays"> <soapenv:Header/> <soapenv:Body> <tem:CreateExpense> <tem:sessionID>ae56e4f8ccbf4c478db2353cdec6cb57</tem:sessionID> <tem:parameters> <arr:KeyValueOfstringstring> <arr:Key>assignment</arr:Key> <arr:Value>6</arr:Value> <arr:Key>datestart</arr:Key> <arr:Value>2009-02-27T12:12:22</arr:Value> <arr:Key>dateend</arr:Key> <arr:Value>2009-02-27T12:12:22</arr:Value> </arr:KeyValueOfstringstring> </tem:parameters> </tem:CreateExpense> </soapenv:Body> </soapenv:Envelope> But the error I get is <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"> <s:Body> <s:Fault> a:InternalServiceFault An error occurred while updating the entries. See the inner exception for details. <detail> <ExceptionDetail xmlns="http://schemas.datacontract.org/2004/07/System.ServiceModel" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"> <HelpLink i:nil="true"/> <InnerException> <HelpLink i:nil="true"/> <InnerException> <HelpLink i:nil="true"/> <InnerException i:nil="true"/> The conversion of a datetime2 data type to a datetime data type resulted in an out-of-range value. The statement has been terminated. My server side counterpart tells me that .NET is interpreting the date on the server side. He cannot tell me what format I should send it in. My start date and end date are sent as string values. I have tried: d 2/27/2009 D Friday, February 27, 2009 f Friday, February 27, 2009 12:11 PM F Friday, February 27, 2009 12:12:22 PM g 2/27/2009 12:12 PM G 2/27/2009 12:12:22 PM m February 27 M February 27 o 2009-02-27T12:12:22.1020000-08:00 O 2009-02-27T12:12:22.1020000-08:00 s 2009-02-27T12:12:22 t 12:12 PM T 12:12:22 PM u 2009-02-27 12:12:22Z U Friday, February 27, 2009 8:12:22 PM y February, 2009 Y February, 2009 I have tried all of the above …
type: Question
has comment: http://stackoverflow.com/comment/38867277
tagged with: .net

http://stackoverflow.com/a/24979590
has body: You should try c.buttons(); instead of color.buttons(); As non static methods can not be directly referenced, you need an object to do that. Where as if the method is static then you can use color.buttons();.
type: Answer
score: 2
downvote count: 0
upvote count: 2
answers question: http://stackoverflow.com/q/24979566

http://stackoverflow.com/comment/38932430
type: QuestionComment
has text: Which class? Print the whole stack trace.
comment on: http://stackoverflow.com/q/25033072
score: 2
type: Comment

http://stackoverflow.com/comment/39116146
has text: yes my currently version is 76 but still i don't have it. look at my images above in updated part.
comment on: http://stackoverflow.com/a/24998792
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/38892507
comment on: http://stackoverflow.com/q/25011613
type: QuestionComment
has text: did you try to create a war with files and deploy that?
score: 0
type: Comment

http://stackoverflow.com/a/25028416
score: 1
has comment: http://stackoverflow.com/comment/38939773
has comment: http://stackoverflow.com/comment/38945713
has body: Try this: resultString = resultString.replaceAll("[^A-Za-z0-9_\\s]",""); This will replace everything except letters, numbers, underscores and spaces. Input: "--Hello&amp; World-@ 1234..." Output: "Hello World 1234" If you don't want to keep underscores in the string change the pattern to [^A-Za-z0-9\\s].
downvote count: 0
has comment: http://stackoverflow.com/comment/38937584
has comment: http://stackoverflow.com/comment/38934738
has comment: http://stackoverflow.com/comment/38935227
answers question: http://stackoverflow.com/q/25028381
type: Answer
has comment: http://stackoverflow.com/comment/38937449
has comment: http://stackoverflow.com/comment/38937518
upvote count: 1
has comment: http://stackoverflow.com/comment/38937525

http://stackoverflow.com/a/25008672
answers question: http://stackoverflow.com/q/24996483
upvote count: 1
accepted answer of: http://stackoverflow.com/q/24996483
score: 1
type: AcceptedAnswer
downvote count: 0
has body: In both your @Configuration classes, which are in the test.springMVC.config package, you've specified @ComponentScan({ "test.springMVC.config", "test.springMVC.controller" }) So each @Configuration class will scan and initialize component beans in those declared packages. One of those beans will be an instance of the other @Configuration class. @Configuration is special in that Spring will initialize the beans declared in its annotated class. In this case, your public config will create two ViewResolver beans. It just so happens that it registers the secure one first and that's the one that will be used. You can simply remove the test.springMVC.config package from the @ComponentScan of each @Configuration class to make this work.
has comment: http://stackoverflow.com/comment/38887419
type: Answer

http://stackoverflow.com/comment/38827507
comment on: http://stackoverflow.com/q/24976683
has text: Ok, so they gave us the nastiest form of crash. I assume there was nothing else in the normal logcat? So what I'm getting from the crash is a list of where every thread in your app has on its stack. I see a lot of waits and select calls. These are normal- it means the threads are waiting for data or commands. I'm wondering about the possibility of a deadlock state causing the watchdog timer to go off.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/42135582
type: Answer
upvote count: 0
score: -1
has body: I had this issue and it turned out to be a front-end problem. Yes, I was trying to upload the wrong file type, but I was expecting correct handling and a gracious popup message alert. Instead I was getting the error you described. In my case, I was using extjs and I had a failure function like this: failure: function (a) { ...some message alert... } instead of: failure: function (f, a) { ...some message alert... } and this was throwing that exception, instead of displaying my message alert.
answers question: http://stackoverflow.com/q/24927165
downvote count: 1

http://stackoverflow.com/q/24914993
type: UnansweredQuestion
has body: I am building an editor application using GWT/GXT with gwt editor framework. For some cases I have to edit a list of dates. To do so I chose to use GridInlineEditing, it works fine, but I also have to make some format validation on my DateField inside the gridInlineEditing. Basically, the default behavior of the editing is to "record" changes when CompleteEditEvent is fired regardless the result of the validation. I therefore tried to override the onCompleteEditHandler method like this (which obviously is the only way to do it according to GXT forum): public class NameValueDTMEditorWidget extends GenericEditableListView&lt;DTM, Date&gt; implements Editor&lt;NameValueDTM&gt; { private final static DTMProperties props = GWT.create(DTMProperties.class); ListStoreEditor&lt;DTM&gt; values; @Ignore private DateField df = new DateField(); public NameValueDTMEditorWidget(String widgetTitle) { super(widgetTitle, new ListStore&lt;DTM&gt;(props.key()), props.dtm()); DateTimeFormat dtf = DateTimeFormat.getFormat("yyyyMMddHHmmss"); df.setPropertyEditor(new DateTimePropertyEditor(dtf)); addEditorConfig(df); // parent class method basically doing: editing.addEditor(df), editing is GridInlineEditing // Modifying grid cell render for a Date Cell c = new DateCell(DateTimeFormat.getFormat("yyyy-MM-dd HH:mm:ss")); getColumnModel().getColumn(0).setCell(c); values = new ListStoreEditor&lt;DTM&gt;(getStore()); editing.addCompleteEditHandler(new CompleteEditEvent.CompleteEditHandler&lt;DTM&gt;() { @Override public void onCompleteEdit(CompleteEditEvent&lt;DTM&gt; event) { df.validate(); // I force field validation if (df.getValue() == null || !df.isValid()) { // if value's not valid getStore().clear(); // clear the store DTM e = GWT.create(DTM.class); getStore().add(e); // add a new value editing.startEditing(event.getEditCell()); // start editing new value df.forceInvalid(); // force invalid to get invilid display on the field } } }); } It does almost what I want, it stays in edition when …
has title: GXT GridInlineEditing field validation
tagged with: gwt
has answer: http://stackoverflow.com/a/24961101
tagged with: java
tagged with: gxt
type: Question
answer count: 2
tagged with: inline-editing
score: 0
tagged with: validation
has answer: http://stackoverflow.com/a/25070154

http://stackoverflow.com/comment/38829199
has text: Hi thanks for the answer. I have a question regarding the "..." portion. Is there anything else that I should include for that part other than the try-with-resources?
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24968704

http://stackoverflow.com/comment/39029233
has text: Thank you for this suggestion. Between yours and Syam's answer i have fixed my original issue.
type: AnswerComment
comment on: http://stackoverflow.com/a/25044819
type: Comment
score: 1

http://stackoverflow.com/comment/38706944
comment on: http://stackoverflow.com/q/24910733
type: QuestionComment
has text: It doesn't matter in HL7. What does the documentation for HAPI say?
type: Comment
score: 1

http://stackoverflow.com/comment/66396093
comment on: http://stackoverflow.com/a/24946881
has text: ah, too bad there is no ResultSet.getRow method!
type: Comment
score: 2
type: AnswerComment

http://stackoverflow.com/comment/38835141
has text: Ага, поймал! Просто надо сейчас уходить
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24980808

http://stackoverflow.com/q/24994759
has title: H2 database , does not save changes on shutdown
answer count: 1
has comment: http://stackoverflow.com/comment/38860287
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24995079
tagged with: java
tagged with: h2
type: Question
has body: I am using H2 with Hibernate 4.1 ORM as JPA 2. This is my database URL from persistance.xml. &lt;property name="javax.persistence.jdbc.url" value="jdbc:h2:./database/data;DB_CLOSE_ON_EXIT=FALSE;TRACE_LEVEL_FILE=3"/&gt; I set database not to close automatically because I am using a shutdown hook , that commits a transaction. And I also set the system to log all the SQL into the trace file. I can see in the file that the database recieves all the SQL commands. my hook Runtime.getRuntime().addShutdownHook(new Thread() { @Override public void run() { if(main!=null) { main.Disconnect(); } try { PersistenceHandler.em.getTransaction().commit(); PersistenceHandler.em.createQuery("SHUTDOWN COMPACT").executeUpdate(); PersistenceHandler.em.close(); }catch(Exception e){e.printStackTrace();} try { Config.Write(); } catch(Exception e) {} } }); This does work on my machine , but does not work on another rather sluggish machine.
has comment: http://stackoverflow.com/comment/38860678
score: 0

http://stackoverflow.com/comment/125723762
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24991740
has text: In the CLASSPATH, the jar file name must match the downloaded jar file e.g. if you have downloaded the "antlr-4.9.2-complete.jar" the CLASSPATH should be: .;C:\Javalib\antlr-4.9.2-complete.jar;%CLASSPATH% where "C:\Javalib" is the path where you installed antlr-4.
score: 0

http://stackoverflow.com/comment/38753763
has text: Indeed, it is in the WEB-INF folder of the exported WAR file.
type: Comment
comment on: http://stackoverflow.com/q/24937613
score: 0
type: QuestionComment

http://stackoverflow.com/q/25020205
type: AnsweredQuestion
score: 1
tagged with: java
has title: Using AsyncTask to load a lot of images on one layout?
upvote count: 1
has body: I want to know how to use AsyncTask or anything eles that will help to load a lot of images (nearly 30 images) in one layout. because the app won't open it always triggers an ANR here is my xml but does not include all images: <?xml version="1.0" encoding="utf-8"?> <ImageView android:id="@+id/imageView1" android:layout_width="150dp" android:layout_height="90dp" android:src="@drawable/hk2fm" /> <View android:layout_width="fill_parent" android:layout_height="1dip" android:background="#000000" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:paddingTop="10dip" android:text="Weapons" android:textSize="20sp" android:textStyle="bold" /> <ImageButton android:id="@+id/staff" android:layout_width="90dip" android:layout_height="90dip" android:layout_gravity="center" android:scaleType="centerCrop" android:src="@drawable/magestaff" android:background="@android:color/transparent" /> <TextView android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="" /> <ImageButton android:id="@+id/images1" android:layout_width="140dip" android:layout_height="140dip" android:layout_gravity="center" android:scaleType="centerCrop" android:src="@drawable/obok" android:background="@android:color/transparent" /> <ImageButton android:id="@+id/shield" android:layout_width="90dip" android:layout_height="90dip" android:layout_gravity="center" android:background="@android:color/transparent" android:scaleType="fitCenter" android:src="@drawable/knight_shield" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Enemies" android:layout_gravity="center" android:textSize="20sp" android:textStyle="bold" android:paddingTop="10dp" /> <ImageButton android:id="@+id/heart" android:layout_width="90dip" android:layout_height="90dip" android:layout_gravity="center" android:background="@android:color/transparent" android:scaleType="fitCente…
type: Question
accepted answer: http://stackoverflow.com/a/25020308
tagged with: eclipse
answer count: 2
has comment: http://stackoverflow.com/comment/84699092
downvote count: 0
favorite count: 0
tagged with: android-asynctask
possible better answer: http://stackoverflow.com/a/25020368
has answer: http://stackoverflow.com/a/25020368
tagged with: android
has answer: http://stackoverflow.com/a/25020308
tagged with: http://stackoverflow.com/tag/xml

http://stackoverflow.com/q/25057704
has title: how to reload every tab of browser which have open our webpages
has answer: http://stackoverflow.com/a/25057751
type: Question
tagged with: http://stackoverflow.com/tag/html
has body: gmail use some functionality by which they reload all tabs for the login. that means if we open login form of gmail in different different tabs. then login in single tab gmail automatically reload all the pages and redirect to mail page . how it is possible ? is there any particular frame work to implement this?
has comment: http://stackoverflow.com/comment/38978762
answer count: 2
upvote count: 1
tagged with: java
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25058058
downvote count: 0
tagged with: jsp
tagged with: javascript
score: 1
tagged with: jquery
favorite count: 0

http://stackoverflow.com/comment/48751786
type: AnswerComment
has text: Do you know why it doesn't work with **classpath*:com/mypackage/i18n/messages**?
type: Comment
comment on: http://stackoverflow.com/a/24957168
score: 1

http://stackoverflow.com/a/46441851
type: Answer
answers question: http://stackoverflow.com/q/24955537
score: 4
upvote count: 4
downvote count: 0
has body: With Spring 4 upwards and Java 8 upwards you can write: cacheManager.getCacheNames().stream() .map(cacheManager::getCache) .forEach(Cache::clear); This is similar to Przemek Nowaks answer but without the need to use a static List method.

http://stackoverflow.com/comment/39262027
has text: arithmetic shift is very common when used to "spread" the sign bits, you can find lots of examples [here](http://graphics.stanford.edu/~seander/bithacks.html)
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25056669
type: QuestionComment

http://stackoverflow.com/a/68727391
upvote count: 1
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/25062082
has body: I came across exactly the same problem just now and both the dependencies were already included in the pom.xml. For me, it turned out to be Intellij caching issue and invalidating the cache worked for me. Here are the steps: IntelliJ -&gt; File Menu -&gt; Invalidate Caches -&gt; Invalidate and Restart
type: Answer

http://stackoverflow.com/comment/38763556
comment on: http://stackoverflow.com/q/24941686
score: 0
has text: "Linux" is not a standardized system from a single vendor with a common way to provide libraries. You have some transitive X11 dependencies that may or may not be available on an arbitrary Linux system. Apart from "test + document for popular distributions" there are no simple answers.
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/38952551
type: AnswerComment
comment on: http://stackoverflow.com/a/25042791
has text: Yes, I think Java has always had this. `Arrays.copyOf()` can be used to copy a one-dimensional array, but if the elements are references, they will be the same references. I don't see a "deep copy" for multi-dimensional arrays either in the JRE or Apache Commons, but someone says they have one [here](http://stackoverflow.com/questions/1564832/how-do-i-do-a-deep-copy-of-a-2d-array-in-java).
score: 0
type: Comment

http://stackoverflow.com/a/25040885
has comment: http://stackoverflow.com/comment/38948208
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/38947519
answers question: http://stackoverflow.com/q/25039543
type: Answer
score: 2
upvote count: 2
accepted answer of: http://stackoverflow.com/q/25039543
has body: You're missing a closing bracket in your code block. Your first line should be: Document document = Jsoup.parse(new File("C:/Talend/workspace/WEBCRAWLER/output/keywords_" + context.keywordname +".txt"), "utf-8"); As it is, you're building a file from the path "C:/Talend/workspace/WEBCRAWLER/output/keywords_" + context.keywordname +".txt"), "utf-8" and then just pass that file object (it won't be a proper file object but for some reason the compiler hasn't spotted this) to the parse method of Jsoup. Looking at Jsoup's documentation the only method call to parse that is a single value is when you pass a HTML document in a string to it. So it is expecting a string and instead gets a (broken) file. The second error is the one that really points this out by saying you're missing a closing bracket for the VariableInitializer.
has comment: http://stackoverflow.com/comment/38947715

http://stackoverflow.com/comment/38925182
score: 0
type: Comment
has text: Hi,I am new to gradle and declarative services. do you have any sample gradle file generating XML, that would be great..
comment on: http://stackoverflow.com/a/25026220
type: AnswerComment

http://stackoverflow.com/a/26582422
type: Answer
has body: I experienced the same and wait for the answer on this question for a long time. This error occured when I used Eclipse on OS X 10.9. I've upgraded my OS X to 10.10 and the error is gone!
answers question: http://stackoverflow.com/q/25052059
score: 0

http://stackoverflow.com/a/25014861
has body: Future solution seems good to me. I haven't used Futures from Java, but you can just return arbitrary Integer or String if you definitely need some return value. Other option is to send that message to some other actor which would do the saving to the DB. Then you should make sure that the mailbox of that actor would not overfill. Have you considered akka-persistence for this? Maybe that would suit your use-case.
upvote count: 2
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/25014416
type: Answer

http://stackoverflow.com/comment/38779243
comment on: http://stackoverflow.com/a/24949574
score: 0
has text: I added the jta-1.1.jar in build path from the lib/provided folder from hibernate distribution and the issue gets resolved.
type: Comment
type: AnswerComment

http://stackoverflow.com/q/25040073
tagged with: wicket
answer count: 1
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/25080196
has title: Change assets paths depending on environment
has body: I have a java application and I have just implemented grunt to compile my assets into a deploy folder which are all minified so I need to amend the file path so in production/live the assets are being called from the deploy/styles/site_52.css.min and in development environment they are being called from assets/styles/site_52.css, this just makes things easier to debug. In rails I do this - if Rails.env.production? Development Environment Path Ultilities file STYLESHEET("/assets/styles/") BaseWebpage file final String siteCss = "site_" + site.getId() + ".css"; add(CSSPackageResource.getHeaderContribution(StaticContent.STYLESHEET.getDir() + siteCss)); Production/Live Environment Path Ultilities file STYLESHEET("/deploy/styles/") BaseWebpage file final String siteCss = "site_" + site.getId() + ".min.css"; add(CSSPackageResource.getHeaderContribution(StaticContent.STYLESHEET.getDir() + siteCss));
type: UnansweredQuestion
type: Question

http://stackoverflow.com/a/25075596
type: Answer
accepted answer of: http://stackoverflow.com/q/25062239
answers question: http://stackoverflow.com/q/25062239
has body: The problem is solved. I modified postAction method to the following form: public String postAction(WebRequest webRequest) { WebRequestDataBinder binder = new WebRequestDataBinder(service, "service"); binder.bind(webRequest); return "redirect:/my_test_action"; } Now It works fine :)
score: 0
type: AcceptedAnswer

http://stackoverflow.com/comment/38749494
has text: FYI, use Multimap instead of Map<T, List<V>>: http://docs.guava-libraries.googlecode.com/git/javadoc/com/google/common/collect/Multimap.html
comment on: http://stackoverflow.com/a/24935339
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/38823214
comment on: http://stackoverflow.com/q/24954281
score: 0
type: Comment
type: QuestionComment
has text: See also [this answer in the mailing list from yesterday](https://mail-archives.apache.org/mod_mbox/pdfbox-users/201407.mbox/%3C4BC07BF8-7DD9-4888-AA2B-0CF80DC88196%40fileaffairs.de%3E)

http://stackoverflow.com/comment/38727373
type: AnswerComment
has text: yes I am saying that if you modify your Bean class to include this method and call it this way and handle substring portion in java code it would be way easier
comment on: http://stackoverflow.com/a/24923032
type: Comment
score: 0

http://stackoverflow.com/q/25034066
has answer: http://stackoverflow.com/a/47571186
has body: With eclipse i can easily transform the static invocation to import java.util.Arrays; import java.util.List; public class StaticImport { public static void main(String[] args) { List&lt;String&gt; list = Arrays.asList("hello", "world"); System.out.println(list); } } to a static import: import static java.util.Arrays.asList; import java.util.List; public class StaticImport { public static void main(String[] args) { List&lt;String&gt; list = asList("hello", "world"); System.out.println(list); } } I put the cursor on the method name (asList) and press Ctrl-Shift-M (Add Import). Now, for some refactoring reasons, i want to remove the static import and get back to the first code: List&lt;String&gt; list = Arrays.asList("hello", "world"); Is there a shorcut quickly do that ?
possible better answer: http://stackoverflow.com/a/47571186
type: Question
has answer: http://stackoverflow.com/a/25034157
type: AnsweredQuestion
tagged with: java
linked to: http://stackoverflow.com/q/15567332
tagged with: eclipse
tagged with: automated-refactoring
answer count: 2
downvote count: 0
accepted answer: http://stackoverflow.com/a/25034157
score: 6
favorite count: 0
has title: Eclipse remove a static import
upvote count: 6

wikipedia-api
tag name: wikipedia-api
type: Tag
tags question: http://stackoverflow.com/q/24938046

http://stackoverflow.com/a/25042401
type: AcceptedAnswer
type: Answer
has body: Instead of try { input = myInput.nextInt(); } catch (InputMismatchException e) { System.out.println("Please enter a proper value"); } One possible approach is to use a loop and check for the input you expect say an int between 1 and 3, int input = 0; while(input &lt; 1 || input &gt; 3) { if (myInput.hasNextInt()) { input = myInput.nextInt(); } else if (myInput.hasNext()) { System.out.println("Please enter a proper value"); myInput.next(); } else { System.err.println("No more input"); System.exit(1); } } // input is 1,2 or 3. Or the program ended.
score: 2
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25041843
answers question: http://stackoverflow.com/q/25041843
upvote count: 2

http://stackoverflow.com/comment/38844635
comment on: http://stackoverflow.com/q/24986279
score: 0
has text: @SotiriosDelimanolis My IDE is Intellij. But, Intellij is claiming that javac is doing the actual compiling : "Information:Using javac 1.8.0_11 to compile java sources". Nevertheless, I guess I should try compiling manually from the command line.
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/38772366
type: QuestionComment
comment on: http://stackoverflow.com/q/24947477
score: 0
type: Comment
has text: Because I already have a listview on that activity. And I want to show that Data in another activity :D

http://stackoverflow.com/comment/38892714
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25011432
has text: @Lindsey `I want to call a method in Bean on load of this page. `
score: 0

http://stackoverflow.com/a/24992318
has body: When you extend a class, guice will take care of the injection of parent dependencies for you. So you just let Guice create an instance of TrainingCommandData for you and you automatically get the TelemetryServiceClient injected. There are some problems with the above code though: you need to put "@Inject" on your non-default constructor ... and of course guice must be able to create all parameters for you. If you only now these parameters at runtime, have a look at the assisted injection extension Using setter injection is not a good choice in your use case ... why should your commanddata suggest that it is possible to set a new instance of the service at runtime? I would not provide setters but use field injection, or, if you dont like that, constructor injection.
type: Answer
score: 2
accepted answer of: http://stackoverflow.com/q/24975971
answers question: http://stackoverflow.com/q/24975971
type: AcceptedAnswer
downvote count: 0
upvote count: 2

http://stackoverflow.com/a/24924375
upvote count: 2
has comment: http://stackoverflow.com/comment/38728961
has body: Java's regex implementation does not require String objects - you are expected to pass a CharSequence. If you would rather not create a String from a char[] array, you could wrap an array in your own implementation of the CharSequence interface.
answers question: http://stackoverflow.com/q/24924321
type: Answer
score: 2
downvote count: 0

http://stackoverflow.com/comment/38755350
has text: I don't really understand the question. The main class is loaded so that the main method can be run. You can't run a method without loading the class...
score: 0
comment on: http://stackoverflow.com/q/24938837
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/38986070
has text: thanks again Vlad. That worked on SQL Server 2008 R2. I cannot test it on Oracle DB at the moment, but I have to be sure that it will work on it as well. Do you confirm that?
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25052275

http://stackoverflow.com/q/24983281
type: Question
answer count: 2
has body: I am trying to find x^y where x is positive and y is a real number. There are many sources online to find for integers but not much for real numbers. Example: 6 ^ 4.3 = 2218.4537377949778046576946747662 I am not supposed to use any Math library. I know this works: exp(y*log(x)) But I have to find exp too without any library. Is there any series I can use to get the real number power? I am doing it in Java.
has answer: http://stackoverflow.com/a/24984335
favorite count: 0
has title: Find power of real number
has comment: http://stackoverflow.com/comment/38838765
possible better answer: http://stackoverflow.com/a/24983456
has answer: http://stackoverflow.com/a/24983456
accepted answer: http://stackoverflow.com/a/24984335
has comment: http://stackoverflow.com/comment/38839046
upvote count: 2
has comment: http://stackoverflow.com/comment/38839177
downvote count: 1
type: AnsweredQuestion
tagged with: algorithm
score: 1
tagged with: math
tagged with: java
has comment: http://stackoverflow.com/comment/38839068
linked to: http://stackoverflow.com/q/2882706

http://stackoverflow.com/comment/38775644
type: Comment
has text: djechlin: You are guaranteed that Math.pow(3,3) == 27. Just read the API documentation.
comment on: http://stackoverflow.com/a/24945402
type: AnswerComment
score: 0

http://stackoverflow.com/comment/38729290
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24924986
score: 0
has text: And what's the problem?

jogl
tag name: jogl
type: Tag
tags question: http://stackoverflow.com/q/24943065

http://stackoverflow.com/a/24946932
score: 0
has body: Apologies for commenting when I don't know what's going on, but it seems no one else has had a go yet so here's an idea. I found the source to the sanitizer you mentioned, and it's just a regex of a white list of allowed tags. Everything else is rejected, which seems pretty smart frankly. // (tags that can be opened/closed) | (tags that stand alone) var basic_tag_whitelist = /^(&lt;\/?(b|blockquote|code|del|dd|dl|dt|em|h1|h2|h3|i|kbd|li|ol|p|pre|s|sup|sub|strong|strike|ul)&gt;|&lt;(br|hr)\s?\/?&gt;)$/i; // &lt;a href="url..." optional title&gt;|&lt;/a&gt; var a_white = /^(&lt;a\shref="((https?|ftp):\/\/|\/)[-A-Za-z0-9+&amp;@#\/%?=~_|!:,.;\(\)]+"(\stitle="[^"&lt;&gt;]+")?\s?&gt;|&lt;\/a&gt;)$/i; // &lt;img src="url..." optional width optional height optional alt optional title var img_white = /^(&lt;img\ssrc="(https?:\/\/|\/)[-A-Za-z0-9+&amp;@#\/%?=~_|!:,.;\(\)]+"(\swidth="\d{1,3}")?(\sheight="\d{1,3}")?(\salt="[^"&lt;&gt;]*")?(\stitle="[^"&lt;&gt;]*")?\s?\/?&gt;)$/i; I don't think it would be too hard to translate these to Java regex. Here's my go with the first regex string. Pattern white = Pattern.compile( "^(&lt;\\/?(b|blockquote|code|del|dd|dl|dt|em|h1|h2|h3|i|kbd|li|ol|p|pre|s|sup|sub|strong|strike|ul)&gt;|&lt;(br|hr)\\s?\\/?&gt;)$" ); String test = "foo&lt;p&gt;bar"; Matcher matcher = white.matcher(test); for(int i = 0;;) { int start = test.indexOf("&lt;",i); if( start &lt; 0 ) break; int end = test.indexOf( "&gt;", start ); if( end &lt; 0 ) break; matcher.region(start, end+1); System.out.println(test.subSequence(start, end) ); System.out.println( matcher.matches() ); i = end; } This prints "true" when it finds a white listed tag. Otherwise you should mangle the first '&lt;' to be a '&amp; lt ;' (I can't type the HTML literal. I think I found a bug in PageDown :-)) or whatever you prefer. Whether you do this on the in-bound (post) path or on the out-bound (get) path is up to you, but the latter might be more flexible since it gives you the ability to adjust th…
answers question: http://stackoverflow.com/q/24946092
type: Answer
has comment: http://stackoverflow.com/comment/38789036
has comment: http://stackoverflow.com/comment/38788970

input
tags question: http://stackoverflow.com/q/24935235
tags question: http://stackoverflow.com/q/24952298
tags question: http://stackoverflow.com/q/25066905
tags question: http://stackoverflow.com/q/24986843
tags question: http://stackoverflow.com/q/24962150
tags question: http://stackoverflow.com/q/24975560
tags question: http://stackoverflow.com/q/25054482
tags question: http://stackoverflow.com/q/24960455
tag name: input
tags question: http://stackoverflow.com/q/25028846
type: Tag
tags question: http://stackoverflow.com/q/24919508
tags question: http://stackoverflow.com/q/24940873

http://stackoverflow.com/comment/38781660
type: QuestionComment
has text: @OldCurmudgeon ok if I do `this.getClass().getClassLoader().findClass("foo.bar")` I get a linkage error, I then do as you suggested until I have a null parent, so it ended up being something like `this.getClass().getClassLoader().getParent().getParent().getParent().getParent().getParent().getParent().findClass("foo.bar")`. This threw a `ClassNotFoundException`, I removed the `getParent()` one by one, every time it throws a `ClassNotFoundException` until I reach the root `ClassLoader` and receive the `LinkageError` again.
comment on: http://stackoverflow.com/q/24952386
score: 0
type: Comment

http://stackoverflow.com/a/24935911
has body: It is an odd thing to do you by yourself when this matter is very complex, difficult and has very good mature solutions including Apache Shiro and Spring Security. But I assume it's just an exercise in design patterns. I would probably go for the chain of responsibility pattern. Have a generic interface like: interface Authenticator { /** * Analyze the request and return an Authentication object * upon success, or null otherwise */ Authentication authenticate(HttpServletRequest request); } Implement it for each authentication mechanism, checking cookies, POST data or what have you. Then, call them like: public Authentication authenticateRequest(HttpServletRequest request) { for (Authenticator ator : supportedAuthenticators) { Authentication a = ator.authenticate(request); if (a != null) { // Logged in successfully! return a; } } throw new LoginFailed(); }
upvote count: 2
has comment: http://stackoverflow.com/comment/38752968
type: Answer
score: 2
answers question: http://stackoverflow.com/q/24935764
has comment: http://stackoverflow.com/comment/38753033
downvote count: 0

http://stackoverflow.com/comment/38760034
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24941074
has text: Use this: List<TimeTrial> timeTrials = ... Stream<Person> timeTrialsPersonHasRan = timeTrials.stream().filter(t -> t.wasRanBy(personId));

http://stackoverflow.com/comment/127074481
comment on: http://stackoverflow.com/a/25117552
score: 0
type: AnswerComment
has text: Hi Ragesh, Hope this works for me as well but while adding the dependency I am getting error as below "Could not find artifact com.tibco:tibjms:pom:4.4.3 in central (https://repo.maven.apache.org/maven2) "
type: Comment

http://stackoverflow.com/q/24919760
tagged with: phone-number
has comment: http://stackoverflow.com/comment/38720123
has title: How to extract phone number from string?
has comment: http://stackoverflow.com/comment/38720199
answer count: 3
linked to: http://stackoverflow.com/q/2367381
linked to: http://stackoverflow.com/q/123559
has comment: http://stackoverflow.com/comment/38720279
has comment: http://stackoverflow.com/comment/38720187
possible better answer: http://stackoverflow.com/a/24919847
favorite count: 0
tagged with: libphonenumber
has answer: http://stackoverflow.com/a/24919847
has comment: http://stackoverflow.com/comment/38719939
score: -3
upvote count: 1
has comment: http://stackoverflow.com/comment/38720180
has comment: http://stackoverflow.com/comment/38720240
has answer: http://stackoverflow.com/a/24919914
has comment: http://stackoverflow.com/comment/38720092
has comment: http://stackoverflow.com/comment/38719915
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38719919
tagged with: java
duplicate of: http://stackoverflow.com/q/7912779
has body: I have custom string containing text and phone number. How I can extract this number? Example text: Lorem ipsum +44 12-45-243 dolor 00(49) 812 234 234 EDIT: Phone number can be of any given format.
has answer: http://stackoverflow.com/a/24920278
type: Question
has comment: http://stackoverflow.com/comment/38719877
downvote count: 4
has comment: http://stackoverflow.com/comment/38720077
has comment: http://stackoverflow.com/comment/38719964
accepted answer: http://stackoverflow.com/a/24920278

http://stackoverflow.com/q/24948880
has answer: http://stackoverflow.com/a/24949004
favorite count: 0
accepted answer: http://stackoverflow.com/a/24949004
has title: Ending an activity on a background thread
tagged with: multithreading
tagged with: android
type: AnsweredQuestion
tagged with: java
tagged with: thread-safety
has body: I gather that it is bad practice to call finish() on an activity from a thread that is not the UI thread. I need to end an activity when a certain event (calculated in a rendering/loop thread) takes place. According to an answer on a similar question, using a Handler to post a request to finish the activity on the UI thread would be appropriate. I attempted to do this but the activity never ended - is there something I must do before posting it, or is there an entirely different method I should be using?
type: Question
score: -2
has comment: http://stackoverflow.com/comment/38774764
downvote count: 3
upvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/38775034
tagged with: android-activity

http://stackoverflow.com/comment/38825290
has text: [HyperSonic SQL](http://hsqldb.org/) and [H2](http://www.h2database.com/html/main.html) are both pure Java Database which can operate in single user/standalone/embedded modes
score: 1
comment on: http://stackoverflow.com/q/24976115
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25063068
has title: StringBuffer indexOf a parenthesis then insert returns an infinite loop
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38989179
accepted answer: http://stackoverflow.com/a/25063753
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/25063183
has answer: http://stackoverflow.com/a/25063183
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/25063753
has body: public static String spaceParen( String text){ if( ( text.length() == 0 ) || (text == null ) ) { return ""; } StringBuffer spacedString = new StringBuffer( text ); int index1 = 0; // finds the index of ( , then inserts a space after and before it // Ex: (test -&gt; ( test or ( test -&gt; ( test index1 = spacedString.indexOf("("); while(index1 &gt; -1){ System.out.println("index1 of ( = " + index1); spacedString.insert(index1," ( "); index1 = spacedString.indexOf("(", index1+2); } // finds the index of ), then inserts a space after and before it // Ex: test) -&gt; test ) or test )-&gt; test ) index1 = spacedString.indexOf(")"); while(index1 &gt; -1){ System.out.println("index1 of ) = " + index1); spacedString.insert(index1, " ) "); index1 = spacedString.indexOf(")", index1+2); } return spacedString.toString(); } This is the Output I'm getting: index1 of ( = 69 index1 of ( = 72 index1 of ( = 75 index1 of ( = 78 index1 of ( = 81 index1 of ( = 84 index1 of ( = 87 index1 of ( = 90 index1 of ( = 93 index1 of ( = 96 index1 of ( = 99 index1 of ( = 102 index1 of ( = 105 index1 of ( = 108 index1 of ( = 111 index1 of ( = 114 index1 of ( = 117 index1 of ( = 120 index1 of ( = 123 index1 of ( = 126 index1 of ( = 129 index1 of ( = 132 index1 of ( = 135 index1 of ( = 138 index1 of ( = 141 index1 of ( = 144 index1 of ( = 147 index1 of ( = 150 The list goes on and on, in a loop. I tried it with double slash \( and \) and it just ignores the parenthesis. I used StringBuffer before but this never happened. I don't know why is it happening and how to fix it.

http://stackoverflow.com/a/24955452
has comment: http://stackoverflow.com/comment/38788951
has comment: http://stackoverflow.com/comment/38787723
score: 0
has comment: http://stackoverflow.com/comment/38789003
has comment: http://stackoverflow.com/comment/38788266
has body: It appears you need to perform an operation running as Administrator. You can do this from Java using a command line Process process = Runtime.getRuntime().exec( "runas /user:" + localmachinename + "\administrator del " + filetodelete); You need to read the output to see if it fails. For me see http://technet.microsoft.com/en-us/library/cc771525.aspx
has comment: http://stackoverflow.com/comment/38786403
type: Answer
has comment: http://stackoverflow.com/comment/38786193
answers question: http://stackoverflow.com/q/24955368
has comment: http://stackoverflow.com/comment/38786601
has comment: http://stackoverflow.com/comment/38786225

http://stackoverflow.com/a/32069640
score: 0
answers question: http://stackoverflow.com/q/24976866
type: Answer
has body: Click the leap icon on the taskbar and click resume. Also check the preferences' tracking options as Andrea suggested.. If these are not solving your problem and the 3 red lights on the top are not visible but the green light on the side is visible on your leap motion then try unplug and plug your cable from both your leap motion and computer. If still not working try restarting computer. If also the green light is not visible then there might be something wrong with your hardware (usb port or the cable or the leap itself). If all of the lights are visible but still not working (you cannot see your hands on the visualizer or the cam views) there may be something wrong with the computer's data receiving speed. For example some similar sensors are not working with the virtual box because of the mass amount of the data they are sending. Since if you are not using virtual os, honestly I don't know how to solve the problem. Try changing computer =)

http://stackoverflow.com/q/24924463
has comment: http://stackoverflow.com/comment/38753190
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38730760
tagged with: android
has title: Re-sizing Google Maps and using address entered from EditText on Android?
linked to: http://stackoverflow.com/q/9550008
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/38772526
type: Question
tagged with: google-maps
score: 0
has body: So, as part of my app that I am making, I have an EditText field on my screen in which the user will input an address, but what I would like for my app to do is have a smaller size Google Map which will be on the same screen as my EditText which recieves the address, and also displays the current location of the entered address. How would I go about doing that? Any help is appreciated.

http://stackoverflow.com/a/24951501
upvote count: 1
has comment: http://stackoverflow.com/comment/38780188
score: 1
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24950315
has body: First of all in the adapter, in the getView() method, you're not recycling the items. Have a look on the ViewHolder pattern (http://www.javacodegeeks.com/2013/09/android-viewholder-pattern-example.html). Then, getImageBitmap() seems to be executed on the same thread, I wonder why it doesn't crash. I guess there you download the actual image. It should be done asynchronously, and you should send a reference of the ImageView and when the download is finished you should load it into it. Of course you'll have to care about if when you put the bitmap inside the ImageView you have the good ImageView on the screen (because it might have been recycled). To get rid of all these concerns you could just use Picasso library (http://square.github.io/picasso/) and that will do all this for you.
answers question: http://stackoverflow.com/q/24950315
type: Answer

http://stackoverflow.com/comment/39049805
comment on: http://stackoverflow.com/a/24998792
score: 0
type: Comment
type: AnswerComment
has text: Are you behind a firewall or proxy?

http://stackoverflow.com/comment/38872285
comment on: http://stackoverflow.com/q/24999791
score: 1
has text: Download and unzip the projects to a desired location. Then open up Eclipse and go to `File > New > Project > Java Project From Existing Ant Buildfile`. This will allow you to import the project into Eclipse, view its source code, search, refactor and what not. I haven't hooked it up to the run configurations as a couple of settings seem pretty messed-up (paths to specific catalogues, tomcat dirs, the classpath) and I'm not really keen on configuring any of those.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38820406
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24973394
score: 1
has text: What defines a duplicate? '2' or `int[]{2,2}`?

http://stackoverflow.com/q/25026181
answer count: 1
has answer: http://stackoverflow.com/a/25026192
accepted answer: http://stackoverflow.com/a/25026192
score: 0
has comment: http://stackoverflow.com/comment/38920216
has body: im not sure what I'm doing here, but I'm trying to work with the LinkedList collection in java to create a deck of playing cards. there seems to be an error in my logic. i keep getting a NullPointerException in the deck constructor. I am trying to rework code that used an array to use a LikedList instead. What am i missing? public class Deck { /** * A LinkedList of cards in the deck, where the top card is the * first index. */ private LinkedList&lt;Card&gt; mCards; /** * Number of cards currently in the deck */ private int numCards; /**No args Constructor- if no arguments are used when creating a deck, * then we define the game deck to be one deck without shuffling. * */ public Deck(){ this(1, false); } /**Constructor that defines the number of decks (how many sets of 52 * cards are in the deck) and whether it should be shuffled. * * @param numDecks the number of individual decks in this game deck * @param isShuffled whether to shuffle the cards */ public Deck(int numDecks, boolean isShuffled){ this.numCards = numDecks * 52; //for each deck for (int i = 0; i &lt; numDecks; i++){ //for each suit for(int j = 0; j &lt; 4; j++){ //for each number for(int k = 1; k &lt;= 13; k++){ //add card to the deck this.mCards.add(new Card(Suit.values()[j], k)); } } } if(isShuffled){ this.shuffle(); } public enum Suit { Clubs, Diamonds, Spades, Hearts, }
has title: Creating a deck of playing cards using a LinkedList in java
tagged with: linked-list
tagged with: collections
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38920116
tagged with: java
has comment: http://stackoverflow.com/comment/38920828
type: Question

http://stackoverflow.com/comment/38722920
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24920916
has text: I mean edit your post not include another comment..radix is another word for "base". If all you want to convert an integer in base 10 to base 16, you have working code, as evident by my comments: 255 (in base 10) = ff (in base 16)
score: 0

http://stackoverflow.com/q/25058224
accepted answer: http://stackoverflow.com/a/25063600
type: Question
downvote count: 0
has body: Ok. I think this is impossible. If you think the same, you do not need to post an answer. I have read a few lines of Chapter 5. Conversions and Promotions and it seems chapter 5 has no mention of disabling Conversions and Promotions in Java. Here is my motivation: long uADD(long a, long b) { try { long c; c = 0; boolean carry; //carry flag; true: need to carry; false: no need to carry carry = false; for (int i = 0; i &lt; 64; ++i) { //i loops from 0 to 63, if (((((a &gt;&gt;&gt; i) &amp; 1) ^ ((b &gt;&gt;&gt; i)) &amp; 1) != 0) ^ carry) { //calculate the ith digit of the sum c += (1 &lt;&lt; i); } if (((((a &gt;&gt;&gt; i) &amp; 1) &amp; ((b &gt;&gt;&gt; i) &amp; 1)) != 0) || (carry &amp;&amp; ((((a &gt;&gt;&gt; i) &amp; 1) ^ ((b &gt;&gt;&gt; i) &amp; 1)) != 0))) { carry = true; //calculate the carry flag which will be used for calculation of the (i+1)th digit } else { carry = false; } } if (carry) { //check if there is a last carry flag throw new ArithmeticException(); //throw arithmetic exception if true } return c; } catch (ArithmeticException arithmExcep) { throw new ArithmeticException("Unsigned Long integer Overflow during Addition"); } } So basically, I am writing a method that will do unsigned addition for long integer. It will throw arithmetic exception if overflow. The code above is not readable enough, so I should try to explain it. First, there is a for loop where i loops from 0 to 63. Then, the first if statement acts as the sum output of the full adder, it uses the ith digit of a and that of b and carry flag to calculate the i + 1th digit (true or false). (Note that i = 0 corresponds to the units digit.) If true, it adds 1 &lt;&lt; i to c, where c is initially 0. After that, the second if statement acts as the carry flag output of the full adder, it uses again the ith digit of a and that of b and carry flag to calculate the carry flag of the i + 1th digit. If true, set the new carry flag to true, if false, set the new carry flag false. Finally, after e…
has comment: http://stackoverflow.com/comment/38980125
has title: How to disable Conversions and Promotions in Java?
answer count: 1
has comment: http://stackoverflow.com/comment/38980290
has answer: http://stackoverflow.com/a/25063600
favorite count: 0
tagged with: promotions
has comment: http://stackoverflow.com/comment/38979898
upvote count: 2
tagged with: addition
type: AnsweredQuestion
score: 2
tagged with: unsigned
has comment: http://stackoverflow.com/comment/38980253
tagged with: java

http://stackoverflow.com/q/24925175
tagged with: java
has comment: http://stackoverflow.com/comment/38741351
tagged with: gradle
type: Question
has body: There are some externally sourced Java classes that happen to be defined all in the default unnamed package, i.e. there are no package ... statement at the top of the .java source files where these Java classes are defined. I use these as dependencies in my Java project. The few Java classes I write for my project are also placed in the default unnamed package. I use IntelliJ IDEA 13.1 to work on this project and set the .jar file containing the external Java classes as a library and project dependency. However, I don't know how to configure Gradle so it properly handles the dependency. Currently, I just "manually" added a configuration for the project as a regular Java Application. Clicking on 'Run' using the configuration compiles and runs the project OK.
has comment: http://stackoverflow.com/comment/38757055
has comment: http://stackoverflow.com/comment/38757003
tagged with: intellij-idea
tagged with: configuration
has title: How to configure Gradle to use Java classes defined in the default unnamed package?
has comment: http://stackoverflow.com/comment/80062708
downvote count: 0
has comment: http://stackoverflow.com/comment/38733193
favorite count: 0
linked to: http://stackoverflow.com/q/2193226
type: UnansweredQuestion
tagged with: dependencies
has comment: http://stackoverflow.com/comment/38729586
has comment: http://stackoverflow.com/comment/38731362
score: 2
answer count: 0
upvote count: 2

http://stackoverflow.com/comment/38874711
comment on: http://stackoverflow.com/a/25002350
score: 1
type: AnswerComment
has text: Thanks! But the problem is this: "Cannot make a static reference to the non-static method runOnUiThread(Runnable) from the type Activity". And the method has to be static to be accessed from another class right (I access it from my SurfaceView class)?
type: Comment

http://stackoverflow.com/q/24958686
has answer: http://stackoverflow.com/a/24959453
has comment: http://stackoverflow.com/comment/38792483
has comment: http://stackoverflow.com/comment/38792421
answer count: 4
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/24958924
linked to: http://stackoverflow.com/q/1495856
tagged with: java
has answer: http://stackoverflow.com/a/24958924
has body: I need a function which can calculate the mathematical combination of (n, k) for a card game. My current attempt is to use a function based on usual Factorial method : static long Factorial(long n) { return n &lt; 2 ? 1 : n * Factorial(n - 1); } static long Combinatory(long n , long k ) { return Factorial(n) / (Factorial(k) * Factorial(n - k)); } It's working very well but the matter is when I use some range of number (n value max is 52 and k value max is 4), it keeps me returning a wrong value. E.g : long comb = Combinatory(52, 2) ; // return 1 which should be actually 1326 I know that it's because I overflow the long when I make Factorial(52) but the range result I need is not as big as it seems. Is there any way to get over this issue ?
type: Question
has answer: http://stackoverflow.com/a/24958710
has comment: http://stackoverflow.com/comment/38792410
tagged with: c#
score: 5
tagged with: math
upvote count: 5
accepted answer: http://stackoverflow.com/a/24958710
has comment: http://stackoverflow.com/comment/38798905
has title: Combinatory issue due to Factorial overflow
has answer: http://stackoverflow.com/a/24960869
downvote count: 0
favorite count: 0

http://stackoverflow.com/a/24923140
answers question: http://stackoverflow.com/q/24922997
score: 1
has body: your code seems to work :-) I took your class and did the following: class Test { public static void main(String[] args) { Quadratic q = new Quadratic(1.0, 2.0, -35.0); q.roots(); } } The output was: 1.0x^2 + 2.0x + -35.0 = 0 Solutions: (5.0,-7.0) And this is correct!
downvote count: 0
type: Answer
upvote count: 1

http://stackoverflow.com/comment/38949506
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25042012
has text: Works perfectly, thank you. If I could up vote, I would. I'll vote as best as soon as the delay is up :)
score: 0

http://stackoverflow.com/comment/38885392
type: AnswerComment
type: Comment
has text: There is no reliable way to cut off `2008-FLM` either.
comment on: http://stackoverflow.com/a/25008051
score: 0

http://stackoverflow.com/comment/38726395
comment on: http://stackoverflow.com/q/24923129
score: 0
type: Comment
type: QuestionComment
has text: These things happen, you just need to beware as it can send people of on the wrong tangent ;)

http://stackoverflow.com/a/25048931
has body: The question is vague and is missing context, so it makes it difficult to answer and encourages assumptions, never a good place to start from... However, if you are doing something similar to... try { FileReader fr = new FileReader(new File("...")); // Read file... fr.close(); } catch (IOException exp) { exp.printStackTrace(); } Then if an exception occurs for some reason (or the code returns before it reaches the close statement), then close will never be called... Prior to Java 7, one would typically do something like... FileReader fr = nulll; try { fr = new FileReader(new File("...")); // Read file... } catch (IOException exp) { exp.printStackTrace(); } finally { try { // Avoid NullPointerException's if (fr != null) { fr.close(); } } catch (Exception exp) { } } This ensures that regardless of what happens between the try-catch, finally will always be called and you can take steps to ensure that the resource is closed. With Java 7, you can now take advantage of the "try-with-resources" feature... try (FileReader fr = new FileReader(new File("..."))) { fr = ; // Read file... } catch (IOException exp) { exp.printStackTrace(); } Which is basically a short-cutted version of the try-catch-finally example block. If you are using the FileLock functionality, then you also need to ensure that you releasing the FileLock when you are done with, in a similar fashion to the try-catch-finally example above, but file locking will only ensure that different processes can't read/write the simultaneously, it doesn't protect you against multiple threaded access...
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/25048691
score: 3
answers question: http://stackoverflow.com/q/25048691
upvote count: 3

http://stackoverflow.com/comment/38831958
comment on: http://stackoverflow.com/q/24979623
type: QuestionComment
type: Comment
has text: Use `javac *.java` for compiling all files inside one folder !
score: 0

http://stackoverflow.com/q/24937213
type: AnsweredQuestion
score: 3
tagged with: netbeans-plugins
tagged with: java
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/38752462
downvote count: 0
tagged with: inno-setup
has answer: http://stackoverflow.com/a/25306349
possible better answer: http://stackoverflow.com/a/62365235
favorite count: 0
has answer: http://stackoverflow.com/a/62365235
has title: Adding additional files to an Inno based setup for a Netbeans application
has comment: http://stackoverflow.com/comment/38752973
has body: I am using Inno 5 Setup Installer in Netbeans to build my Java Swing application into an executable set up file. It creates an app.exe setup file with all the lib(all jar file) and app.jar. So once user executes app.exe file, it create a folder at C:\users\username\local\appname which has the app.jar file and the libraries. Is it possible to add additional text files in app.exe setup? so these text files will also be avaliable in "appname" folder when executed. These are required for the app to run. Thanks for your time :)
upvote count: 3
accepted answer: http://stackoverflow.com/a/25306349
tagged with: swing
has comment: http://stackoverflow.com/comment/38753331

http://stackoverflow.com/comment/38800633
type: QuestionComment
comment on: http://stackoverflow.com/q/24947710
score: 0
has text: I'm the author of the ant2ivy script. Was there a problem using it? If you're already using ANT and have an Archiva repository then using ivy to manage your dependencies is the best way to go.
type: Comment

http://stackoverflow.com/q/24997851
tagged with: sql
has answer: http://stackoverflow.com/a/24999692
tagged with: jpa
downvote count: 0
possible better answer: http://stackoverflow.com/a/24998879
favorite count: 0
has answer: http://stackoverflow.com/a/24998879
accepted answer: http://stackoverflow.com/a/24999692
type: AnsweredQuestion
has title: doubts many to many relationships in hibernate JPA
linked to: http://stackoverflow.com/q/11746499
upvote count: 1
type: Question
linked to: http://stackoverflow.com/q/2990799
has body: I have a couple of weeks starting with hibernate. I have this code database | TABLE A | ------------------------------- idA integer not null (PK) | name varchar(45) not null | lastname varchar(45) not null | | TABLE B | ------------------------------- idB integer not null (PK) | name varchar(45) not null | lastname varchar(45) not null | | TABLE A_B | ------------------------------- idA integer not null (PK) | idB integer not null (PK) | and these are my entities in java @Entity public class A{ @Id private int id; @Column private String name; @Column private String lastName; @ManyToMany(cascade={CascadeType.ALL}) @JoinTable(name="A_B", joinColumns={@JoinColumn(name="idA")}, inverseJoinColumns={@JoinColumn(name="idB")}) private List&lt;B&gt; ManyB; //Getter and Setters } @Entity public class B{ @Id private int id; @Column private String name; @Column private String lastName; @ManyToMany(mappedBy="ManyB", cascade={CascadeType.ALL}) private List&lt;A&gt; ManyA; //Getter and Setters } I have 2 objects with many to many relationship and I have created the database in an intermediate table to make it in one to many relationship. I have several questions about this. 1 -. To add a record in the A_B table only lets me when I add objects B in the list declared in class A, if I do it the other way around, from class A by adding objects B I add in table A but not the A_B table. . 2 - How do I delete or modify a record in the table A_B without having to delete or modify objects in Table A or B. . 3 - When you get a list of all objects, for example I get the class A, I Returns a list and it contains A, and make an infinite recursively toString, this affects performance in memory or program? Thanks attentive to your comments.
score: 1
tagged with: java
tagged with: hibernate
answer count: 2

http://stackoverflow.com/comment/38849965
comment on: http://stackoverflow.com/q/24988096
score: 0
type: Comment
type: QuestionComment
has text: It makes perfect sense that this is the problem, so thank you for pointing it out. I cannot think of any other reason as to why this is happening. I can't just call toArray() on each set of coordinates however because they aren't lists, but arrays already. At least I think this is why. I have another idea though.

http://stackoverflow.com/a/25007209
has body: One of the arguments you're passing to the constructor of the super class, that is an ArrayAdapter, does not match with any of the ArrayAdapter's constructors. I believe that argument is the the PackageManager appsList, you should instead pass a List&lt;T&gt; appsList to match the constructor defined here.
score: 0
has comment: http://stackoverflow.com/comment/38885258
type: Answer
answers question: http://stackoverflow.com/q/25007126

http://stackoverflow.com/comment/38936565
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25035161
has text: 1. '}' brace before onActivityCreated(Bundle) method generates compile time error. || 2. foodslist as instance variable is perfectly alright. || 3. GetContacts class should be within SecondFragment class as inner class.
score: 0

http://stackoverflow.com/q/24920497
upvote count: 2
type: UnansweredQuestion
has title: Dynamically create methods in java
downvote count: 1
has comment: http://stackoverflow.com/comment/38721370
score: 1
linked to: http://stackoverflow.com/q/8937424
tagged with: java
type: Question
answer count: 1
has body: I have a csv file in this form : DogType, DogName, DogColor GermanShephred, Jim, brown in the main class I created a dog object (from the dog class) such that dog.setDogType = GermanShephred; dog.SetDogName = Jim; dog.SetDogColor = brown; and then put it into a hashtable : hashtable.put(dog,GermanShephred); I need to generalise the code, which means that it is the user who decides the number of categories (DogType, DogName, DogColor, DogAge, DogSex) and the methods SetDogName, etc. should not be hardcoded in the dog class anymore because we don't know in advance how many categories there will be. I don't know how to do that. Should I dynamically create methods in the dog class ? Thank you for your help!
has answer: http://stackoverflow.com/a/24920576
duplicate of: http://stackoverflow.com/q/8937424
has comment: http://stackoverflow.com/comment/38721534
favorite count: 0
has comment: http://stackoverflow.com/comment/38721342

http://stackoverflow.com/a/25053646
upvote count: 11
has comment: http://stackoverflow.com/comment/88165747
has comment: http://stackoverflow.com/comment/99674803
has comment: http://stackoverflow.com/comment/69899363
downvote count: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/99501331
has comment: http://stackoverflow.com/comment/99657217
accepted answer of: http://stackoverflow.com/q/25053439
type: Answer
answers question: http://stackoverflow.com/q/25053439
score: 11
has body: Here you want to change data of customAdapter make a public method in adapter public void updateData(ArrayList&lt;T&gt; list){ mAdapterProductList=list; } and now whenever u want to update data use these codes: adpter.updateData(mUpdatedList); adapter.notifyDataSetChanges(); No need to re-instantiate your adapter

http://stackoverflow.com/a/25067026
has comment: http://stackoverflow.com/comment/38997404
answers question: http://stackoverflow.com/q/25065906
has body: You have not told us what database you are using and is the only SQL TABLE names that needs to be changed to different name. If you only need to change table names, you can create a VIEW in mysql/oracle/sqlserver/postgresql/db2 that will be like an alias for the old table name. For example mysql: CREATE VIEW table_name_in_java_class_file AS SELECT * FROM your_updated_table_name Since you decompiled class, you can see what table names it references and create a view named like that to point to your new table. But columns need to be the same, in your new table, unless you know for that that class doesn't care about the column types/order/etc. Most likely you will be better off with hiring someone part time to do this for you if you not familiar with Java or programming in general. sql
score: 0
type: Answer

http://stackoverflow.com/comment/38819854
type: Comment
comment on: http://stackoverflow.com/a/24973093
has text: Thanks! This allows me to add all of the images in 7 for loops which is a lot easier!
score: 0
type: AnswerComment

http://stackoverflow.com/comment/38920588
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25026313
has text: Never mind. Someone answered what I was looking for. Thanks everyone.

http://stackoverflow.com/comment/38867819
has text: Thanks. How to set the `adam` background yellow that I am looking ?
comment on: http://stackoverflow.com/a/24998677
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/24915142
answer count: 1
tagged with: junit
score: 0
has body: I'm running into this ClassNotFoundException issue when running Junit task below, but this is non eclipse based project running an ant build from command prompt, the build file is pasted below. The exception is below. I have done similar to that of setup here it does not work though, any pointers will be appreciated. Thanks. Class org.apache.tools.ant.util.StringUtils loaded from parent loader (parentFirst) [junit] Testsuite: SampleTest Class org.apache.tools.ant.util.FileUtils loaded from parent loader (parentFirst) [junit] Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0 sec [junit] [junit] Caused an ERROR [junit] SampleTest [junit] java.lang.ClassNotFoundException: SampleTest [junit] at java.lang.ClassLoader.loadClass(ClassLoader.java:235) [junit] at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) [junit] at java.lang.Class.forName0(Native Method) [junit] at java.lang.Class.forName(Class.java:219) [junit] Build.xml <property name="project.local.directory" value="." /> <property name="src.path" value="${project.local.directory}/SampleUnitTest/com" /> <property name="lib.path" value="${project.local.directory}/APP-INF/lib" /> <property name="dest.path" value="${project.local.directory}/SampleUnitTest/target" /> <property name="junit.output.dir" value="${project.local.directory}/junit" /> <pathelement location="${lib.path}/ant-junit.jar" /> <pathelement location="${lib.path}/junit.jar" /> <pathelement location="${lib.path}/SampleUnitTest.jar" /> <include name="target" /> <pathelement location="${lib.path}/ant-junit.jar" /> <pathelement location="${lib.path}/junit.jar" /> <include name="**/*.jar" /> <mkdir dir="${junit.output.dir}" /> <formatter type="plain" usefile="false" /> <include name="**/*Test*.java" /> <mkdir dir="${dest.path}" /> <jar destfile="${lib.path}/SampleUnitTest.jar" basedir="${dest.path}"/> Update package com; import com.tds.metasolv.common.util.CommonUtilities; import com.tds.metasolv.common.util.specific.PortAddressUtilities; i…
has answer: http://stackoverflow.com/a/24915662
accepted answer: http://stackoverflow.com/a/24915662
type: AnsweredQuestion
tagged with: ant
has title: ClassNotFoundException when running ant junit
tagged with: java
linked to: http://stackoverflow.com/q/24830303
type: Question

http://stackoverflow.com/q/24977586
downvote count: 0
tagged with: mybatis
favorite count: 0
has body: mybatis mapper code for insert: insert into shop(email, pswd, nickname, mobile, city, create_date, status) values (#{email}, #{pswd}, #{nickname}, #{mobile}, #{city}, #{createDate}, #{status}) select currval('shop_id_seq') The database is postgresql 9.3. My doubt is: without explicity transaction, when I retrieve the id from sequence with select currval('shop_id_seq'), is it possible to get the wrong value if other threads are also doing insert? I thought it won't, because currval() function runs in context of current session, not global session, but I am not that sure.
type: Question
accepted answer: http://stackoverflow.com/a/24977728
tagged with: sql
score: 1
upvote count: 1
answer count: 1
has title: mybatis - insert transaction
tagged with: java
has answer: http://stackoverflow.com/a/24977728
type: AnsweredQuestion

http://stackoverflow.com/comment/38850288
comment on: http://stackoverflow.com/q/24988885
has text: Stupid question, but I'm having trouble finding it. What's the quickest way to format currency to display two decimal points and a $ before the number?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24923776
has comment: http://stackoverflow.com/comment/38727257
has comment: http://stackoverflow.com/comment/38727440
has comment: http://stackoverflow.com/comment/38727306
downvote count: 0
has comment: http://stackoverflow.com/comment/38727246
type: Answer
upvote count: 1
has body: In Java, you can choose the wrapper type Integer or the primitive type int You cannot use Int (unless you've written one). Finally, you should probably rename print() into an override of toString(). @Override public String toString() { return level; // &lt;-- or String.valueOf(level); // when it's an int. } And then public static void main(String[] args) { Player p = new Player("5"); // p.print(); System.out.println(p); }
score: 1
accepted answer of: http://stackoverflow.com/q/24923757
answers question: http://stackoverflow.com/q/24923757
type: AcceptedAnswer

http://stackoverflow.com/comment/38804708
comment on: http://stackoverflow.com/q/24964675
type: Comment
type: QuestionComment
has text: @Frithjof I'm not clear on what your needs are, but it appears that you're trying to define new classes dynamically, at run time, and I don't think you can do that. I'm not sure what you're trying to "register" and what you're planning to do with the things you're registering. But I do think your design is unworkable; however, without more information about what you're trying to accomplish I can't give you any ideas about how to make it work.
score: 2

http://stackoverflow.com/a/24948576
type: Answer
upvote count: 1
score: 1
has body: The basic principle is relatively easy. In order to add something to something else, you first need to have access (or a reference to) the thing you want to add to. While there are a number of ways you might achieve this, the simplest might be to use an instance/class field. This field would then be accessible from anywhere within the class, for example import java.awt.EventQueue; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; import javax.swing.JFrame; import static javax.swing.JFrame.EXIT_ON_CLOSE; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException; public class ClickTest { public static void main(String[] args) { new ClickTest(); } private JPanel panel; public ClickTest() { EventQueue.invokeLater(new Runnable() { @Override public void run() { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) { } //Declaring the buttons, panels, etc... JButton button = new JButton("Click"); panel = new JPanel(); panel.add(button); final JFrame frame = new JFrame("Button Pressed"); frame.setSize(400, 200); frame.setVisible(true); frame.setDefaultCloseOperation(EXIT_ON_CLOSE); frame.add(panel); button.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { panel.add(new JLabel("You clicked me")); panel.revalidate(); } }); } }); } } Take a look at Creating a GUI With JFC/Swing and Understanding Class Members for more details
downvote count: 0
answers question: http://stackoverflow.com/q/24948544

http://stackoverflow.com/q/25019050
has title: JLabel that changes text from one thing to another
score: 1
favorite count: 0
tagged with: jlabel
type: Question
tagged with: jframe
answer count: 2
upvote count: 1
tagged with: swing
has answer: http://stackoverflow.com/a/25021049
has comment: http://stackoverflow.com/comment/38910590
tagged with: java
has comment: http://stackoverflow.com/comment/38906512
has body: I'm working on this program and I ran into another issue. I have a Jframe with a JLabel that I wish for it to change text from one thing to another. However, when I try to do that it doesnt show me the text changing, rather the last text I set it to. How do I get my JLabel to cycle through text SLOWLY? I'm trying a wait method to make the program go slowly so I can see if I can make it cycle through, but that doesnt seem to be working. it would be helpful if someone could edit my code or make their own example of how to do this, THANKS! public class CreditGraphics { public String cardNum; public JFrame frame; public JPanel panel; public JLabel label; public JTextField text; public CreditGraphics() { synchronized(this){ try { frame = new JFrame("HI"); panel = new JPanel(); label = new JLabel(); text = new JTextField(16); panel.add(label); panel.add(text); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); panel.setPreferredSize(new Dimension(500, 500)); frame.getContentPane().add(panel); frame.pack(); frame.setVisible(true); wait(4000); label.setText("Hi"); wait(4000); frame.revalidate(); frame.repaint(); label.setText("Hello"); frame.revalidate(); frame.repaint(); text.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { cardNum = text.getText(); } }); } catch(InterruptedException e) { e.printStackTrace(); }} } public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { public void run() { new CreditGraphics(); } }); } public void checkCard(){ } }
possible better answer: http://stackoverflow.com/a/25019174
accepted answer: http://stackoverflow.com/a/25021049
downvote count: 0
has answer: http://stackoverflow.com/a/25019174
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/24340271

http://stackoverflow.com/q/25037914
tagged with: android
has comment: http://stackoverflow.com/comment/38941936
favorite count: 0
has comment: http://stackoverflow.com/comment/38941595
has answer: http://stackoverflow.com/a/25049997
has comment: http://stackoverflow.com/comment/38941617
tagged with: put
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/38944300
has comment: http://stackoverflow.com/comment/38941368
has comment: http://stackoverflow.com/comment/38941450
type: Question
accepted answer: http://stackoverflow.com/a/25049997
answer count: 2
has comment: http://stackoverflow.com/comment/38941433
has body: I have tried sending message to server with PUT method but it doesn't work. Server replies : The server encountered an error processing the request. See server logs... String result = null; InputStream inputStream = null; try { HttpClient httpclient = new DefaultHttpClient(); HttpPut httpPut = new HttpPut(url); httpPut.setHeader("Content-type", "application/json"); Log.v("Execute: ", httpPut.getRequestLine().toString()); HttpResponse httpResponse = httpclient.execute(httpPut); inputStream = httpResponse.getEntity().getContent(); if (inputStream != null) { result = convertInputStreamToString(inputStream); Log.v("POST CM: ", "result\n" + result); } } catch (Exception e) { e.printStackTrace(); } return result;
downvote count: 0
possible better answer: http://stackoverflow.com/a/25048279
has title: PUT Method to server java
has answer: http://stackoverflow.com/a/25048279

http://stackoverflow.com/a/35289113
score: 1
answers question: http://stackoverflow.com/q/25063880
has body: Jackson has com.fasterxml.jackson.jaxrs.yaml.JacksonJaxbYAMLProvider
upvote count: 1
type: Answer
downvote count: 0

http://stackoverflow.com/q/25066022
upvote count: 1
linked to: http://stackoverflow.com/q/24791298
has answer: http://stackoverflow.com/a/25073910
type: Question
tagged with: jasper-reports
score: -1
has comment: http://stackoverflow.com/comment/39008212
answer count: 2
has title: How can I create a report (jasperreport) from a List<MyObject>?
favorite count: 0
linked to: http://stackoverflow.com/q/12209300
type: UnansweredQuestion
duplicate of: http://stackoverflow.com/q/12209300
has answer: http://stackoverflow.com/a/25066842
has body: I have already created the report (report1.jrxml) copiled it (report1.jasper) and I just want to fill it with the info of this list: List&lt;MyObject&gt; public class MyObject { private String name; private int phone; //getters &amp; setters... } The data of the list has been retrieved from a database so I want to use the info of the list to fill the report. I want to create a pdf. Please help me.
tagged with: java
downvote count: 2

http://stackoverflow.com/q/25016026
has comment: http://stackoverflow.com/comment/38900538
has answer: http://stackoverflow.com/a/25016492
has comment: http://stackoverflow.com/comment/38900674
favorite count: 0
has body: In my application I'm implementing several service methods returning data related to a week period. So I have several methods similar to getDataByDateInterval(Date from, Date to) but I actually need to always retrieve data for a week: from Monday to Sunday (or from Sunday to Saturday, if you prefer). In this case, is it more correct to have a method with a single Date argument and then calculate week date span? I'd like to find an elegant and correct way to implement these methods.
has answer: http://stackoverflow.com/a/25016155
type: AnsweredQuestion
score: 3
upvote count: 3
tagged with: java
has title: Implement a method returning "week-data"
type: Question
downvote count: 0
accepted answer: http://stackoverflow.com/a/25016155
has answer: http://stackoverflow.com/a/25016331
answer count: 3
possible better answer: http://stackoverflow.com/a/25016492

http://stackoverflow.com/q/25037239
tagged with: instagram
linked to: http://stackoverflow.com/q/2659000
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38940083
tagged with: oauth
downvote count: 0
has comment: http://stackoverflow.com/comment/38940381
type: Question
accepted answer: http://stackoverflow.com/a/25037637
score: 1
tagged with: java
has body: I am making desktop app in java for instagram right now and i don't know how to get code from callback url. My app is desktop so my REDIRECT-URI is http://instagram.com. So in my app i send a request to https://api.instagram.com/oauth/authorize/?client_id=CLIENT-ID&amp;redirect_uri=REDIRECT-URI&amp;response_type=code and get redirected to instagram.com?code=CODE. And also forgot to mention, I get a code once by my hands a i gave all permissions. So now then i make request i redirected straightly to URL with code. How do i get code from callback uri in program in java? This is my code: static void GetCode() { try { String url = "https://api.instagram.com/oauth/authorize/?client_id=" + ClientId + "&amp;redirect_uri=" + BackUri + "&amp;response_type=code&amp;scope=likes+comments+relationships"; HttpClient client = new DefaultHttpClient(); HttpGet request = new HttpGet(url); HttpResponse response = client.execute(request); BufferedReader rd = new BufferedReader( new InputStreamReader(response.getEntity().getContent())); StringBuffer result = new StringBuffer(); String line = ""; while ((line = rd.readLine()) != null) { result.append(line); } System.out.println(result.toString()); } catch(Exception e) { System.out.print("GET CODE ERROR-&gt;"+e.toString()); } }
has answer: http://stackoverflow.com/a/25037637
upvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/73865974
has title: How do i get Instagram Code for Oauth authorisation?
favorite count: 0

http://stackoverflow.com/comment/38772829
type: AnswerComment
has text: On ListUser, would be great if you can upvote the answer also ;) @GrStorm
type: Comment
score: 0
comment on: http://stackoverflow.com/a/24945868

http://stackoverflow.com/comment/38997691
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25067188
score: 2
has text: Lets say you have a bunch of producer threads pushing work items into a (synchronized) queue and you have one consumer thread popping items out of the queue to service them. When the queue is empty your consumer thread should not be polling the queue for work items. Instead, signal the consumer in some way when a new item is added.

hudson
type: Tag
tag name: hudson
tags question: http://stackoverflow.com/q/24984144

http://stackoverflow.com/q/25059411
has body: I've found many solutions on web about, but none is suitable for my problem. I have in a JFrame a KeyBoard that, on click, writes in a JTextField which is in another JFrame. The keyboard appears thanks to an OnClickEvent in a JText, something like iphone keyboard. How can I link the buttons to the JTextField in the other frame?
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25062665
upvote count: 2
tagged with: jframe
has comment: http://stackoverflow.com/comment/38986748
tagged with: swing
tagged with: jtextfield
type: Question
tagged with: java
has title: How to program java virtual keyboard for touchscreen?
has comment: http://stackoverflow.com/comment/38982702
score: 2
has answer: http://stackoverflow.com/a/25062665
answer count: 1
downvote count: 0
tagged with: keyboard
favorite count: 0

variables
tag name: variables
tags question: http://stackoverflow.com/q/24933421
tags question: http://stackoverflow.com/q/24956883
tags question: http://stackoverflow.com/q/24951934
type: Tag
tags question: http://stackoverflow.com/q/24930168
tags question: http://stackoverflow.com/q/25058763
tags question: http://stackoverflow.com/q/24911493
tags question: http://stackoverflow.com/q/25008538
tags question: http://stackoverflow.com/q/25015832

http://stackoverflow.com/comment/38843058
has text: Well, that's one top-level doc. You want the docs for `java.lang.String`, and then find the `matches` method...
comment on: http://stackoverflow.com/q/24985385
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38823042
type: QuestionComment
score: 2
has text: Please read about microbenchmarks. Your code does not have any side effects, so the hot spot compiler may kick in any time and decide that there is nothing to compute amyway. My far fetched guess about the many threads would be compiler threads. To make sure the compiler does not optimize everything away, just total the output of your methods and finally print it.
comment on: http://stackoverflow.com/q/24974482
type: Comment

http://stackoverflow.com/q/24988852
tagged with: java
has answer: http://stackoverflow.com/a/34434336
tagged with: collision-detection
type: Question
has comment: http://stackoverflow.com/comment/38849742
answer count: 2
has title: RayCasting in Libgdx 3d
upvote count: 6
has body: Alright so I've been trying for quite some time too Raycast in libgdx for 3d collision detection based on where im looking.. But I've drawn a blank and doesn't seem to be any documentation anywhere. Would someone be kind enough to send me in the right direction?
has comment: http://stackoverflow.com/comment/38849707
favorite count: 0
type: UnansweredQuestion
tagged with: raycasting
score: 6
has answer: http://stackoverflow.com/a/24989069
downvote count: 0
tagged with: libgdx
linked to: http://stackoverflow.com/q/27790457

http://stackoverflow.com/comment/38778296
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24946740
has text: @xedocx please post a complete answer to your question instead of editing it. I believe the question should remain in its previous version and the edit should come as an answer with a bit more detail for instance what is a sherwood binary search and why is it better(i.e. the explanation of `and see why he may have wanted it.`)

http://stackoverflow.com/q/24949505
answer count: 4
type: AnsweredQuestion
tagged with: java
tagged with: fileoutputstream
upvote count: 18
type: Question
has body: Consider the following code: public static void dumpObjectToYaml(String key, Object O, String path) throws IOException { Map&lt;String, Object&gt; data = new HashMap&lt;&gt;(); data.put(key, O); File F = new File(path); F.mkdirs(); F.createNewFile(); //write data to File } This method is aiming to write the given Object O at the given key, into the YAML file at the given path. (if it doesn't exist it is created.) But obviously the main part is still missing. Now following the documentation of SnakeYaml, to create a YAML I only need to create a map and put in the Objects at the right keys, which I did. But nowhere (at least I don't see it) is described how to create a yaml file at a certain path! The only thing I found was: "The Yaml.dump(Object data) method accepts a Java object and produces a YAML document" public void testDump() { Map&lt;String, Object&gt; data = new HashMap&lt;String, Object&gt;(); data.put("name", "Silenthand Olleander"); data.put("race", "Human"); data.put("traits", new String[] { "ONE_HAND", "ONE_EYE" }); Yaml yaml = new Yaml(); String output = yaml.dump(data); System.out.println(output); } and "Yaml.dump(Object data, Writer output) will write the produced YAML document into the specified file/stream." public void testDumpWriter() { Map&lt;String, Object&gt; data = new HashMap&lt;String, Object&gt;(); data.put("name", "Silenthand Olleander"); data.put("race", "Human"); data.put("traits", new String[] { "ONE_HAND", "ONE_EYE" }); Yaml yaml = new Yaml(); StringWriter writer = new StringWriter(); yaml.dump(data, writer); System.out.println(writer.toString()); } But still, even though it says exactly that at the second bit of code, it doesn't seem to support the manipulation of a certain file and it's certainly not shown how to do it. Is it only me or does the documentation feel very cryptic and specified? Half of it is about special applications that I have never even heard about. I feel really dumb just by looking at it and it makes me kind of an…
has answer: http://stackoverflow.com/a/57901606
accepted answer: http://stackoverflow.com/a/24950664
downvote count: 0
has answer: http://stackoverflow.com/a/62305688
favorite count: 0
has title: How do I write to a YAML file using SnakeYaml?
possible better answer: http://stackoverflow.com/a/62305688
has answer: http://stackoverflow.com/a/76636115
tagged with: snakeyaml
tagged with: file
has answer: http://stackoverflow.com/a/24950664
tagged with: output
score: 18

http://stackoverflow.com/q/25020970
linked to: http://stackoverflow.com/q/6735649
has comment: http://stackoverflow.com/comment/38910301
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38910251
has body: When I use android:logo and display the view's boundaries I see that it has some additional padding on the left. How can I remove this? I was also to remove margin from android:icon since it can be fetched using android.R.id.home. Is there such an identifier or other programatically way to fetch the logo view element?
tagged with: android-actionbar
has comment: http://stackoverflow.com/comment/38910037
tagged with: java
has comment: http://stackoverflow.com/comment/38910138
type: Question
has title: Remove padding from android:logo
tagged with: padding
linked to: http://stackoverflow.com/q/16026007
has comment: http://stackoverflow.com/comment/38910523
score: 0
tagged with: android
tagged with: http://stackoverflow.com/tag/xml

http://stackoverflow.com/comment/38755497
comment on: http://stackoverflow.com/a/24937694
has text: I've just excluded that test sources from the project but lets face it thats not the way to do it. In fact Intellij were compiling sources, when i restart it with cache invalidated it shows no error then after it compiles sources (makes project) it shows those errors...
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/24984335
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24983281
answers question: http://stackoverflow.com/q/24983281
type: Answer
has body: For a good compromise between efficiency and ease of implementation, you can develop your own pow function exp(y.ln(x)) using Taylor expansions. The "hardest" part is the logarithm. First normalize x by finding the power of 2 such that x=(2^n).x', with 1&lt;=x'&lt;2. Then ln(x) = n.ln(2) + ln(x'). 6 = (2^2) x 1.5 Evaluate ln(x') = 2 argth((x'-1) / (x'+1)) by the inverse hyperbolic tangent series. ln(1.5) = 2 (0.2 + 0.2^3/3 + 0.2^5/5...) = 0.4 0.405333333333 0.405461333333 0.405464990476 0.405465104254 0.405465107978 0.405465108104 0.405465108108 ... ln(6) = 2 x 0.69314718056 + 0.405465108108 = 1.791759469228 Then compute y.ln(x), split into integer part (use exponentiation by squaring) and fractional part. 4.3 x 1.791759469228 = 7.704565717681 e^7 = 1096.633158428 For the fractional part, use the standard Taylor development of the exponential. e^0.704565717681 = 1 + 0.704565717681 + 0.704565717681^2/2 + 0.704565717681^3/6... 1 1.70456571768 1.95277214295 2.01106472233 2.02133246059 2.02277931986 2.0229492211 2.02296632204 2.02296782814 2.02296794604 2.02296795435 2.02296795488 2.02296795491 ... And multiply 6^4.3 = 1096.633158428 x 2.02296795491 = 2218.45373779
downvote count: 0
score: 1
upvote count: 1

http://stackoverflow.com/comment/38870774
score: 0
type: Comment
type: QuestionComment
has text: This is such a common swing problem that it seems like it should be a duplicate of some question, but my search-fu cannot find it.
comment on: http://stackoverflow.com/q/25000035

http://stackoverflow.com/a/56772210
type: Answer
has comment: http://stackoverflow.com/comment/135304338
downvote count: 0
score: 1
has body: In my main I include: and as Fragment i use: Main Cat This works absolutly fine for me.
answers question: http://stackoverflow.com/q/25032838
upvote count: 1

http://stackoverflow.com/comment/38816749
type: QuestionComment
has text: event log?? Ok I guess I dont fully understand you. What I understand is that you are running httpd or tomcat server and you have deployed some application which works fine with IP but not with its domainname. But when you remove the application from your site, your site works fine with IP as well as domain name.
comment on: http://stackoverflow.com/q/24970707
score: 0
type: Comment

http://stackoverflow.com/q/24945907
type: AnsweredQuestion
tagged with: java
tagged with: slick2d
linked to: http://stackoverflow.com/q/17384291
accepted answer: http://stackoverflow.com/a/24945968
type: Question
has body: The F250.java class is a gun object, and there are two methods that draw and update the bullets coming out of the gun. I made a Bullet class and made a bullet array in the F250.java class, but the for loops in the Draw and Update method wont execute the code in the for loops to make the bullets come out. I believe it has something to do with the Bullet class, especially with the this.bulletImage variable in the constructor of the Bullet class. In Slick2d the images have to be initialized and i cant get the image I put as a parameter when I make the bullet object in F250.java class to get initialized in Bullet.java class because its not static or soemthing idk. Maybe im wrong and thats not the problem, but if it is, I dont know how to fix that. Main thing is the two for loops wont execute in the F250.java class and thank you for reading all this and thank you to whomever answeres this question I really appreciate taking your time out for me and going through the struggle to solve this tedious problem for me thank you. package Guns.Human; import java.util.ArrayList; import java.util.Timer; import java.util.TimerTask; import org.lwjgl.input.Mouse; import org.newdawn.slick.Animation; import org.newdawn.slick.Color; import org.newdawn.slick.GameContainer; import org.newdawn.slick.Graphics; import org.newdawn.slick.Image; import org.newdawn.slick.Input; import org.newdawn.slick.SlickException; import org.newdawn.slick.state.BasicGameState; import org.newdawn.slick.state.StateBasedGame; import Bullet.Bullet; import GUI.Clicker; import MOB.Player; public class F250 { static Clicker clicker = new Clicker(); //Gun Preferences static String gun = "F250"; //Images static Image F250; static Image fmjBullet; //Image Coordinates static int F250_X = Player.getX() + 0; static int F250_Y = Player.getY() + 20; static int bulletX = F250_X + 32; static int bulletY = F250_Y; //Animations static Animation charIdleGun; static Animation shootingGun; //Animation Rates private static int[] id…
tagged with: for-loop
upvote count: 0
score: -2
has comment: http://stackoverflow.com/comment/38769334
tagged with: arrays
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/24945968
has comment: http://stackoverflow.com/comment/38769159
has title: there are two loops in the F250.java Class that wont run
tagged with: constructor
downvote count: 2
has comment: http://stackoverflow.com/comment/38769807

http://stackoverflow.com/a/24938840
downvote count: 0
answers question: http://stackoverflow.com/q/24938794
has comment: http://stackoverflow.com/comment/38755407
upvote count: 3
type: Answer
has body: You get an error here because f and b belong to different types (foo and bar respectively) and you can't assign b to f. foo f; foo b; f = b = null; should work
score: 3
has comment: http://stackoverflow.com/comment/38755397

http://stackoverflow.com/a/25025546
has comment: http://stackoverflow.com/comment/38918983
accepted answer of: http://stackoverflow.com/q/25025347
answers question: http://stackoverflow.com/q/25025347
score: 2
has body: How about this? ("00000" + numberAsString).substring(numberAsString.length()) This will only work if you have 5 or less digit numbers. Ideone link to check code Reference To be honest, I also think 4 times how this code works, but after understanding I posted as this is something out of the box.
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/38919038
upvote count: 2
type: Answer

spring-ioc
tag name: spring-ioc
tags question: http://stackoverflow.com/q/25044012
type: Tag

rest
tags question: http://stackoverflow.com/q/25039915
tags question: http://stackoverflow.com/q/24993357
tags question: http://stackoverflow.com/q/24968448
tags question: http://stackoverflow.com/q/24924942
tags question: http://stackoverflow.com/q/25018706
tags question: http://stackoverflow.com/q/25054935
tags question: http://stackoverflow.com/q/24932080
tags question: http://stackoverflow.com/q/24911293
tags question: http://stackoverflow.com/q/24982720
tags question: http://stackoverflow.com/q/25011204
tags question: http://stackoverflow.com/q/24946911
tags question: http://stackoverflow.com/q/24950276
tags question: http://stackoverflow.com/q/24961909
tags question: http://stackoverflow.com/q/25012617
tags question: http://stackoverflow.com/q/24984257
tags question: http://stackoverflow.com/q/24963647
tags question: http://stackoverflow.com/q/25066282
tags question: http://stackoverflow.com/q/24968641
tags question: http://stackoverflow.com/q/24950411
tags question: http://stackoverflow.com/q/24948659
tags question: http://stackoverflow.com/q/25037473
tags question: http://stackoverflow.com/q/25062726
tags question: http://stackoverflow.com/q/25019385
tags question: http://stackoverflow.com/q/24931583
tags question: http://stackoverflow.com/q/24986500
tags question: http://stackoverflow.com/q/24968548
tags question: http://stackoverflow.com/q/24917712
tags question: http://stackoverflow.com/q/25050918
tags question: http://stackoverflow.com/q/24969577
type: Tag
tags question: http://stackoverflow.com/q/24967452
tags question: http://stackoverflow.com/q/25003287
tags question: http://stackoverflow.com/q/24956627
tags question: http://stackoverflow.com/q/24927864
tags question: http://stackoverflow.com/q/24928767
tag name: rest
tags question: http://stackoverflow.com/q/24923418
tags question: http://stackoverflow.com/q/25041894
tags question: http://stackoverflow.com/q/25058112
tags question: http://stackoverflow.com/q/24913510
tags question: http://stackoverflow.com/q/25003557
tags question: http://stackoverflow.com/q/25057736
tags question: http://stackoverflow.com/q/25024335

http://stackoverflow.com/q/24985093
answer count: 1
has body: i want to abstract a translator service for the user. I think to do in 2 ways: Or interface with this method: public void translate(T origin, T1 source); Or an abstract class with the same method, both with generic classes for use with classes that i need. Witch its better, interface or abstract class? How can i do this in android with generic classes?Because compiler says me Cannot resolve symbol T I hope i explain me correctly.
tagged with: generics
tagged with: android
type: AnsweredQuestion
has title: Abstract class or interface for translator objects on Android
type: Question
tagged with: java
score: 0
has answer: http://stackoverflow.com/a/24985154
has comment: http://stackoverflow.com/comment/38842436
accepted answer: http://stackoverflow.com/a/24985154

http://stackoverflow.com/comment/38843651
type: AnswerComment
comment on: http://stackoverflow.com/a/24967345
has text: @user3772253 see the new edit, it'll display all the "stages" in the calculation
type: Comment
score: 0

http://stackoverflow.com/q/24995235
has comment: http://stackoverflow.com/comment/38861122
linked to: http://stackoverflow.com/q/1197634
has answer: http://stackoverflow.com/a/24995335
favorite count: 0
tagged with: constructor
type: Question
has answer: http://stackoverflow.com/a/24995318
possible better answer: http://stackoverflow.com/a/24995335
tagged with: object
has comment: http://stackoverflow.com/comment/38861372
tagged with: oop
accepted answer: http://stackoverflow.com/a/24995318
upvote count: 3
tagged with: java
answer count: 3
downvote count: 0
has answer: http://stackoverflow.com/a/25215705
has comment: http://stackoverflow.com/comment/38861178
type: AnsweredQuestion
score: 3
has title: Implicit super constructor Num() is undefined for default constructor. Must define an explicit constructor, what is the logic behind this
has comment: http://stackoverflow.com/comment/38861344
has body: class Num { Num(double x) { System.out.println( x ) ; } } class Number extends Num { public static void main(String[] args) { Num num = new Num(2) ; } } In the above program, its show the error. Please help me out.
has comment: http://stackoverflow.com/comment/38861590

http://stackoverflow.com/a/24928841
accepted answer of: http://stackoverflow.com/q/24928447
answers question: http://stackoverflow.com/q/24928447
upvote count: 1
type: AcceptedAnswer
has body: I see some problems with code : 1) new SimpleDateFormat should throw illegal argument becouse of "YYYY" should be"yyyy" (at least for me this works 2) In DateDifference (should be name dateDifference since its a method, not class - naming convenction) You got d1 = format.parse(firstDate); d1 = format.parse(nowDate); Instead of d1 = simpleFormat.parse(firstDate); d2 = simpleFormat.parse(nowDate); Try using this code, it works for me. public class TimeDiffereneceTest { static String secondDate,firstDate, dateDifference; static SimpleDateFormat simpleFormat = new SimpleDateFormat("yyyy/MM/dd"); public static void main(String[] args) { firstDate = "2014/07/20"; secondDate = getTodayDate(); // Generate 2014/07/23 DateDifference(firstDate, secondDate); } public static String getTodayDate() { Calendar todayDate = Calendar.getInstance(); String strDate = simpleFormat.format(todayDate.getTime()); return strDate; } public static void DateDifference(String firstDate,String nowDate) { Date d1=null; Date d2=null; try{ d1 = simpleFormat.parse(firstDate); d2 = simpleFormat.parse(nowDate); DateTime dt1 = new DateTime(d1); DateTime dt2 = new DateTime(d2); System.out.println("Day difference is: "+Days.daysBetween(dt1, dt2).getDays()); // 206! } catch(Exception e){ e.printStackTrace(); } } }
type: Answer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/38737090

http://stackoverflow.com/a/25067136
answers question: http://stackoverflow.com/q/25066983
score: 0
type: Answer
has body: yes try to run the sync set before the regular and you will get your "needed" results. I reckon this has to do with the JVM warm up and nothing else. Try to warn up the VM with some computations and then run the benchmark or run it a few times in a mixed order.

http://stackoverflow.com/comment/38903625
type: Comment
comment on: http://stackoverflow.com/q/25016172
type: QuestionComment
has text: I went ahead and changed a couple things which did indeed cut down the code. I wrote added the desired noise to the data, added it to the list and wrote the whole list object. I then read that list and save it, iterate through each element and de-obscure it. I posted the results in the end
score: 0

http://stackoverflow.com/q/24981061
tagged with: bufferedreader
has body: I have to input 5 int arrays, in less than 3 sec, means execution time should be less than 3,and i was using Scanner class or that,but it is making the execution time more,so is there any other possible way,i have to get input as 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 And have to input 1 2 3 in one line ?how would i do it..? i was taking initially string as input ,and then using split(" ") method for separating it,then parsing it using wrapper classes? any other way to do it?
has answer: http://stackoverflow.com/a/24981309
favorite count: 0
tagged with: java.util.scanner
has title: How to input integer 2d array fast
type: UnansweredQuestion
downvote count: 1
type: Question
tagged with: java
score: -1
has comment: http://stackoverflow.com/comment/38834878
upvote count: 0
answer count: 1

http://stackoverflow.com/comment/38920430
has text: You mean the folder with Android manifest, drawable, layout, strings.xml, etc...? I don't have errors in there.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25024659

http://stackoverflow.com/a/25047916
answers question: http://stackoverflow.com/q/25047454
score: 0
type: Answer
has body: Each time when you call 'add' method on myArray, elements of 'a' are not copied. myArray will hold a refernece to 'a' only. Since the reference is always the same, the latest state of 'a' element will be printed. Try to print the content of myArray right after myArray.add(a) to see what I mean. You do need to create a new instance of ArrayList to avoid this problem

http://stackoverflow.com/q/24936169
tagged with: regex
possible better answer: http://stackoverflow.com/a/24936510
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/38750860
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24936260
accepted answer: http://stackoverflow.com/a/24936260
tagged with: java
has comment: http://stackoverflow.com/comment/38752495
type: Question
has answer: http://stackoverflow.com/a/24937648
answer count: 3
has comment: http://stackoverflow.com/comment/38751603
has answer: http://stackoverflow.com/a/24936510
has title: Repeating a Capturing Group vs. Capturing a Repeated Group
downvote count: 0
favorite count: 0
has body: I need to capture a repeated pattern inside a line. For instance : toto#titi# or toto#titi#tutu or toto#titi#tutu#tata# etc... and this is my regex : (?:[\w]*#){1,} And I need to capture toto, titi, tutu... But even if Matcher.matches() returns true, the only group I have is the last captured pattern : toto#titi#-> 1 group titi, toto#titi#tutu -> 1 group tutu, toto#titi#tutu#tata -> 1 group tata. Could you tell me why and how to solve it? Many thanks Adrien
has comment: http://stackoverflow.com/comment/38750426
has comment: http://stackoverflow.com/comment/38751786
has comment: http://stackoverflow.com/comment/38750312

http://stackoverflow.com/q/24959747
has title: Cut string in android
has answer: http://stackoverflow.com/a/24959832
score: 0
has answer: http://stackoverflow.com/a/24959788
has answer: http://stackoverflow.com/a/24960482
possible better answer: http://stackoverflow.com/a/24959816
favorite count: 0
upvote count: 5
has answer: http://stackoverflow.com/a/24959860
downvote count: 5
answer count: 5
has body: Hi guys i have a string: String a = "234 - 456"; I want cut this string and assign the first number in int firstnumber and second number a int secondnumber. is possible? P.S 123 and 456 are dinamyc number! The numbers are separated with a " - " Thank you
tagged with: android
has comment: http://stackoverflow.com/comment/38797401
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/24959816
type: Question
accepted answer: http://stackoverflow.com/a/24959788

http://stackoverflow.com/q/24941787
type: Question
tagged with: android-layout
has title: Refresh or redraw Fragment's View
has body: I've searched around but have been unable to find a solution to this problem. I have a Fragment that is being shown and when you press a button it opens a new Activity on top of that. Then when that Activity is finished it returns some intent data back to the Fragment/Parent Activity. That data will sometimes change a TextView or add a button to the Fragment. However, I haven't been able to get the Fragment's view to update without re-adding the Fragment to the backstack (popBackStack then replace or add). A couple things I've tried is to call invalidate() and requestLayout() on the Fragment's base layout but the only way to refresh the view seems to have it call the onCreateView() again by removing and re-adding it. Is there a way to specify the Fragment's "content view" without reloading it? Parent Activity code: // Used to retrieve the data from the first Activity @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { if (resultCode == Activity.RESULT_OK) { // Try to update the Fragment's view here mMyFragment.refreshView(data.getString(NEW_BUTTON_TEXT)); } } Fragment code (MyFragment): private View mBaseLayout; public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { mBaseLayout = inflater.inflate(R.layout.my_layout, container, false); ... return mBaseLayout; } public void refreshView(String newButtonText) { Button button = mBaseLayout.findViewById(R.id.new_button); button.setText(newButtonText); button.setVisibility(View.VISIBLE); // TODO Reset the Fragment's view with the update mBaseLayout view // ? ? ? // Tried mBaseLayout.invalidate() and mBaseLayout.requestLayout() here } Any thoughts on this would be really helpful, thanks!
has answer: http://stackoverflow.com/a/24944546
answer count: 2
accepted answer: http://stackoverflow.com/a/24944546
downvote count: 0
favorite count: 0
tagged with: android
type: AnsweredQuestion
tagged with: android-fragments
score: 1
tagged with: java
possible better answer: http://stackoverflow.com/a/24942381
linked to: http://stackoverflow.com/q/17207562
upvote count: 1
has answer: http://stackoverflow.com/a/24942381

http://stackoverflow.com/comment/69082302
comment on: http://stackoverflow.com/a/25123823
has text: where is the marshalrequest source ?
type: AnswerComment
score: 4
type: Comment

http://stackoverflow.com/a/24923032
has comment: http://stackoverflow.com/comment/38726487
has comment: http://stackoverflow.com/comment/38727373
upvote count: 1
has comment: http://stackoverflow.com/comment/38728388
has body: create a method inside your domain class Person{ public String getPrettyName(){ //operate and return } } and on JSTL &lt;c:out value="${requestScope.teacher.prettyName}"/&gt; or ${requestScope.teacher.lastName}, ${fn:substring(requestScope.teacher.firstName, 0, 1)}
has comment: http://stackoverflow.com/comment/38730723
score: 1
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/38730778
has comment: http://stackoverflow.com/comment/38730693
accepted answer of: http://stackoverflow.com/q/24922979
type: Answer
answers question: http://stackoverflow.com/q/24922979

http://stackoverflow.com/comment/38793301
has text: why are you using bind tag instead of just setting `items="${list}"`?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24954345

http://stackoverflow.com/a/24948109
type: Answer
answers question: http://stackoverflow.com/q/24948099
score: 2
upvote count: 2
has body: You would have to use an index: for (int i=1 ; i&lt;arr.length ; i++) { ... } Using the enhanced for loop (for (int i : arr) {...}) goes through the whole array.
downvote count: 0

http://stackoverflow.com/q/24951934
has comment: http://stackoverflow.com/comment/38780163
has answer: http://stackoverflow.com/a/24951976
tagged with: eclipse
has comment: http://stackoverflow.com/comment/38780442
score: 0
has title: Undefined variable not shown as error with Java Eclipse
answer count: 3
possible better answer: http://stackoverflow.com/a/24951976
tagged with: variables
has answer: http://stackoverflow.com/a/24952148
has comment: http://stackoverflow.com/comment/38780129
has answer: http://stackoverflow.com/a/24951985
accepted answer: http://stackoverflow.com/a/24951985
has comment: http://stackoverflow.com/comment/38780109
has comment: http://stackoverflow.com/comment/38780091
has body: Entering and compiling the Java class below did not mark any errors in the code using Eclipse public class Test { public static void main(String args[]) { xCase = yCase + 100; } } The identifiers xCase and yCase not defined this couldn't be right, so running the command-line compiler to check it gave me 2 errors C:\Test&gt;javac Test.java Test.java:5: error: cannot find symbol xCase = yCase + 100; ^ symbol: variable xCase location: class Test Test.java:5: error: cannot find symbol xCase = yCase + 100; ^ symbol: variable yCase location: class Test 2 errors Why isn't Eclipse showing me these errors?
type: AnsweredQuestion
tagged with: declaration
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/38780713

http://stackoverflow.com/a/25041227
has comment: http://stackoverflow.com/comment/38948660
answers question: http://stackoverflow.com/q/25040609
has comment: http://stackoverflow.com/comment/38948515
downvote count: 0
has comment: http://stackoverflow.com/comment/38948235
has comment: http://stackoverflow.com/comment/38948049
type: Answer
has body: This is the complete algorithm. Pattern ddpat = Pattern.compile( "\\d{1,2}/\\d{1,2}/\\d{4}" ); DateFormat dddf = new SimpleDateFormat("dd/MM/yyyy"); DateFormat wwdf = new SimpleDateFormat("EEEE, MMMM d yyyy"); String s = "I was born on 18/11/1965. and completed my grad on 9/10/1978 and so on"; StringBuilder sb = new StringBuilder(); Matcher ddmat = ddpat.matcher( s ); int offset = 0; while( ddmat.find( offset ) ){ int beg = ddmat.start(); int end = ddmat.end(); String dd = s.substring( beg, end ); String ww = wwdf.format( dddf.parse( dd ) ); sb.append( s.substring( offset, beg ) ).append( ww ); offset = end; } sb.append( s.substring( offset ) ); System.out.println( sb.toString() ); To handle 99/99/9999 and similar, handle ParseException after dddf.parse( dd ) and replace with whatever you seem fit. Strings not matching the regex are hopeless, unless you can think of a regex matching "false dates". ;-) Later If you want to fish for several formats: Pattern ddpat = Pattern.compile( "(\\d{1,2}/\\d{1,2}/\\d{4})|(\\d{4}-\\d{2}-\\d{2})" ); DateFormat[] dddf = new DateFormat[]{ new SimpleDateFormat("dd/MM/yyyy"), new SimpleDateFormat("yyyy-MM-dd") }; DateFormat wwdf = new SimpleDateFormat("EEEE, MMMM d yyyy"); String s = "I was born on 18/11/1965. and completed my grad on 1978-10-09 and so on"; StringBuilder sb = new StringBuilder(); Matcher ddmat = ddpat.matcher( s ); int offset = 0; while( ddmat.find( offset ) ){ for( int ig = 1; ig &lt;= ddmat.groupCount(); ig++ ){ if( ddmat.group(ig) != null ){ int beg = ddmat.start(ig); int end = ddmat.end(ig); String dd = s.substring( beg, end ); String ww = wwdf.format( dddf[ig-1].parse( dd ) ); sb.append( s.substring( offset, beg ) ).append( ww ); offset = end; break; } } } sb.append( s.substring( offset ) ); System.out.println( sb.toString() );
has comment: http://stackoverflow.com/comment/38948094
upvote count: 2
has comment: http://stackoverflow.com/comment/38948336
has comment: http://stackoverflow.com/comment/38948605
score: 2

http://stackoverflow.com/comment/38703073
type: Comment
comment on: http://stackoverflow.com/a/24910804
has text: thumbs up. i forgot about the intern method. thank you for the down votes.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/38971997
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25053879
has text: Well honestly, I do come back to the activities. Like for example If I have activities A,B,C I open A, Open B close A, Open C close B, open B close C, open A close B. So that is what I was asking if it is bad practice. and I was looking into that, but I read sprite sheets are bad to use for android games? but if it worked for you, I'll try it out, do you happen have any links you could direct me to? thank you for the answer by the way!

http://stackoverflow.com/comment/38762397
type: QuestionComment
type: Comment
has text: Install libXp with `yum install libXp.so.6`
comment on: http://stackoverflow.com/q/24941686
score: 0

http://stackoverflow.com/comment/38789205
type: QuestionComment
has text: An Object is an instance of a Class. You can think of the object as the thing and "instance" as the relationship.
comment on: http://stackoverflow.com/q/24957033
score: 0
type: Comment

http://stackoverflow.com/comment/38982626
comment on: http://stackoverflow.com/q/25059310
has text: Also are you sure you need a `RandomAccessFile`?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38731761
type: Comment
comment on: http://stackoverflow.com/q/24925764
type: QuestionComment
score: 0
has text: Are you positive you're running 32bit? Normally 32bit Java on 64bit Windows goes under `\Program Files (x86)` and 64bit Java goes under `\Program Files` (like other Windows apps). If you type only `java` make sure the directory you want is the first one (or only one) in your PATH; alternatively use the full name in your run command and PATH doesn't matter. (Netbeans is configured which JRE(s) to use and doesn't depend on PATH; you apparently have Netbeans right.)

http://stackoverflow.com/q/24921227
has answer: http://stackoverflow.com/a/24921393
has answer: http://stackoverflow.com/a/24924566
favorite count: 0
answer count: 5
has answer: http://stackoverflow.com/a/24926467
type: UnansweredQuestion
tagged with: design-patterns
tagged with: memento
upvote count: 3
tagged with: java
type: Question
has body: I want to save and load objects to a database without using a ORM (like Hibernate). Lets say i have the following class: public class Person { private int age; public void birthday(){ age++; } } This class doesn't provide a get-method, so the internal state (age) is encapsulated. If i want to save the object i need a getter method to do the following: insert into TABLE_PERSON (id, age) vales (1, person.getAge()); The otherway round i need a setter-method to load the object: int age = "Select age FROM Person"; person.setAge(age); But i dont want to break the encapsulation (by implementating additional setter- and getter-methods) just to save and load objects. Is there any possibility to do this? Maybe some kind of pattern (memento?) or best practise? Thank you in advance!
downvote count: 0
tagged with: database
tagged with: encapsulation
has title: Save and load objects without breaking encapsulation
has answer: http://stackoverflow.com/a/24921841
has answer: http://stackoverflow.com/a/28488269
score: 3

http://stackoverflow.com/comment/38731698
has text: The console section will show you everything that takes place while your log is running, when it crashes you will see a lot of red text, signifying what has gone wrong. Try to read through that and solve the problem, remember to look for the phrase "Caused By" and the IDE will tell you what line the error took place on I cannot look at your code again right now but will come back to it when i can
comment on: http://stackoverflow.com/a/24925443
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/24919725
accepted answer: http://stackoverflow.com/a/30197382
tagged with: bufferedreader
has answer: http://stackoverflow.com/a/30197382
answer count: 1
downvote count: 0
tagged with: client
favorite count: 0
has body: I'm a long way into writing a card game that allows people to play online against each other. During testing I've noticed that clients are very occasionally getting a null response to their messages and I don't know why. Client code: InetAddress address = InetAddress.getByName(SERVER_IP); Socket socket = new Socket(address, SERVER_PORT_NUMBER); socket.setSoTimeout(20000); PrintWriter out = new PrintWriter(socket.getOutputStream(), true); out.write(messageString + "\n"); out.flush(); BufferedReader in = new BufferedReader(new InputStreamReader(socket.getInputStream())); responseString = in.readLine(); //new handling I've added since getting NullPointers later on if (responseString == null) { retryOrStackTrace(new Throwable("NULL responseString")); } Server code: BufferedReader in = new BufferedReader(new InputStreamReader(clientSocket.getInputStream())); message = in.readLine(); String response = getResponseForMessage(message); //Sometimes getting a null response client-side if (response == null) { Debug.stackTraceServerWithReason("About to send NULL response for message " + message); } BufferedOutputStream os = new BufferedOutputStream(clientSocket.getOutputStream()); OutputStreamWriter osw = new OutputStreamWriter(os, "US-ASCII"); osw.write(response + "\n"); osw.flush(); osw.close(); The server-side stack trace hasn't come out since I added it so it definitely isn't a problem with the server building a response. Due to how intermittent this is I want to put it down to connectivity, but I've had it when running the server on the same box and pointing the client at localhost so I'm not sure. I'd also expect any connection issues to be covered by ConnectException/SocketException/SocketTimeoutException, all of which the client already catches before using retryOrStackTrace() to resend the message a certain number of times before giving up. I can leave things as they are and let the null responses be handled in the same way but it feels lazy. I just don't know where to …
has title: Java - client receiving a null response from in.readLine()
upvote count: 1
has comment: http://stackoverflow.com/comment/38722207
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38757801
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/38724732
type: Question
tagged with: null

http://stackoverflow.com/a/24973845
type: Answer
has comment: http://stackoverflow.com/comment/109564613
has comment: http://stackoverflow.com/comment/114173535
has comment: http://stackoverflow.com/comment/120209464
downvote count: 1
accepted answer of: http://stackoverflow.com/q/24972437
score: 42
answers question: http://stackoverflow.com/q/24972437
upvote count: 43
type: AcceptedAnswer
has body: Building on what is mentioned in the comments, the simplest solution would be: @RequestMapping(method = RequestMethod.PUT, consumes = MediaType.APPLICATION_JSON_VALUE) @ResponseBody public Collection&lt;BudgetDTO&gt; updateConsumerBudget(@RequestBody SomeDto someDto) throws GeneralException, ParseException { //whatever } class SomeDto { private List&lt;WhateverBudgerPerDateDTO&gt; budgetPerDate; //getters setters } The solution assumes that the HTTP request you are creating actually has Content-Type:application/json instead of text/plain
has comment: http://stackoverflow.com/comment/88247977

http://stackoverflow.com/q/25053742
has body: I'm trying to generate form elements from a template when the user clicks on a button. I created the template and the container layout for the new forms with XML. Its successfully generating the first form where I'm telling it to generate, but when I try to generate more forms beyond the first one its giving me an error: "the specified child already has a parent. You must call removeView() on the child's first parent". Any clue as to what I should do so as to generate more than one element? I've tried changing the id of the newly created forms but that's giving me a null pointer exception and crashing. Thank you. public class MakeQuestion extends Activity implements OnClickListener{ private static final int MY_BUTTON = 9000; int templateID = 1; Button b; Button target; View insertPoint; Button testTemplate; View v1; RelativeLayout.LayoutParams templateParams; LayoutInflater vi; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.make_question); Initialize(); } public void Initialize(){ //button for adding new forms b = (Button) findViewById(R.id.makeLayoutButton); b.setOnClickListener(this); //get the template form to be duplicated vi = (LayoutInflater) getApplicationContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE); v1 = vi.inflate(R.layout.form_template, null); //set the params for the element that will have dynamically generated content below it templateParams = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); //container where forms will be contained in insertPoint = findViewById(R.id.questionsContainer); //view where new form will go below View belowContainer = findViewById(R.id.questionTemplateFake); //set id for layout params of view belowContainer.setId(1); //set rule for new forms to go below view 'belowContainer' templateParams.addRule(RelativeLayout.BELOW, belowContainer.getId()); } public void onClick(View v) { switch (v.getId()) { case R.i…
has title: Error when generating dynamic content
linked to: http://stackoverflow.com/q/8460680
has answer: http://stackoverflow.com/a/25053880
score: 0
answer count: 1
tagged with: android
type: AnsweredQuestion
tagged with: dynamic
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/25053880

http://stackoverflow.com/a/25018666
type: Answer
upvote count: 4
answers question: http://stackoverflow.com/q/25012778
downvote count: 0
has body: You are trying to create a seemingly non-linear constraint on binary variables. You can model this as a series of linear constraints by noting the n will have the value 1 if and only if x1, x2, and x3 are all 1. // only if part model.addConstr(n, GRB.LESS_EQUAL, x1); model.addConstr(n, GRB.LESS_EQUAL, x2); model.addConstr(n, GRB.LESS_EQUAL, x3); // if part GRBLinExpr all_three; all_three.addTerm(1.0, x1); all_three.addTerm(1.0, x2); all_three.addTerm(1.0, x3); all_three.addConstrant(-2); model.addConstr(n, GRB.GREATER_EQUAL, all_three); This adds the constraints n &gt;= x1 + x2 + x3 - 2 and n &lt;= min(x1, x2, x3).
score: 4
has comment: http://stackoverflow.com/comment/38924193

http://stackoverflow.com/comment/38817085
type: QuestionComment
comment on: http://stackoverflow.com/q/24968455
has text: Can you add relevant code and show what you have tried? It helps troubleshooting what went wrong.
score: 0
type: Comment

http://stackoverflow.com/comment/38995371
score: 0
comment on: http://stackoverflow.com/q/25062727
type: Comment
type: QuestionComment
has text: How do you pass the input `(4.3 - 10.3)` ? In what form? As 2 `double`'s? As a `String`? Would a method like this `getText(int startLine, int startChar, int endLine, int endChar)` work for you?

http://stackoverflow.com/comment/38939635
has text: `MCRYPT_RIJNDAEL_256` is not AES. Try `MCRYPT_RIJNDAEL_128`.
comment on: http://stackoverflow.com/q/25036826
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24953328
answer count: 2
has answer: http://stackoverflow.com/a/24953400
downvote count: 0
has comment: http://stackoverflow.com/comment/38782488
favorite count: 0
accepted answer: http://stackoverflow.com/a/24953400
possible better answer: http://stackoverflow.com/a/24954015
upvote count: 2
has answer: http://stackoverflow.com/a/24954015
tagged with: maven
score: 2
type: AnsweredQuestion
tagged with: java
linked to: http://stackoverflow.com/q/574594
has comment: http://stackoverflow.com/comment/38782643
has comment: http://stackoverflow.com/comment/38782450
has title: Maven dependency with old version
type: Question
has body: I need to compile a project with this dependency: com.wadpam docrest-doclet 1.21 provided (and a lot more like this) In public maven repositories there's no version 1.21 the oldest one is 1.22. Where can I find that jar?

http://stackoverflow.com/comment/38748294
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24934612
score: 0
has text: When I run sudo ldconfig -v, in the output I have file with name like libopencv_core.so.2.4 -> libopencv_core.so.2.4.5. Thats why I told that it finds 2.4 but not 2.3.

http://stackoverflow.com/q/24997930
has title: Trouble working with showAtLocation(View, int, int, int) for PopupWindow
has comment: http://stackoverflow.com/comment/38866651
tagged with: android
answer count: 1
tagged with: android-activity
favorite count: 0
tagged with: android-popupwindow
type: UnansweredQuestion
upvote count: 1
has comment: http://stackoverflow.com/comment/38866911
tagged with: android-layout
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/38866834
has answer: http://stackoverflow.com/a/24998485
has body: I am trying to create a popup that when launch would be at the center of this screen, and where its width would not take the entire screen, regardless where the button to prompt it was situated at. I also wanted to add transparency so that users are vaguely able to see the activity now in background, but I also experienced issues working with alpha. My attempt so far have been unsatisfactory. In particular, when attempting to use gravity in the showAtLocation method, i get prompted with the following error message: "The method showAtLocation(View, int, int, int) in the type PopupWindow is not applicable for the argument" Any assistance would be greatly appreciated; thanks in advance. Below is the activity code import android.app.Activity; import android.graphics.Color; import android.os.Bundle; import android.view.Gravity; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup.LayoutParams; import android.widget.Button; import android.widget.LinearLayout; import android.widget.PopupWindow; import android.widget.TextView; import android.view.View.OnClickListener; public class MainActivity extends Activity implements OnClickListener { LinearLayout popupLayout; PopupWindow popupMessage; Button popupButton, insidePopupButton; TextView popupText; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); init(); popupInit(); } public void init() { popupButton = (Button) findViewById(R.id.popupbutton); popupText = new TextView(this); insidePopupButton = new Button(this); popupLayout = new LinearLayout(this); popupLayout.setBackgroundColor(Color.parseColor("#dd000000")); popupLayout.setGravity(Gravity.CENTER); insidePopupButton.setText("OK"); popupText.setText("This is Popup Window.press OK to dismiss it."); popupText.setPadding(30, 40, 30, 20); popupLayout.setOrientation(1); popupLayout.addView(popupText); popupLayout.addView(insidePopupButton); } public…
type: Question
downvote count: 0

http://stackoverflow.com/q/24925370
type: AnsweredQuestion
has title: How to create an array with both int and char
has answer: http://stackoverflow.com/a/24925504
linked to: http://stackoverflow.com/q/1200621
upvote count: 3
tagged with: java
duplicate of: http://stackoverflow.com/q/1200621
type: Question
has comment: http://stackoverflow.com/comment/38730011
tagged with: arrays
score: -1
has comment: http://stackoverflow.com/comment/38731450
accepted answer: http://stackoverflow.com/a/24925504
downvote count: 4
answer count: 1
has comment: http://stackoverflow.com/comment/38730071
favorite count: 0
has comment: http://stackoverflow.com/comment/38730107
has body: I'm trying to create a single array that contains the numbers 1-9 and the characters A-F. The array should look like: 1 2 3 4 5 6 7 8 9 A B C D E F. I don't know how to set the array up and would appreciate any advice.

http://stackoverflow.com/comment/38959353
type: QuestionComment
comment on: http://stackoverflow.com/q/25002458
score: 0
has text: The number of steps in the wizard is dependent on how many items I retrieve from the database so it is dynamic. Each page represents a single item in my model so I needed a way to pull out that single item for the single step in the wizard. The ElementModel I created below works perfectly.
type: Comment

http://stackoverflow.com/q/24936873
tagged with: ajax
has comment: http://stackoverflow.com/comment/38757413
possible better answer: http://stackoverflow.com/a/24937913
has answer: http://stackoverflow.com/a/24937945
tagged with: http://stackoverflow.com/tag/html
has comment: http://stackoverflow.com/comment/38754090
type: AnsweredQuestion
has title: How to post and receive data in a loop using AJAX to and from a servlet
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/24937913
has comment: http://stackoverflow.com/comment/38751722
tagged with: javascript
has answer: http://stackoverflow.com/a/24937112
accepted answer: http://stackoverflow.com/a/24937112
score: 0
answer count: 3
has body: I am working on a news summarizer and one of its requirements is to display a list of article titles dynamically on a webpage using AJAX called from a database. I have been able to successfully configure the datastore(google app engine) and use the AJAX call to display article title. However, there is one big issue here. I am only able to call and show a single title. I want to run the AJAX call inside a loop so that I can display 10 news articles stored in datastore from 1 to 10 using the variable i of the loop as the unique reference. The AJAX CODE : function change(element) { var xmlhttp; var i = 1; var param = "category=" + element + "&amp;no=" + i; // This i is the key to my operation. alert(param); //testing purpose xmlhttp = new XMLHttpRequest(); xmlhttp.onreadystatechange = function() { //alert('function()'); if (xmlhttp.readyState == 4 &amp;&amp; xmlhttp.status == 200) { var div = document.getElementById('content'); div.innerHTML = ''; for (i = 1; i &lt;=10; i++) { var a = document.createElement('a'); a.href = "#"; a.onclick = rem.bind(null, i); a.innerHTML = '&lt;h2 id="theading'+i+'"&gt;' + xmlhttp.responseText + '&lt;/h2&gt;'; //the title will go here. div.appendChild(a); div.appendChild(document.createElement('br')); } } } xmlhttp.open("POST", "/display?" + param, true); xmlhttp.send(); } I also request to suggest JavaScript code and not jquery, as I am unfamiliar with it. These are my humble beginnings. UPDATE MY SERVLET CODE: public class ArticleHandler extends HttpServlet { public void service(HttpServletRequest req, HttpServletResponse resp) throws IOException { resp.setContentType("text/html"); PrintWriter out = resp.getWriter(); String category=req.getParameter("category"); String number=req.getParameter("no"); int i = Integer.parseInt(number); List&lt;EntityArticles&gt; articles = RegisterClass.ofy().load().type(EntityArticles.class).filter("category ",category).list(); out.write(articles); // Is this the correct way to send this list articles ? …
has comment: http://stackoverflow.com/comment/38754920
has comment: http://stackoverflow.com/comment/38755098

http://stackoverflow.com/comment/38759571
has text: @PopTudor There's a difference between the type a method declares as its return type and the actual type of the object returned by it in a specific method call (which is only known at runtime). The compiler knows only about the former, and can't make decisions based on the latter.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24940643

http://stackoverflow.com/comment/39012823
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25064529
type: QuestionComment
has text: Thanks guys for your help, the answer that follows fixed my issues.

http://stackoverflow.com/a/24995463
score: 0
type: Answer
answers question: http://stackoverflow.com/q/24995332
has body: Yes, you used instanceof correctly. To get rid of nulls in constructors you could create new constructor with only necessary params or consider using Builder pattern (however, it could be too complicated for such task).

comparison
tags question: http://stackoverflow.com/q/24927701
tag name: comparison
tags question: http://stackoverflow.com/q/24928124
type: Tag
tags question: http://stackoverflow.com/q/24989710
tags question: http://stackoverflow.com/q/25063642

gwt
tags question: http://stackoverflow.com/q/24991186
tag name: gwt
tags question: http://stackoverflow.com/q/24956978
tags question: http://stackoverflow.com/q/25049261
tags question: http://stackoverflow.com/q/25038259
tags question: http://stackoverflow.com/q/24957057
type: Tag
tags question: http://stackoverflow.com/q/24916578
tags question: http://stackoverflow.com/q/24926180
tags question: http://stackoverflow.com/q/25001533
tags question: http://stackoverflow.com/q/24936431
tags question: http://stackoverflow.com/q/24948270
tags question: http://stackoverflow.com/q/25003102
tags question: http://stackoverflow.com/q/24959693
tags question: http://stackoverflow.com/q/25044076
tags question: http://stackoverflow.com/q/24914993
tags question: http://stackoverflow.com/q/24971087
tags question: http://stackoverflow.com/q/25028932
tags question: http://stackoverflow.com/q/24910863
tags question: http://stackoverflow.com/q/25003814
tags question: http://stackoverflow.com/q/24927977
tags question: http://stackoverflow.com/q/25061923
tags question: http://stackoverflow.com/q/24926713
tags question: http://stackoverflow.com/q/24964444

http://stackoverflow.com/comment/38803211
type: AnswerComment
score: 0
type: Comment
has text: @newacct You're somewhat right, but if you follow the builder pattern, it's highly unlikely that you'll get an ClassCastException. See edit though
comment on: http://stackoverflow.com/a/24952964

http://stackoverflow.com/a/54974680
score: 0
type: Answer
has body: Just set the child background color as same of exandableListView example: <ExpandableListView android:id="@+id/expandableListView" android:layout_height="match_parent" android:layout_width="match_parent" android:indicatorLeft="@null" android:clipChildren="true" android:background="@color/colorGrayTransparent" /> and child item color like this : ....
answers question: http://stackoverflow.com/q/24955173

http://stackoverflow.com/q/25030650
tagged with: jdbc
has title: How to update MySQL timestamp column using PreparedStatement in Java?
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/38928065
has comment: http://stackoverflow.com/comment/38928101
tagged with: mysql
upvote count: 1
tagged with: prepared-statement
has answer: http://stackoverflow.com/a/25030786
type: Question
has comment: http://stackoverflow.com/comment/38928021
tagged with: sql
has body: I have created a table as below: create table sample(id int not null,created_at timestamp,updated_at timestamp,name varchar(100),primary key(id)); I have tried to update the column in different ways as below, but am not able to update the time: Calendar calender = Calendar.getInstance(); java.util.Date now = calender.getTime(); java.sql.Timestamp updatedAt = new java.sql.Timestamp(now.getTime()); stmt.setTimestamp(2, updatedAt); java.sql.Timestamp updatedAt = new java.sql.Timestamp(new java.util.Date().getTime()); stmt.setTimestamp(2, updatedAt); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); Date date = new Date(); String updatedAt =sdf.format(date); stmt.setString(2, updatedAt); final java.util.Date updatedAt = new java.util.Date(System.currentTimeMillis()); stmt.setDate(2, new java.sql.Date(updatedAt.getTime())); Please, help me to resolve this issue?
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/38928246
favorite count: 0
type: UnansweredQuestion

log4j
tags question: http://stackoverflow.com/q/25031841
tags question: http://stackoverflow.com/q/24930136
tags question: http://stackoverflow.com/q/25047018
tags question: http://stackoverflow.com/q/24939212
tags question: http://stackoverflow.com/q/25013886
tags question: http://stackoverflow.com/q/24915700
tags question: http://stackoverflow.com/q/24951456
tags question: http://stackoverflow.com/q/25024446
tags question: http://stackoverflow.com/q/25039981
tags question: http://stackoverflow.com/q/24956310
tags question: http://stackoverflow.com/q/24939199
tags question: http://stackoverflow.com/q/24932425
tags question: http://stackoverflow.com/q/24930660
tags question: http://stackoverflow.com/q/24972260
tags question: http://stackoverflow.com/q/25049274
tag name: log4j
tags question: http://stackoverflow.com/q/24963101
tags question: http://stackoverflow.com/q/24939312
tags question: http://stackoverflow.com/q/24963450
tags question: http://stackoverflow.com/q/24990736
tags question: http://stackoverflow.com/q/24998450
tags question: http://stackoverflow.com/q/25023819
type: Tag
tags question: http://stackoverflow.com/q/24931576
tags question: http://stackoverflow.com/q/24991127
tags question: http://stackoverflow.com/q/24922887
tags question: http://stackoverflow.com/q/25065580
tags question: http://stackoverflow.com/q/25039249
tags question: http://stackoverflow.com/q/24990515

http://stackoverflow.com/comment/49198206
has text: Hi, any follows on this issue, please?
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25434785

http://stackoverflow.com/comment/38805496
has text: Most of what your saying makes sense to me. What do mean with moving the main thread out to it's own class? i tried to make a game loop by overriding paintComponent, But i fail to see how i can put it in a loop.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/24965168
type: Comment

http://stackoverflow.com/comment/38713659
has text: I have already set the max String size using `StringBuilder` and have it set to 30000 characters. There are only 23000, I'll look into the timeOut option though, Thanks!
comment on: http://stackoverflow.com/a/24916263
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/25042203
has title: Ant build script to run a batch file, while passing user input to batch file
tagged with: batch-file
type: AnsweredQuestion
tagged with: cmd
score: 1
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25042707
answer count: 2
possible better answer: http://stackoverflow.com/a/25044437
has answer: http://stackoverflow.com/a/25044437
tagged with: build.xml
tagged with: java
upvote count: 1
accepted answer: http://stackoverflow.com/a/25042707
tagged with: ant
has body: I am writing a build script that is meant to execute a .bat file, with the user providing input before pressing enter to execute the ant script. I have used the bat file already, and it works well, but I have never tried integrating a bat file into a build script before, especially one that requires input. The build script without the input component should look like this I believe: &lt;target name="css-val"&gt; &lt;exec dir="M:\burnjc_view\ServiceTeams\Team 4\Report\CssValidation\bin" executable="cmd" os="Windows 7"&gt; &lt;arg line="/c cssvalFile.bat"/&gt; &lt;/exec&gt; &lt;/target&gt; The bat file that requires input to run properly looks like this: java -jar css-validator.jar -output gnu file:///%1 &gt; ..\output\%2 Input 1 is the file and directory of a file to be validated by css-validator.jar, while 2 is the filename of the output. How do I get the ant script to pass input to the bat file it is executing so that it works almost like someone was executing the bat file by itself? I know the first part of the user input to run the whole thing will be "ant css-val", but afterward I do not know how to pass input to the bat file.
downvote count: 0

http://stackoverflow.com/a/24913961
upvote count: 7
type: Answer
downvote count: 0
has body: It is redundant in most cases. The exception is if it's a local variable, in which case it needs to be initialized before being used. Examples: class Example{ boolean value1;//valid, initialized to false public void doStuff(){ boolean value2;//valid, but uninitialized System.out.println(value1);//prints "false" (assuming value1 hasn't been changed) System.out.println(value2);//invalid, because value2 isn't initialized. This line won't compile. Some documentation on this: https://web.archive.org/web/20140814175549/https://docs.oracle.com/javase/specs/jls/se5.0/html/typesValues.html#96595 Even though variables are initialized, you still might want to explicitly declare their initial values. It can make the code more legible, and lets people reading your code know that it's a conscious decision to set it to that value. Related
score: 7
answers question: http://stackoverflow.com/q/24913818
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24913818

http://stackoverflow.com/comment/38862440
score: 0
type: AnswerComment
type: Comment
has text: But I don't have this in any of my other webpages? I tried adding my projectname; this didn't work
comment on: http://stackoverflow.com/a/24993943

http://stackoverflow.com/q/25003138
linked to: http://stackoverflow.com/q/5540901
has comment: http://stackoverflow.com/comment/38876265
answer count: 0
type: UnansweredQuestion
type: Question
has body: I want to get information about sql server from application like :"MySql 5.6.16".
tagged with: java
has comment: http://stackoverflow.com/comment/38876393
tagged with: jpa
score: 0
has title: Is there any way to get RDBMS name and version using JPA?

http://stackoverflow.com/comment/38781341
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24952582
score: 0
has text: You could use annotations and let an Json parser that supports annotations do all the work for you, concerning converting Json file to objects and the other way arround. Jackson is a good example that many seems to be using https://github.com/FasterXML/jackson-annotations. It might save you some work :) Using that would automatically solve your problem I believe

http://stackoverflow.com/a/25235842
has comment: http://stackoverflow.com/comment/39317048
has comment: http://stackoverflow.com/comment/39319818
has comment: http://stackoverflow.com/comment/39314135
has body: @help as far i understand your question is how to send JsonObject with data to specified Server is that correct ? if it is the correct then i suggest you to use Volley library for networking and here are many examples that may useful to you .http://arnab.ch/blog/2013/08/asynchronous-http-requests-in-android-using-volley/ and http://www.androidhive.info/2014/05/android-working-with-volley-library-1/ Just go through it. It provides easiest way to perform networking operations and also cancellation of request is also possible with this library. Sample Code: final String URL = "SERVER_URL"; // Post params to be sent to the server HashMap&lt;String, String&gt; params = new HashMap&lt;String, String&gt;(); params.put("token", "AbCdEfGh123456"); JsonObjectRequest req = new JsonObjectRequest(URL, new JSONObject(params), new Response.Listener&lt;JSONObject&gt;() { @Override public void onResponse(JSONObject response) { try { VolleyLog.v("Response:%n %s", response.toString(4)); } catch (JSONException e) { e.printStackTrace(); } } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { VolleyLog.e("Error: ", error.getMessage()); } }); // add the request object to the queue to be executed ApplicationController.getInstance().addToRequestQueue(req); Using this code you can send your data to your server and at server side you can use php code to receive this jsondata and parse it. Thanks.
score: 0
has comment: http://stackoverflow.com/comment/39317154
type: Answer
has comment: http://stackoverflow.com/comment/39319309
has comment: http://stackoverflow.com/comment/39317109
has comment: http://stackoverflow.com/comment/39314317
answers question: http://stackoverflow.com/q/24955063
has comment: http://stackoverflow.com/comment/39319718

http://stackoverflow.com/comment/38749050
comment on: http://stackoverflow.com/q/24935480
score: 0
has text: @NikhilJoshi - He will also habe to override `hashCode()` if he overrides `equals()`
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25042479
has comment: http://stackoverflow.com/comment/38950340
linked to: http://stackoverflow.com/q/8033550
linked to: http://stackoverflow.com/q/9896968
has title: Can't initialize a Two-Dimentional Array in Java
tagged with: arrays
score: 0
linked to: http://stackoverflow.com/q/12231453
answer count: 2
tagged with: for-loop
has answer: http://stackoverflow.com/a/25042865
tagged with: multidimensional-array
linked to: http://stackoverflow.com/q/1115230
linked to: http://stackoverflow.com/q/1564832
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25042791
accepted answer: http://stackoverflow.com/a/25042865
tagged with: java
has body: I am trying to store X axis position of mouse and Y axis position of mouse separately inside a two dimentional array and use it later but getting errors. I am new to arrays and i am trying to initialize a two dimentional array using for loops and instance variables/global variables. The error which i am getting says that "array constants can only be used in initializers". I went through the documentetions and changed the code but not got a solution. Questions and documentations which i read to get a solution Create a 2 dimentional array Initialize a two dimentional array Java: Declaring a multidimensional array without specifying the size of the array ( eg. new int[10][] ) casting Object array to Integer array error Array 2 Dimentional java convert integer to int array My code: package com.selenium; import java.awt.*; public class MouseAxis { int[][] mouseLocation ; int AxisX; int AxisY; public void getAxisXAndY(int x, int y){ AxisX=x; AxisY=y; } // getAxisXAndY public void mouseAxisPosition() throws AWTException{ int x , y; PointerInfo pointer = MouseInfo.getPointerInfo(); Point point = pointer.getLocation(); x=(int)point.getX(); y=(int)point.getY(); getAxisXAndY(x,y); } // mouseAxisPosition public void storeMouseLocation(){ for(int i=0; i<=20; i++){ for(int j=i; j<=1; j++){ int[][] temp = new int[j][i]; temp[j][i]={AxisX,AxisY} ; mouseLocation[j][i]=temp[j][i]; Thread.sleep(4000); mouseAxisPosition(); } // for_2 } // for_1 } // storeMouseLocation } // MouseAxis
possible better answer: http://stackoverflow.com/a/25042791
type: Question

http://stackoverflow.com/a/34636092
type: Answer
has body: event.getNativeEvent().getClientX() and event.getNativeEvent().getClientY() does not works well after scrolling the page. Below is solution: @Override public void onContextMenu(ContextMenuEvent event) { NativeEvent nativeEvent = event.getNativeEvent(); // stop the browser from opening the context menu event.preventDefault(); event.stopPropagation(); int x = nativeEvent.getClientX() + getScrollLeft(); int y = nativeEvent.getClientY() + getScrollTop(); this.contextMenu.setPopupPosition(x, y); this.contextMenu.show(); } public static native int getScrollTop() /*-{ return $doc.body.scrollTop; }-*/; public static native int getScrollLeft() /*-{ return $doc.body.scrollLeft; }-*/;
answers question: http://stackoverflow.com/q/24927977
score: 0

http://stackoverflow.com/comment/38784682
comment on: http://stackoverflow.com/a/24954381
score: 1
type: AnswerComment
has text: Thanks! Sorry for the dup, I though the problem was on the subtract method so I didn't search properly.
type: Comment

wamp
tag name: wamp
tags question: http://stackoverflow.com/q/25011177
type: Tag

http://stackoverflow.com/a/24947898
accepted answer of: http://stackoverflow.com/q/24947844
has body: Two things: First, JRE is not the same as the JDK. If you do have the JDK, you need to configure eclipse to point to that in your settings. Second, in your screenshot above, your compiler compliance level is set to 1.7. This will treat all your code as if it's using Java 1.7. Change this to 1.8 to fix your error. You will need to have Eclipse Luna in order to get support for Java 8, but you can add it to Kepler SR2 if you want. I'd try with Luna and the above suggestions before you go any further. See this reference. Once you get Luna, your JAVA_HOME variable should be enough to get Eclipse to recognize JDK 8. If you want to specify an additional JDK, you can add a new Java System Library by going to: Project -&gt; Properties -&gt; Java Build Path -&gt; Libraries -&gt; Add Library -&gt; Java System Library and navigating to a valid location for the JDK 8. You can download your platform's JDK 8 here
answers question: http://stackoverflow.com/q/24947844
has comment: http://stackoverflow.com/comment/38772920
type: Answer
has comment: http://stackoverflow.com/comment/73587347
downvote count: 0
score: 44
has comment: http://stackoverflow.com/comment/38772996
has comment: http://stackoverflow.com/comment/49059732
has comment: http://stackoverflow.com/comment/38772869
has comment: http://stackoverflow.com/comment/49059740
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38773045
upvote count: 44

http://stackoverflow.com/comment/38950558
score: 5
type: Comment
type: QuestionComment
has text: As to the behavior of `<<` and `>>`, why not simply try it? As to variable sizes, there are only a few primitive types in Java, and each wrapper class has a `SIZE` constant that gives you what you want. If you want to get baroque, you could even put them into a map so you could look them up by class (e.g., `int bitSize = bitSizeMap.get(int.class);`)
comment on: http://stackoverflow.com/q/25042530

http://stackoverflow.com/q/25025458
answer count: 2
score: 3
has answer: http://stackoverflow.com/a/25027054
downvote count: 0
has comment: http://stackoverflow.com/comment/38919350
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38919572
upvote count: 3
tagged with: java
tagged with: hibernate
tagged with: h2
has body: I've been doing some reading on hibernate inheritance and am having trouble applying it to my situation. I tried doing what this post mentioned which seems like it should be what I want. Here are the 3 classes I'm working with - each should have its own table: ParentClass ChildClass SeparateTable Below is essentially what I have laid out. However, when I try to run my tests on the Child class service, they all fail for java.lang.IllegalStateException: no field annotated with Id. Now if I'm understanding that article/blog post correctly, I shouldn't need need the ChildClass annotated with Id since it should be picked up in the parent class. I could be completely wrong as I'm new to Hibernate, but if you guys have any thoughts, I'd be glad to hear what I'm doing wrong. ParentClass @Table(name="parent_class") @Inheritance(strategy=InheritanceType.JOINED) public class ParentClass { @Id @GeneratedValue(strategy=GenerationType.IDENTITY) private Long m_id; @Column(nullable=false, length=2500) private String m_variable; @ManyToOne(fetch=FetchType.EAGER) @JoinColumn(name="s_key", nullable=false) private SeparateTable m_sTable; etc... } ChildClass @Table(name="child_class") @PrimaryKeyJoinColumn(name="m_id") public class ChildClass extends ParentClass { @Column(nullable=false, length=100) private String m_name; @Column(nullable=true, length=250) private String m_description; etc... } SeparateTable @Table(name="separate_table") public class SeparateTable { @Id @Column(unique=true, nullable=false, length=100) private String m_user; @OneToMany(mappedBy="m_sTable", cascade={CascadeType.ALL}, fetch=FetchType.LAZY, orphanRemoval=true) private Set&lt;ParentClass&gt; m_parents; @OneToMany(mappedBy="m_sTable", cascade={CascadeType.ALL}, fetch=FetchType.LAZY, orphanRemoval=true, targetEntity=ParentClass.class) private Set&lt;ChildClass&gt; m_children; etc... }
has title: Hibernate inheritance - no field annotated with Id
type: Question
has answer: http://stackoverflow.com/a/25038954
has comment: http://stackoverflow.com/comment/38919382
tagged with: inheritance
has comment: http://stackoverflow.com/comment/38919429

http://stackoverflow.com/q/25016080
tagged with: java
linked to: http://stackoverflow.com/q/3500378
type: Question
has body: I have a machine where I have been running Selenium automation scripts for a while now. Most recently, I have been running two different suites each day for months, one mvn, one ant. Nothing has changed. Now they almost always crash. I have tried re-installing java. I updated the selenium jar. I have the most up to date chromewebdriver. It crashes at a different step each time. Sometimes it crashes and leaves behind the following message below in cmd prompt window. Sometimes the machine actually goes down and comes back up when this automation suite is running. fatal error has been detected by the Java Runtime Environment: EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x0000000002990719, pid=4000, t id=1852 JRE version: Java(TM) SE Runtime Environment (8.0_11-b12) (build 1.8.0_11-b12) Java VM: Java HotSpot(TM) 64-Bit Server VM (25.11-b03 mixed mode windows-amd64 compressed oops) Problematic frame: v ~StubRoutines::atomic_cmpxchg_long Core dump written. Default location: c:\Selenium\Projects\foobar\hs_err_p id4000.mdmp An error report file with more information is saved as: c:\Selenium\Projects\foobar\hs_err_pid4000.log If you would like to submit a bug report, please visit: http://bugreport.sun.com/bugreport/crash.jsp Results : Tests run: 0, Failures: 0, Errors: 0, Skipped: 0 [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 5:43.270s [INFO] Finished at: Tue Jul 29 08:51:02 EDT 2014 [INFO] Final Memory: 8M/113M [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2. 12.4:test (default-test) on project foobar: Execution default-test of goal org.apache.maven.plugins:maven-surefire-plugin:2.12.4:test failed: The f orked VM terminated without saying properly goodbye. VM crash or System.exit cal led ? -&gt; [Help 1] [ERR…
has comment: http://stackoverflow.com/comment/38900643
score: 0
has comment: http://stackoverflow.com/comment/38902844
has comment: http://stackoverflow.com/comment/38900836
answer count: 0
type: UnansweredQuestion
has title: Selenium + java = crashing "fatal error has been detected by the Java Runtime Environment:"
tagged with: selenium
tagged with: selenium-webdriver
has comment: http://stackoverflow.com/comment/38900747

eclipse-plugin
tags question: http://stackoverflow.com/q/24981592
tags question: http://stackoverflow.com/q/25030488
tags question: http://stackoverflow.com/q/25031068
tags question: http://stackoverflow.com/q/24954010
type: Tag
tags question: http://stackoverflow.com/q/25000590
tags question: http://stackoverflow.com/q/25005404
tags question: http://stackoverflow.com/q/25031826
tags question: http://stackoverflow.com/q/24969845
tags question: http://stackoverflow.com/q/24920179
tags question: http://stackoverflow.com/q/24964674
tags question: http://stackoverflow.com/q/25032250
tags question: http://stackoverflow.com/q/24949842
tags question: http://stackoverflow.com/q/24995206
tag name: eclipse-plugin
tags question: http://stackoverflow.com/q/25005882

http://stackoverflow.com/q/24954516
has body: I have created one sample app from create pdf file from html string using phonegap android.I have write the code for Creating PDF file in java.Code, public class PdfGenerator { private WebView mAppView; private DroidGap mGap; public PdfGenerator(DroidGap gap, WebView view) { mAppView = view; mGap = gap; } public void generatePDF() { File root = Environment.getExternalStorageDirectory(); File gpxfile = new File(root, "test.pdf"); System.out.println("Path ::::"+gpxfile); try{ Document document = new Document(PageSize.LETTER); PdfWriter.getInstance(document, new FileOutputStream(gpxfile)); document.open(); document.addAuthor("Real Gagnon"); document.addCreator("Real's HowTo"); document.addSubject("Thanks for your support"); document.addCreationDate(); document.addTitle("Please read this"); HTMLWorker htmlWorker = new HTMLWorker(document); String str = " "+ "Real's HowTo" + " Show your support " + " It DOES cost a lot to produce this site - in ISP storage and transfer fees, " + "in personal hardware and software costs to set up test environments, and above all," + "the huge amounts of time it takes for one person to design and write the actual content." + " If you feel that effort has been useful to you, perhaps you will consider giving something back?" + " Donate using PayPal® to real@rgagnon.com." + " Contributions via PayPal are accepted in any amount " + " Java HowTo " + " Javascript HowTo Powerbuilder HowTo " + " "; htmlWorker.parse(new StringReader(str)); document.close(); System.out.println("Done"); } catch (Exception e) { e.printStackTrace(); } } } my mian class code is, public class MainActivity extends DroidGap { PdfGenerator pdf; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); super.init(); pdf = new PdfGenerator(this, appView); appView.addJavascriptInterface(pdf, "PdfGenerator"); super.loadUrl("file:///android_asset/www/test.html"); } } Javascript code, whan i call generatePDF from javascript i got the following error, U…
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/24961548
tagged with: java
type: Question
has title: Unable to call java methods from phonegap android?
tagged with: javascript
has comment: http://stackoverflow.com/comment/38786727
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/38786325
has comment: http://stackoverflow.com/comment/38785837
tagged with: cordova

http://stackoverflow.com/a/24924508
type: Answer
score: 2
accepted answer of: http://stackoverflow.com/q/24924219
downvote count: 0
answers question: http://stackoverflow.com/q/24924219
type: AcceptedAnswer
has body: URIBuilder is an abstract class and the implementation gets to decide which characters need special encoding and which do not. The URIBuilder we get from a WebResource is attempting to follow the guidelines of RFC 3986. On page 12, ! is listed as a sub-delimiter and this is why it is getting encoded. From my reading of the RFC, I don't think we should be using ! as part of a query parameter. For instance, Vaading uses ! to distinguish between sub-windows of the same application. The simplest work around I can think of is to simply not use URIBuilder or use the fromURI method that takes a String as input. You can create the URI with everything except the part with the characters we don't want encoded, convert this to astring, manipulate astring to replace the query parameter and then call URIBuilder.fromURI(aString)
upvote count: 2

http://stackoverflow.com/q/24943921
has answer: http://stackoverflow.com/a/24943965
tagged with: drag-and-drop
tagged with: android
has comment: http://stackoverflow.com/comment/38765611
type: AnsweredQuestion
score: 0
accepted answer: http://stackoverflow.com/a/24943965
type: Question
tagged with: java
tagged with: sharedpreferences
has title: Dynamically Created imagebutton is null even after it has been used if app is closed and reopened
answer count: 1
tagged with: imagebutton
has body: I am programming an app that the user can purchase buildings (drag and drop imagebuttons) that they are allowed to move where they would like on the background. Drag and drop works well and so does the dynamic creation of the imagebuttons works well. I even have sharedpreferences working so that the coordinates of the last spot the building was in is remembered, but the actual imagebutton shows up null when the app is closed and reopened. Thus, it gives me the coordinates, but does not have the button there. My question is, how do I have the app "remember" that the imagebutton has been created so that I can display the button at the coordinates that are saved? Any help is appreciated. Thanks.

http://stackoverflow.com/q/25003208
has answer: http://stackoverflow.com/a/25003407
answer count: 3
has comment: http://stackoverflow.com/comment/38876665
downvote count: 0
has comment: http://stackoverflow.com/comment/38876515
favorite count: 0
has comment: http://stackoverflow.com/comment/38876592
has comment: http://stackoverflow.com/comment/38877063
has comment: http://stackoverflow.com/comment/38876683
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/38876457
has comment: http://stackoverflow.com/comment/38876932
tagged with: java
has body: Reading about Android I can see many parts of the framework using int constants for a return value, or configuration value (like in here in the START_REDELIVER_INTENT), instead of an enum, which as far as I know is a better option for many reasons that can be found all around the web, like this. So this makes me wonder...why Google decided to use so many int's instead of enum's?
type: Question
upvote count: 15
linked to: http://stackoverflow.com/q/9254637
has answer: http://stackoverflow.com/a/25003455
tagged with: enums
has comment: http://stackoverflow.com/comment/38876806
has answer: http://stackoverflow.com/a/52091156
has title: Why Android uses Ints instead of Enums
has comment: http://stackoverflow.com/comment/38876646
has comment: http://stackoverflow.com/comment/38876507
has comment: http://stackoverflow.com/comment/38876490
score: 15
has comment: http://stackoverflow.com/comment/38876701
linked to: http://stackoverflow.com/q/4822877
tagged with: int

http://stackoverflow.com/comment/38851018
has text: Post your logcat then...
type: QuestionComment
comment on: http://stackoverflow.com/q/24989790
score: 4
type: Comment

http://stackoverflow.com/a/25018418
type: Answer
answers question: http://stackoverflow.com/q/25018294
has body: You can convert date into timestamp and sort it. It is very easy for sorting.
score: 0

http://stackoverflow.com/a/24997231
has comment: http://stackoverflow.com/comment/38865837
has comment: http://stackoverflow.com/comment/97459926
type: Answer
has comment: http://stackoverflow.com/comment/38865632
has comment: http://stackoverflow.com/comment/38865275
score: 2
has body: public String serialize(Object contextObject) { Gson jsonifier = JSONIFIER_BUILDER.registerTypeAdapter(Config.class, new ConfigSerializer(contextObject)).create(); return jsonifier.toJson(this); } You keep registering new types to your static builder. Which it apparently does not overwrite the previous one. GsonBuilder source
downvote count: 0
has comment: http://stackoverflow.com/comment/38865172
has comment: http://stackoverflow.com/comment/97307535
answers question: http://stackoverflow.com/q/24993258
upvote count: 2
has comment: http://stackoverflow.com/comment/38865874
has comment: http://stackoverflow.com/comment/38866108
has comment: http://stackoverflow.com/comment/38865018

http://stackoverflow.com/comment/38875958
type: Comment
comment on: http://stackoverflow.com/a/25002852
type: AnswerComment
has text: @AnshumanTripathy Rod is right about adding `userinput.nextLine();`, but you still need to use a loop. Updated answer.
score: 0

http://stackoverflow.com/comment/38805320
has text: How is the code you're using to tell "the sprite to follow the bezier" related to the path you apparently created. Perhaps have a look at sscce.org
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24964255
score: 0

http://stackoverflow.com/comment/38914102
type: QuestionComment
has text: I'd suggest researching `SharedPreferences`. You should be able to find several helpful examples after a quick Google search.
comment on: http://stackoverflow.com/q/25022987
score: 0
type: Comment

http://stackoverflow.com/q/24995685
favorite count: 0
possible better answer: http://stackoverflow.com/a/24995758
has answer: http://stackoverflow.com/a/24995758
tagged with: regex
linked to: http://stackoverflow.com/q/7854123
has body: How could I get only the first number from the strings below? Regular expression should stop at space or first non-numeric character. Examples: 6x2mL 7 x 5mL 100Subunits 2*5Kg
has title: Regular expression to extract (only) the first numeric value
has comment: http://stackoverflow.com/comment/38862462
accepted answer: http://stackoverflow.com/a/24995779
type: Question
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24995759
tagged with: java
upvote count: 4
answer count: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/38865820
has comment: http://stackoverflow.com/comment/38861994
linked to: http://stackoverflow.com/q/9736931
score: 4
has answer: http://stackoverflow.com/a/24995779

http://stackoverflow.com/comment/38918454
type: AnswerComment
comment on: http://stackoverflow.com/a/25025255
type: Comment
has text: Your answer is link only, would you mind editing your post to include the relevant quoted section from the text?
score: 2

http://stackoverflow.com/comment/39262532
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25066812
type: Comment
has text: Should I make different Swingworkers or can I put it into one Swingworker? @trashgod

http://stackoverflow.com/a/25012729
has body: in your code instead of a.getText().toString() == c.getText().toString() use a.getText().toString().equals(c.getText().toString()) you can't compare two strings the way are you doing
type: Answer
answers question: http://stackoverflow.com/q/25012675
score: 0

http://stackoverflow.com/comment/38766163
score: 0
comment on: http://stackoverflow.com/q/24944166
type: Comment
has text: @PeterLawrey it's a "standard" TIFF file size 2800x2900, containing 2 pages, the first one being uncompressed, the second one being deflate-compressed. I could understand it as "compressing compressed data inflates them". I could try compressing the already-compressed data though, to see what's happening (if I have some time this week-end).
type: QuestionComment

http://stackoverflow.com/comment/38746778
comment on: http://stackoverflow.com/a/24934352
score: 0
type: AnswerComment
type: Comment
has text: Exactly. It's just that you wrote "never explicity initialized".

http://stackoverflow.com/a/24928683
downvote count: 1
has body: You can do the following changes in order to parse that data: testData1={"GOAL1":123, "GOAL2":123.45,"GOAL5":1256,"GOAL6":345.98} and below is your code to actually parse it. Type mapType = new TypeToken&lt;Map&lt;String, Object&gt;&gt;() { }.getType(); String str = prop.getProperty("testData1"); System.out.println(str); Gson gson = new Gson(); Map&lt;String, Object&gt; map = gson.fromJson(str, mapType); for (String key : map.keySet()) { String a = null; try { if (map.get(key) instanceof Double) { a = "" + map.get(key); } else { if (map.get(key) instanceof String) { a = (String) map.get(key); } else { a = null; } } if (a != null &amp;&amp; a.contains(".") &amp;&amp; !a.endsWith(".0")) { // Convert it into Double/Float } else { // Work as Integer } } catch (Exception ex) { ex.printStackTrace(); } }
upvote count: 1
score: 0
type: Answer
answers question: http://stackoverflow.com/q/24926786

http://stackoverflow.com/q/24934975
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24936725
has answer: http://stackoverflow.com/a/24936882
tagged with: apache-poi
has body: I have a List of integers, that i want to export to Excel. But everytime the value is shown with decimal positions: worksheet.getRow(0).getCell(1).setCellType(Cell.CELL_TYPE_NUMERIC); worksheet.getRow(0).getCell(1).setCellValue(2); // Excel shows here 2.00 After that I've tried it with an custom style: CellStyle numericStyle = workbook.createCellStyle(); numericStyle.setDataFormat(HSSFDataFormat.getBuiltinFormat("#")); worksheet.getRow(0).getCell(1).setCellValue(Double.parseDouble(2)); worksheet.getRow(0).getCell(1).setCellStyle(numericStyle); Now it seem to be correct formated in Excel, but Excel (2013) says, the file is unsafe and should not be edited. How is the correct way to format an integer-cell with poi? Thanks for your help.
tagged with: excel
type: Question
tagged with: java
has title: POI: Format integer in Excelsheet
score: 0
answer count: 2

http://stackoverflow.com/comment/38880074
has text: Could you give me an example of how I could modify it? The problem with trying to reset when not meeting the condition is that I don't want to lose the highlights on previously added rows that meet the condition
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25004987

http://stackoverflow.com/comment/38999605
type: AnswerComment
score: 0
type: Comment
has text: @user3880721 no, but best practices change over time. When it was added, the author might not have thought it was better to not be redundant.
comment on: http://stackoverflow.com/a/25025576

http://stackoverflow.com/q/24914555
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24914663
tagged with: java
has answer: http://stackoverflow.com/a/24914704
tagged with: classpath
type: Question
has title: How to set classpath for a config file
has comment: http://stackoverflow.com/comment/38709921
has answer: http://stackoverflow.com/a/24914759
score: 0
answer count: 3
has body: I have a jar file and a config file which is required to execute in the same directory on a unix box. How do I set the classpath to the config file while executing the jar? i.e something.jar and something.config are in the same directory say dir1. I navigate to dir1 and run the following command dir1&gt; java -cp something.config -jar something.jar But the jar is not able to find something.config file.
tagged with: jar

http://stackoverflow.com/a/32434817
has body: Thank You, @peeskillet and @Nir Sivan, for your answers. But I was able to make it work without using the LinkAdapter or ContextResolver&lt;ObjectMapper&gt;. I just added a instance variable of the custom Link type (here ResourceLink which is analogous to your LinkJaxb) to my entity class as a @Transient property and after that Jackson configuration automatically included that attribute in the Response JSON Resource Link - Class import javax.xml.bind.annotation.XmlAttribute; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude.Include; @JsonInclude(Include.NON_EMPTY) public class ResourceLink { private String uri; private String rel; public ResourceLink() { this (null, null); } public ResourceLink(String uri) { this(uri, null); } public ResourceLink(String uri,String rel) { this.uri = uri; this.rel = rel; } @XmlAttribute(name = "href") public String getUri() { return uri; } @XmlAttribute(name = "rel") public String getRel(){return rel;} public void setUri(String uri) { this.uri = uri; } } Entity Class package com.bts.entities; import java.util.ArrayList; import java.util.List; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; import javax.persistence.Table; import javax.persistence.Transient; import com.bts.rs.root.util.ResourceLink; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude.Include; @Entity @Table(name="cities") @JsonInclude(Include.NON_EMPTY) public class City { @Id @Column(name="city_id") private Integer cityId; @Column(name="name") private String name; @Column(name="status") private int status; @Column(name="del_status") private int delStatus; @Transient List&lt;ResourceLink&gt; links = new ArrayList&lt;ResourceLink&gt;(); // private public City () { } public City (Integer id, String name) { this.cityId = id; this.name = name; this.status = 0; this.delStatus = 0; }…
type: Answer
answers question: http://stackoverflow.com/q/24968448
has comment: http://stackoverflow.com/comment/87261123
score: 0

http://stackoverflow.com/comment/123068554
comment on: http://stackoverflow.com/a/32719598
type: AnswerComment
score: 0
type: Comment
has text: Side note: This solution can also be used if `constant` is declared in a `th:each` in the same element. However, extracting the `name()` call to a `th:with` within the same element breaks it. Currently not sure what the issue is - using a `th:each` variable in a `th:with`, using that `th:with` in a conditional, or the combination of both.

http://stackoverflow.com/comment/38815959
has text: @HotLicks I have reopened it. Now you are free to answer it.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24971120
score: 0

http://stackoverflow.com/comment/38956686
score: 1
has text: @Sid: You should look around in the documentation for basic guides and references. For example, you can find out details about how to provide external resources for multiple configurations [here](http://developer.android.com/guide/topics/resources/providing-resources.html). You should also consider acquiring a good book on Android development if you're new to it - there are lots of new concepts involved, although you might not encounter most of them. Unfortunately, I can't give you any specific current recommendations, as it's been a long while since I started Android development.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25000611

game-loop
tag name: game-loop
tags question: http://stackoverflow.com/q/24965168
type: Tag

http://stackoverflow.com/q/25039074
answer count: 6
has answer: http://stackoverflow.com/a/25039997
has answer: http://stackoverflow.com/a/25039769
score: 0
has answer: http://stackoverflow.com/a/25040067
has answer: http://stackoverflow.com/a/25040045
type: UnansweredQuestion
tagged with: android
has body: I am developing an app that loops for several hours or even maybe days and what I want is that it loops past the current day into the next it creates a new file with a new file name. Can anyone help me with the logic ? Here is my code: timedata= new File(timedata) String timedatafile= "/sdcard/timedata"+"-"+formattedDate+".csv"; if(MsureData.exists()!=true) { timedata.createNewFile(); Calendar c = Calendar.getInstance(); String formattedDate = df.format(c.getTime()); // do stuff }
has answer: http://stackoverflow.com/a/25039474
tagged with: java
has comment: http://stackoverflow.com/comment/38944394
type: Question
has answer: http://stackoverflow.com/a/25039599
has title: Create a new file everyday
has comment: http://stackoverflow.com/comment/38943859
has comment: http://stackoverflow.com/comment/38944083

http://stackoverflow.com/q/25050792
score: 1
tagged with: java
tagged with: hibernate
tagged with: orm
upvote count: 1
type: Question
has title: Session.contains return false for object that load by OneToMany relation
has body: consider there exists two object Aand B where A contains a OneToMany relation with B. I Load Object A and iterate on its Bs. but the problem is that when i call Session.contains(B[0]) it returns false. in previous session i had load object b (b=B[0]) and in this session before loading object A I have called b2=Session.merge(b) and here when i load Object A again, it fills B field with b instead of b2; does any body know why it fills B with b instead of b2?
tagged with: session
downvote count: 0
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/25052196
type: UnansweredQuestion
tagged with: hibernate-mapping

http://stackoverflow.com/q/25020351
has comment: http://stackoverflow.com/comment/38910619
favorite count: 0
has comment: http://stackoverflow.com/comment/38909899
has comment: http://stackoverflow.com/comment/38913429
has comment: http://stackoverflow.com/comment/38910233
has body: I have the following code. And you can see its output below. As I think by javadoc socket.read should never hang or whatever and this is an unexpected behavior. Context con = new Context(); con.buf = ByteBuffer.allocate(1024); log.trace("reading.. {}, {}, {}, {}, {}", socket.isConnected(), !socket.isBlocking(), socket.isOpen(), socket.keyFor(selector).isReadable(), socket.keyFor(selector).isValid()); FutureTask&lt;Integer&gt; readTask = new FutureTask&lt;Integer&gt;( new Callable&lt;Integer&gt;() { Context con; Callable&lt;Integer&gt; setContext(Context con) { this.con = con; return this; } public Integer call() throws Exception{ int rd = socket.read(con.buf); return Integer.valueOf(rd); } }.setContext(con) ); ExecutorService exec = Executors.newSingleThreadExecutor(); exec.submit(readTask); int read = 0; try { read = readTask.get(5, TimeUnit.SECONDS); } catch (InterruptedException | ExecutionException | TimeoutException e) { log.error("hello java"); System.exit(0); } (I do not need a futuretask there at all, but it was just to check my assumption about stucking in socket.read method). And here's the log output (notice that !socket.isBlocking() is reversed, so it's showing it's in NON blocking mode): reading.. true, true, true, true, true hello java this means after 5 seconds we still got nothing, socket is still opened, and nothing that could be wrong. Please help me with that issue. Could it be something around socket's "keepalive" or OS or java or firewall (still I'm reading and writing at localhost only) issue? This is how I got this socket: SocketChannel socket = ((ServerSocketChannel) key.channel()).accept(); log.trace("accepted:{}", socket.getRemoteAddress()); socket.configureBlocking(false); socket.register(selector, SelectionKey.OP_READ | SelectionKey.OP_WRITE);
score: 1
has title: Non-blocking socket hangs while reading when it shouldn't
has comment: http://stackoverflow.com/comment/38910073
has comment: http://stackoverflow.com/comment/38911846
linked to: http://stackoverflow.com/q/2896727
answer count: 0
has comment: http://stackoverflow.com/comment/38909957
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38914264
tagged with: sockets
has comment: http://stackoverflow.com/comment/38910059
upvote count: 1
has comment: http://stackoverflow.com/comment/38912271
tagged with: nonblocking
tagged with: java
tagged with: nio
type: Question
has comment: http://stackoverflow.com/comment/38909865
has comment: http://stackoverflow.com/comment/38909809
has comment: http://stackoverflow.com/comment/38911899
has comment: http://stackoverflow.com/comment/38909683
has comment: http://stackoverflow.com/comment/38910337
downvote count: 0

http://stackoverflow.com/q/24970931
type: AnsweredQuestion
tagged with: java
linked to: http://stackoverflow.com/q/7544671
type: Question
upvote count: 2
has answer: http://stackoverflow.com/a/25087030
accepted answer: http://stackoverflow.com/a/25087030
tagged with: rrule
has body: I want to generate a human readable text (natural language) from a RRULE string (RFC2445). I have googled for it, what I have found is only a JavaScript library (rrule.js) which can generate such a text. But I need this functionality in Android (Java). Is there a library wrriten in Java like this ? If not, I heared about a couple of JavaScript engines in Java (Rhino for example) But I'm very worry about my Android app performace because It seems this engines is a bit heavy weight.
tagged with: javascript
possible better answer: http://stackoverflow.com/a/45425426
has answer: http://stackoverflow.com/a/45425426
has answer: http://stackoverflow.com/a/63428636
answer count: 3
has title: RRULE to human readable text
tagged with: android
favorite count: 0
score: 2
downvote count: 0

http://stackoverflow.com/comment/46514469
type: Comment
comment on: http://stackoverflow.com/a/29143328
score: 0
type: AnswerComment
has text: I am only seeing the error in my LogCat in Eclipse. Otherwise, everything works fine.

http://stackoverflow.com/comment/38886046
type: AnswerComment
type: Comment
has text: I am trying to unzip a server response which has been ziped
comment on: http://stackoverflow.com/a/25001113
score: 0

http://stackoverflow.com/a/25026920
score: 0
type: Answer
answers question: http://stackoverflow.com/q/25023996
has body: The message is clear enough. I would do the client connect in blocking mode: then it either completes or fails. Otherwise you have to use a Selector, select for OP_CONNECT, use finishConnect(), test its return value, etc. In fact I would use blocking mode through the client, and I probably wouldn't use NIO at all.

http://stackoverflow.com/q/24993234
has comment: http://stackoverflow.com/comment/38858247
answer count: 1
has comment: http://stackoverflow.com/comment/38858585
has answer: http://stackoverflow.com/a/25001179
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/38858810
accepted answer: http://stackoverflow.com/a/25001179
tagged with: swing
has title: JFileChooser and Next - Previous Button
has body: First of all, I'd like to inform you all that I'm just a beginner and I've tried many thing without any success. I've managed to make a JFrame then a JPanel and inside that JPanel, a JLabel with icon. I can retrieve the picture with the button JFileChooser, the picture is resized to fit the JLabel. My project has exactly 5 files : ImageFilter: used by LoadFiles ImagePreview: used by LoadFiles LoadFiles: JFileChooser class NewJFrame Utils: used by LoadFiles I am using NetBeans IDE and the GUI Builder, I made my class LoadFiles(JFileChooser) so that I just have to drop the class on NewJFrame and the button appears on my JFrame, so that my program can be easily modified (Every class is a module, but yet only one which is LoadFiles) and there is nothing except the variable declared in my NewJFrame. Here is how my program looks like: And I want to add two buttons, Next and Previous to navigate between the pictures I already opened in my JLabel. Class LoadFiles import java.awt.Graphics2D; import java.awt.Image; import java.awt.RenderingHints; import java.awt.event.*; import java.awt.image.BufferedImage; import javax.imageio.ImageIO; import javax.swing.*; import java.io.File; import java.io.IOException; public class LoadFiles extends JButton implements ActionListener { JFileChooser jfc; public LoadFiles() { super("Load"); addActionListener(this); } public void actionPerformed(ActionEvent e) { if (jfc == null) { jfc = new JFileChooser("."); jfc.addChoosableFileFilter(new ImageFilter()); jfc.setAcceptAllFileFilterUsed(false); jfc.setAccessory(new ImagePreview(jfc)); } jfc.setDialogTitle("test"); int result = jfc.showOpenDialog(null); if(result == JFileChooser.APPROVE_OPTION) { File file = jfc.getSelectedFile(); System.out.println(file.getParent()); System.out.println(file.getName()); // Read image and place new file icon into preferred locations BufferedImage newImage = null; try { newImage = ImageIO.read(file); } catch(IOException ex) { System.out.println("red error: " + ex…
tagged with: jfilechooser
type: Question
has comment: http://stackoverflow.com/comment/38858521
score: 0

dagger
tags question: http://stackoverflow.com/q/25025935
tag name: dagger
type: Tag

http://stackoverflow.com/a/38717244
type: Answer
has comment: http://stackoverflow.com/comment/82022873
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/24986776
has body: I use this, public class NodeUtils { public static &lt;T extends Pane&gt; List&lt;Node&gt; paneNodes(T parent) { return paneNodes(parent, new ArrayList&lt;Node&gt;()); } private static &lt;T extends Pane&gt; List&lt;Node&gt; paneNodes(T parent, List&lt;Node&gt; nodes) { for (Node node : parent.getChildren()) { if (node instanceof Pane) { paneNodes((Pane) node, nodes); } else { nodes.add(node); } } return nodes; } } Usage, List&lt;Node&gt; nodes = NodeUtils.paneNodes(aVBoxOrAnotherContainer); This source code uses the references of the existing nodes. It does not clone them.
upvote count: 1

metadata
tags question: http://stackoverflow.com/q/24969101
tags question: http://stackoverflow.com/q/24927283
tag name: metadata
type: Tag
tags question: http://stackoverflow.com/q/24935084

http://stackoverflow.com/q/24980934
type: Question
tagged with: parallel-processing
has title: Is Java fork/join (divide and conquor) possible when inserting line-by-line into MongoDB from InputStream?
linked to: http://stackoverflow.com/q/9455280
tagged with: java
tagged with: mongodb
has body: I list code below which performs batch inserts into MongoDB. This code takes a long time to run--about an hour to insert 20 million Mongo documents. The time consuming portion of the code--the scanner.hasNextLine()--nextLine()--insert loop--runs as slowly as 20 seconds an iteration at times. This slowness becomes pronounced toward the middle of the job, I note. (Answers on this forum indicate that the mongo insert-batch or regular can be expensive, owing to the conversion of json into binary format, bson.) I want to speed up this process. I would like to process this job in parallel on several cores. Can I do this using Fork/join? I ask because I could not see a way how to apply a divide and conquer strategy in the case of this code with its while loop on an input stream. Another possibility is to use the ThreadPoolExecutor. Would use of an executor be best? Would an executor distribute the job over several cores? The code: Scanner lineScan = new Scanner(inputStream, encoding); while (lineScan.hasNextLine() { //add to list of DBObjects to be inserted as a batch //do batch insert here if object-count threshold is reached. } Similar code using a ThreadPoolExecutor ( see Java Iterator Concurrency and Java: Concurrent reads on an InputStream ): ExecutorService executor = Executors.newCachedThreadPool(); Iterator&lt;Long&gt; i = getUserIDs(); while (i.hasNext()) { final Long l = i.next(); Runnable task = new Runnable() { public void run() { someObject.doSomething(l); anotheObject.doSomething(l); } } executor.submit(task); } executor.shutdown(); Any perspectives on which technique might best expedite this loop and insert would be greatly appreciated. Many thanks in advance!
answer count: 1
tagged with: threadpoolexecutor
score: 0
linked to: http://stackoverflow.com/q/16159183
has answer: http://stackoverflow.com/a/24981067
type: UnansweredQuestion
tagged with: multithreading

http://stackoverflow.com/comment/55043027
type: AnswerComment
type: Comment
has text: where did i create this bean?
comment on: http://stackoverflow.com/a/29571677
score: 0

lombok
type: Tag
tag name: lombok
tags question: http://stackoverflow.com/q/25040445

http://stackoverflow.com/comment/38892358
type: AnswerComment
comment on: http://stackoverflow.com/a/25010162
has text: I edit my comment Before. And about the permission. Yes I put it on manifest and I connected to internet
type: Comment
score: 0

http://stackoverflow.com/comment/38886708
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25008620
type: Comment
has text: Also, Serialization and an ORM / database are different things, although there is some overlap. A serialized object represents all of the information needed to "thaw" a persisted object and repopulate its data. An ORM and database persist data to a database. A class can have fields of information that are not stored in the database by the ORM, for example computed field. serialization and an ORM are solving different problems.

http://stackoverflow.com/q/24927587
has title: SWTBot - Wait for MessageBox
upvote count: 1
type: AnsweredQuestion
score: 1
tagged with: java
type: Question
downvote count: 0
has answer: http://stackoverflow.com/a/24933964
favorite count: 0
tagged with: swtbot
answer count: 1
tagged with: shell
has body: I am currently writing SWTBot tests and I encountered the problem that at one point I need to wait until an operation is finished and an Info-MessageBox informs me about the completion. This is how I currently try to do it: public void generateCode() { SWTBotTree projectExplorerTree = bot.viewByTitle("Project Explorer").bot().tree(); projectExplorerTree.getTreeItem(name).contextMenu("Generate Code").click(); bot.waitUntil(Conditions.shellIsActive("Info"), 20000); bot.button(IDialogConstants.OK_LABEL).click(); } This is the message box I am waiting for: But I get the following exception as SWTBot fails to recognize the message box: org.eclipse.swtbot.swt.finder.widgets.TimeoutException: Timeout after: 20000 ms.: The shell 'Info' did not activate at org.eclipse.swtbot.swt.finder.SWTBotFactory.waitUntil(SWTBotFactory.java:412) at org.eclipse.swtbot.swt.finder.SWTBotFactory.waitUntil(SWTBotFactory.java:386) Anyone with a solution for my problem? Thanks!
accepted answer: http://stackoverflow.com/a/24933964
tagged with: messagebox
tagged with: swt

http://stackoverflow.com/q/24961298
tagged with: text
has comment: http://stackoverflow.com/comment/38797762
score: 0
tagged with: java
tagged with: image-processing
answer count: 1
accepted answer: http://stackoverflow.com/a/24961517
has body: How can I add text with outline to image using java.awt.* ? Example below:
tagged with: image
linked to: http://stackoverflow.com/q/7218309
has title: How to add text outline using java.awt.*?
type: AnsweredQuestion
tagged with: awt
has answer: http://stackoverflow.com/a/24961517
type: Question
has comment: http://stackoverflow.com/comment/38814849

http://stackoverflow.com/comment/38973515
has text: What options have you considered. What research have you done? Why didn't what you try work?
comment on: http://stackoverflow.com/q/25054783
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/24955834
upvote count: 1
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/24959158
accepted answer: http://stackoverflow.com/a/24956312
has comment: http://stackoverflow.com/comment/38787225
has comment: http://stackoverflow.com/comment/38787072
has answer: http://stackoverflow.com/a/24956312
downvote count: 0
has body: My app is tabbed, when I start a new activity over the top of the tabs, and press the back button on the phone to return, it returns to the tab I was previously on. When I go back with this intent: Intent intent = new Intent(EditViewerActivity.this, MainActivity.class); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); It doesn't return to the tab I was on before. Is there anyway to get the same behaviour as the back button on the phone in an intent?
favorite count: 0
tagged with: android
has title: Pressing back button on phone has different behaviour to back intent
possible better answer: http://stackoverflow.com/a/24959158
has comment: http://stackoverflow.com/comment/38787194
tagged with: android-intent
has comment: http://stackoverflow.com/comment/38786897
type: AnsweredQuestion
score: 1
tagged with: java

http://stackoverflow.com/comment/38965365
comment on: http://stackoverflow.com/a/25042343
score: 0
type: Comment
has text: this is my path.. I am not setting any JAVA_HOME. i tried by putting lib.exe file inside the jdk bin folder. Its installed now. I set my class path : C:\Users\JavaPrg\Programs;.;C:\Program Files (x86)\Sun Microsystems\JAI Image IO Tools 1.0_01;%classpath% . Do i need to set anything else..?
type: AnswerComment

http://stackoverflow.com/comment/38832917
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24979940
has text: I can not thank you enough, I have managed to solve the first problem.
type: AnswerComment

http://stackoverflow.com/a/25047000
type: Answer
answers question: http://stackoverflow.com/q/24947001
upvote count: 1
score: 1
downvote count: 0
has body: Setting -Xmx &amp; -Xms and PermSize &amp; MaxPermSize to equal sizes will stop the JVM from resizing the heaps based on your requirement. These resizes are expensive as they trigger a Full GC. -server will allow the JVM to make use of Server Compiler which will do more aggressive optimizations before compiling your code to native assembly instructions. Although now-a-days any machine with 2 or more cores and 2GB+ of memory will have server compiler on by default. Increasing the memory doesn't always fix a problem. Sometimes adding more memory will be an overhead. If you need details regarding GC, you can try this link The very reason to tune something is to improve your application's performance and there by achieve your throughput and latency goals.

http://stackoverflow.com/q/24915555
has answer: http://stackoverflow.com/a/24915820
has comment: http://stackoverflow.com/comment/38715197
score: 1
tagged with: java
has title: Native implementation of Process.waitFor method
type: Question
upvote count: 2
tagged with: java-native-interface
answer count: 1
has body: I have used a method waitFor of Process class, to execute some UNIX command. The command is executing successfully but it is returning 2, that according to convention means abnormal termination. I googled and found that it depends on "source code of the program that is outputting this exit code". So I tried to find the source code for waitFor method, I came to know that it is a native method and defined in ProcessImpl class. public native int waitFor(); So I searched for native implementation of this method from here. But I did not found the file that provide me the native implementation of waitFor method. My question is how to find the file in which native implementation of this method is written?
linked to: http://stackoverflow.com/q/6662214
has comment: http://stackoverflow.com/comment/38739045
downvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/38712107
linked to: http://stackoverflow.com/q/18015491
type: UnansweredQuestion

http://stackoverflow.com/q/24958443
has comment: http://stackoverflow.com/comment/38791848
tagged with: java
has comment: http://stackoverflow.com/comment/38791985
has comment: http://stackoverflow.com/comment/38792115
type: Question
has comment: http://stackoverflow.com/comment/38792653
has comment: http://stackoverflow.com/comment/38793646
has comment: http://stackoverflow.com/comment/38792403
has body: I've enabled mvc annotation driven on my project adding to spring servlet xml the following configs: &lt;mvc:annotation-driven&gt; &lt;mvc:argument-resolvers&gt; &lt;bean class="com.test.WebArgumentResolver"/&gt; &lt;/mvc:argument-resolvers&gt; &lt;mvc:message-converters register-defaults="true"&gt; &lt;bean class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter"/&gt; &lt;/mvc:message-converters&gt; &lt;/mvc:annotation-driven&gt; After this changes the jsp page below stopped working: &lt;spring:bind path="list"&gt; &lt;form:select path="maxFrequency"&gt; &lt;form:options items="${status.value}"/&gt; &lt;/form:select&gt; &lt;/spring:bind&gt; &lt;spring:message code="test.property" /&gt; Namely as result I have: Caused by: javax.servlet.jsp.JspException: Type [java.lang.String] is not valid for option items My controller and form: @RequestMapping(method = RequestMethod.GET) public String show(@ModelAttribute("form") AccessForm form, Map&lt;String, Object&gt; model) throws IOException { AccessSettings settings = getAccessSettings(); form.setAlertSettings(settings.getAlertSettings()); form.setMaxFrequency(settings.getMaxFrequency()); return "page"; } public class AccessForm{ public List&lt;Long&gt; getList() { // some custom logic that generate long items } } I've tried to debug this and found that annotation driven enabled ConversionService that try to convert bean properties using formatters from class above. Can someone explain in which way I can disable the default formatters or could you suggest some workarounds to achive the same goals on jsp page.
score: 0
has comment: http://stackoverflow.com/comment/38793107
has title: ConversionService with mvc annotation driven
has comment: http://stackoverflow.com/comment/38807796
has comment: http://stackoverflow.com/comment/38791915
answer count: 0
tagged with: jsp-tags
type: UnansweredQuestion
tagged with: spring
tagged with: spring-mvc

http://stackoverflow.com/comment/38818167
type: AnswerComment
type: Comment
has text: Ah. Don't worry about it. You're always welcome. This is what this website is all about.
comment on: http://stackoverflow.com/a/24971102
score: 1

http://stackoverflow.com/comment/38848892
score: 1
has text: Yes, it means locale (language, culture) specific implementations. What's wrong with [official documentation](http://docs.oracle.com/javase/7/docs/api/java/lang/Throwable.html#getLocalizedMessage())?
comment on: http://stackoverflow.com/q/24988491
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38953697
comment on: http://stackoverflow.com/a/25040761
has text: @leomoe The scaling comes from your implementation in renderToScreen() method: graphicsToScreen.drawImage(image, 0, 0, display.getWidth(), display.getHeight(), null);. If you use drawImage(image, x, y, null) instead, you should get non-scaled display (calculate x/y to center the image on screen or 0,0 to place it top left corner).
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/24967567
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24967630
type: Question
score: 0
tagged with: android
answer count: 1
tagged with: java
has title: Android Navigation Drawer Error
has body: I am trying to do a android navigation drawer. GoogleMap.java public class GoogleMap extends FragmentActivity { // Google Map private com.google.android.gms.maps.GoogleMap map; private String[] drawerListViewItems; private DrawerLayout drawerLayout; private ListView drawerListView; private ActionBarDrawerToggle actionBarDrawerToggle; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); try { // Loading map initilizeMap(); } catch (Exception e) { e.printStackTrace(); } // get list items from strings.xml drawerListViewItems = getResources().getStringArray(R.array.items); // get ListView defined in activity_main.xml drawerListView = (ListView) findViewById(R.id.left_drawer); // Set the adapter for the list view drawerListView.setAdapter(new ArrayAdapter&lt;String&gt;(this, R.layout.drawer_listview_item, drawerListViewItems)); // App Icon drawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); actionBarDrawerToggle = new ActionBarDrawerToggle( this, /* host Activity */ drawerLayout, /* DrawerLayout object */ R.drawable.ic_drawer, /* nav drawer icon to replace 'Up' caret */ R.string.drawer_open, /* "open drawer" description */ R.string.drawer_close /* "close drawer" description */ ); // Set actionBarDrawerToggle as the DrawerListener drawerLayout.setDrawerListener(actionBarDrawerToggle); getActionBar().setDisplayHomeAsUpEnabled(true); // just styling option add shadow the right edge of the drawer drawerLayout.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START); drawerListView.setOnItemClickListener(new DrawerItemClickListener()); } @Override public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); actionBarDrawerToggle.onConfigurationChanged(newConfig); } @Override public boolean onOptionsItemSelected(MenuItem item) { // call ActionBarDrawerToggle.onOptionsItemSelected(), if it returns true // then it has handled the app icon touch…
has answer: http://stackoverflow.com/a/24967630

http://stackoverflow.com/q/25005793
type: UnansweredQuestion
tagged with: eclipse
has comment: http://stackoverflow.com/comment/38881309
tagged with: listview
has answer: http://stackoverflow.com/a/25005844
has title: How to Keep Highlighted ListView Item and Its Status in the Contextual Action Bar during Device Orientation Change
type: Question
tagged with: android
has body: I have a listview implemented with its choice mode set to CHOICE_MODE_MULTIPLE_MODAL. Here is some of the code: listView.setMultiChoiceModeListener(new MultiChoiceModeListener() { private int check = 0; @Override public boolean onPrepareActionMode(ActionMode arg0, Menu arg1) { // TODO Auto-generated method stub return false; } @Override public void onDestroyActionMode(ActionMode arg0) { // TODO Auto-generated method stub adapter.clearSelection(); } @Override public boolean onCreateActionMode(ActionMode arg0, Menu arg1) { // TODO Auto-generated method stub check = 0; MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.context_menu, arg1); return true; } @Override public boolean onActionItemClicked(final ActionMode arg0, MenuItem arg1) { // TODO Auto-generated method stub if ((PinPad.mMediaPlayer != null) &amp;&amp; (!PinPad.mMediaPlayer.isPlaying())) { switch (arg1.getItemId()) { case R.id.item_delete: LayoutInflater inflater = getLayoutInflater(); View dialogLayout = inflater.inflate( R.layout.delete_confirmation, null); final AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder( MainListActivity.this); alertDialogBuilder.setView(dialogLayout); final AlertDialog confirmationDialog = alertDialogBuilder .create(); confirmationDialog.show(); Button buttonNo = (Button) dialogLayout .findViewById(R.id.buttonNo); Button buttonYes = (Button) dialogLayout .findViewById(R.id.buttonYes); buttonNo.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { // TODO Auto-generated method stub weGotTheTime.clear(); weGotTheType.clear(); weGotTheDays.clear(); weGotTheRings.clear(); weGotTheIDs.clear(); confirmationDialog.dismiss(); adapter.clearSelection(); adapter.notifyDataSetChanged(); refreshListView(); check = 0; arg0.finish(); } }); buttonYes .setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub databaseData.open(); databaseData.deleteEntries( weGot…
score: 0
tagged with: java
answer count: 1
has comment: http://stackoverflow.com/comment/38881565
tagged with: android-arrayadapter

http://stackoverflow.com/q/25055111
type: UnansweredQuestion
tagged with: android
has title: Uploading to amazon s3 while no internet android
has answer: http://stackoverflow.com/a/25055216
type: Question
tagged with: network-programming
tagged with: amazon-s3
tagged with: java
has body: Hello i just started to using AWS S3 and still getting familiar with the sdk for android. i am intrested in the next scenario: User tries to upload image but there is no internet connection, is there any way the api offers so the picture will be uploaded when the user opens the app some other time with internet connection. like upload eventualy when you get internet connection.
score: 0
answer count: 1

http://stackoverflow.com/a/24973865
type: Answer
has comment: http://stackoverflow.com/comment/38899046
has comment: http://stackoverflow.com/comment/38822496
has body: The error came out to be what you mentioned in the comment and not in the question exactly.It is related to your import. Try import java.io.FileInputStream; and import org.apache.poi.xwpf.usermodel.XWPFDocument; EDIT :- InputStream in = new FileInputStream(chooser.getSelectedFile()); XWPFDocument doc = new XWPFDocument(in); Saving your application, and compiling it afresh would solve your purpose. Next thing which I found is that you have given your class name as read.That's poor way of naming class! You shouldn't do that because that doesn't conform to the Java naming convention. Rename your class to something like MyReadClass. Comment below as to what you got after performing these operations.If successful,please accept the answer...
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/38821494
answers question: http://stackoverflow.com/q/24973720
has comment: http://stackoverflow.com/comment/38823550
accepted answer of: http://stackoverflow.com/q/24973720
has comment: http://stackoverflow.com/comment/38848869
has comment: http://stackoverflow.com/comment/38821382
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/38830172
has comment: http://stackoverflow.com/comment/38821578
has comment: http://stackoverflow.com/comment/38830933
has comment: http://stackoverflow.com/comment/38876134
has comment: http://stackoverflow.com/comment/38821321

http://stackoverflow.com/comment/38967097
comment on: http://stackoverflow.com/q/25051291
type: Comment
type: QuestionComment
has text: Check out my ans here : http://stackoverflow.com/questions/2471935/how-to-load-an-imageview-by-url-in-android/24134425#24134425
score: 0

http://stackoverflow.com/a/24958102
type: Answer
answers question: http://stackoverflow.com/q/24957920
has body: I would suggest that you avoid creating new columns, and instead create a new table that will contain one entry for each of what would have been the new columns. I'm assuming here that the new columns would be menu items. So you would have a "menu" table with these columns: id file and you would have a "menuitem" table which would contain one entry for each of your menu items: id value onclick So instead of adding columns dynamically, you would be adding records.
score: 1
upvote count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/63804581

http://stackoverflow.com/a/24910804
upvote count: 0
has comment: http://stackoverflow.com/comment/38702857
answers question: http://stackoverflow.com/q/24910537
type: Answer
has comment: http://stackoverflow.com/comment/38702754
downvote count: 1
score: -1
has body: **Code 1 - Line 1: Does the literal "Hello" in the constructor get placed in the constant pool before the String constructor is called?** Yes, because constructor is used to instantiate the object. ****Code 1 - Line 2: Does "Hello" already exist in the pool at line 2 or is it inserted at this line?**** **it is already there **. it is not inserted by this line. you can check by like this. String s=new String("hello"); String s1=s.intern(); String s2 = new String("hello"); String s3= s2.intern(); if (s1==s3) { System.out.println("true"); } if (s==s2) {System.out.println("false");} Code 2 - Line 2: Is the author wrong when she says that "Summer" is placed in the pool at line 2? NO. summer will not be placed at the constant pool because it is already there code2-line1 will place "summer" there.
has comment: http://stackoverflow.com/comment/38703073

http://stackoverflow.com/a/24935765
type: Answer
has body: If your ID is, for example, 1234, then you would need to have your app do this to the database: update MyTable set State = 0 where ID = 1234 then: select State, other_field_1, other_field_2, other_field_N from MyTable where ID = 1234 There is no way in SQL to both update a record and select the updated record in one step.
downvote count: 0
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/24935478

http://stackoverflow.com/q/24953306
score: -7
has comment: http://stackoverflow.com/comment/38782667
upvote count: 3
tagged with: java
answer count: 1
has comment: http://stackoverflow.com/comment/38782515
has comment: http://stackoverflow.com/comment/38782678
has answer: http://stackoverflow.com/a/24954016
has comment: http://stackoverflow.com/comment/38783160
has comment: http://stackoverflow.com/comment/38782398
downvote count: 10
has body: I have written the basic logic to match 2D array, but the result are bit unexpected if(mat1[i][j] == mat2[i][j]) //what this line do public static final int[][] n_1 = {{10,12,6,-1,-1},{-1,0,8,2,-1},{0,0,0,-1,0},{0,0,0,0,0},{-1,9,0,0,-1}}; public static final int[][] n_2 = {{13,-1,9,6,0},{0,-1,-1,0,0},{0,0,0,0,0},{-1,4,7,-1,0},{-1,2,8,0,0}}; public static final int[][] n_3 = {{-1,0,0,-1,-1},{0,0,0,11,-1},{0,0,0,5,-1},{8,0,0,0,13},{10,-1,6,4,0}}; public static final int[][] n_4 = {{10,8,0,1,-1},{13,0,0,3,-1},{0,0,0,-1,-1},{0,0,5,0,-1},{7,0,0,0,-1}}; public static final int[][] n_5 = {{-1,0,0,6,0},{-1,0,0,0,0},{12,0,5,-1,0},{0,0,3,-1,0},{4,-1,-1,-1,1}}; public static int[][][] arrayFive = {n_1,n_2,n_3,n_4,n_5}; public static int [][] return5(){ Random r = new Random(); return arrayFive[r.nextInt(arrayFive.length)]; } public boolean checkEqual(int[][] mat1,int[][] mat2){ boolean b = true; for(int i = 0;i&lt;mat1.length;i++){ for(int j=0;j&lt;mat1.length;j++){ if(mat1[i][j] == mat2[i][j]){ b = b &amp; true; } else{ b = b &amp;false; } } } return b; }
type: AnsweredQuestion
favorite count: 0
tagged with: logic
has comment: http://stackoverflow.com/comment/38782856
accepted answer: http://stackoverflow.com/a/24954016
type: Question
has title: Code is not giving expected result in sudoku
tagged with: sudoku

http://stackoverflow.com/a/24954867
has body: Assuming you have an object CommentSummary with constructor that takes parameters source, category and count, you might try with: SELECT NEW x.y.z.CommentSummary(c.source, c.category, count(c.category)) FROM Comments c GROUP BY c.source, c.category CommentSummary object: package x.y.z; public class CommentSummary { private String source; private String category; private int categoryCount; // attribute getters/setters public CommentSummary(String source, String category, int count) { this.source = source; this.category = category; this.count = count; } }
type: Answer
answers question: http://stackoverflow.com/q/24939621
has comment: http://stackoverflow.com/comment/38786007
has comment: http://stackoverflow.com/comment/38785581
score: 0
has comment: http://stackoverflow.com/comment/38785469

session
tags question: http://stackoverflow.com/q/25001866
tags question: http://stackoverflow.com/q/24978143
tags question: http://stackoverflow.com/q/24925367
tags question: http://stackoverflow.com/q/25015856
tags question: http://stackoverflow.com/q/24914370
type: Tag
tags question: http://stackoverflow.com/q/25050792
tags question: http://stackoverflow.com/q/25058745
tags question: http://stackoverflow.com/q/24926661
tags question: http://stackoverflow.com/q/25045642
tag name: session
tags question: http://stackoverflow.com/q/25052679
tags question: http://stackoverflow.com/q/24995677
tags question: http://stackoverflow.com/q/25058024

http://stackoverflow.com/q/25028175
score: 0
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/25028211
has answer: http://stackoverflow.com/a/25028213
answer count: 3
has answer: http://stackoverflow.com/a/25028208
tagged with: android
has title: How to use a variable in java within xml in Android Studio?
has body: I am trying to make a score counter by using a TextView. I have set the text to "0" and want it to increase every time that a button is pressed. How can I accomplish this? So far I am trying to call a variable from in the java of the activity but I do not know how to call the variable from within xml. Or change the value of the xml from java. Any help is much appreciated and thanks in advance. &lt;TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:textAppearance="?android:attr/textAppearanceLarge" android:text="0" android:id="@+id/score" android:textSize="30sp" android:textColor="@color/black_overlay" android:layout_below="@+id/adView" android:layout_centerHorizontal="true" /&gt; That is my xml and I currently have nothing written in the java portion other than setting up the onclick method. public void buttonOnClick (View view) { Toast.makeText(getApplicationContext(), "Click", Toast.LENGTH_SHORT).show(); //String yourString = this.getResources().getString(R.string.scoreCount); String mystring = getResources().getString(R.string.scoreCount); }
tagged with: http://stackoverflow.com/tag/xml
has comment: http://stackoverflow.com/comment/38923834
type: UnansweredQuestion

http://stackoverflow.com/q/25053703
upvote count: 2
score: 1
tagged with: java
downvote count: 1
type: Question
tagged with: android-widget
has answer: http://stackoverflow.com/a/25054134
tagged with: homescreen
answer count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/25054134
tagged with: android
has title: Widget like facebook messenger in home screen
has body: hi I want create a widget for my app like facebook messenger But I do not know how to do
type: AnsweredQuestion

http://stackoverflow.com/a/24936178
has body: Something like this might help you out public class UserValidator implements Validator { @Override public boolean supports(Class clazz) { return User.class.equals(clazz); } @Override public void validate(Object target, Errors errors) { User user = (User) target; if(user.getName() == null) { errors.rejectValue("name", "your_error_code"); } // do "complex" validation here } } Then in your controller you would have : @RequestMapping(value="/user", method=RequestMethod.POST) public createUser(Model model, @ModelAttribute("user") User user, BindingResult result){ UserValidator userValidator = new UserValidator(); userValidator.validate(user, result); if (result.hasErrors()){ // do something } else { // do something else } } If there are validation errors, result.hasErrors() will be true. Note : You can also set the validator in a @InitBinder method of the controller, with "binder.setValidator(...)" . Or you could instantiate it in the default constructor of the controller. Or have a @Component/@Service UserValidator that you inject (@Autowired) in your controller : very useful, because most validators are singletons + unit test mocking becomes easier + your validator could call other Spring components.
answers question: http://stackoverflow.com/q/24935893
score: 0
type: Answer

http://stackoverflow.com/q/25059196
has comment: http://stackoverflow.com/comment/39183791
accepted answer: http://stackoverflow.com/a/25213915
has comment: http://stackoverflow.com/comment/39203064
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39195729
has comment: http://stackoverflow.com/comment/39157704
tagged with: java
has comment: http://stackoverflow.com/comment/39157800
type: Question
upvote count: 15
possible better answer: http://stackoverflow.com/a/25205727
tagged with: nginx
tagged with: apache
has answer: http://stackoverflow.com/a/25205727
tagged with: ssl
score: 15
has answer: http://stackoverflow.com/a/25213915
answer count: 2
has comment: http://stackoverflow.com/comment/39117334
has comment: http://stackoverflow.com/comment/39117688
downvote count: 0
has body: UPDATE: 04 Jan 2015 I still have these issues. Users of our app have increased and I see all kind of network errors. Our app sends out emails everytime there is a network related error on app. Our app does a financial transactions - so re-submits are not really idempotent - so very scared of enabling HttpClient's retry feature. we have done some kind of response caching on server to handle re-submits done explicitly by user. However, still no solution that works without bad user experience. Original Question I have an android app which posts data as part of user operation. The data includes few images &amp; I package them as Protobuf message (byte array, in effect) and post it to server over HTTPS connection. Though the app works fine for most part, but we are seeing connection errors occasionally. The issue has become more pronounced now that we have some users in relatively slow network areas (2G connections). However, the issue is not limited to slow connections areas, issue is seen with customers using WiFi and 3G connections. Here are few exceptions we notice in our App logs Below one happens after 5 minutes, as I had set Socket timeout to 5 minutes. The app was trying to post 145kb of data in this case Stack trace java.net.SocketTimeoutException: Read timed out at org.apache.harmony.xnet.provider.jsse.NativeCrypto.SSL_read(Native Method) at org.apache.harmony.xnet.provider.jsse.OpenSSLSocketImpl$SSLInputStream.read(OpenSSLSocketImpl.java:662) at org.apache.http.impl.io.AbstractSessionInputBuffer.fillBuffer(AbstractSessionInputBuffer.java:103) at org.apache.http.impl.io.AbstractSessionInputBuffer.readLine(AbstractSessionInputBuffer.java:191) Below one happened 2.5 minutes ( socket timeout was set to 5 minutes), client was sending 144kb of data javax.net.ssl.SSLException: Write error: ssl=0x5e4f4640: I/O error during system call, Broken pipe at org.apache.harmony.xnet.provider.jsse.NativeCrypto.SSL_write(Native Method) at org.apache.harmony.xnet.provider.jsse.Op…
linked to: http://stackoverflow.com/q/37885391
favorite count: 0
has comment: http://stackoverflow.com/comment/39203380
has title: Variety of HTTPs errors while communicating to server from Android App
tagged with: android

http://stackoverflow.com/comment/38827193
type: Comment
has text: you need an instance to call the validate method on. fyi...
comment on: http://stackoverflow.com/a/24977056
type: AnswerComment
score: 0

http://stackoverflow.com/a/25027684
score: 2
has body: You could create a class which it's sole purpose would be to provide rest interface classes. Here's the interface / implementation public interface RestApiProvider { public &lt;T&gt; T getRestClient(Class&lt;T&gt; clazz); } public class RestApiProviderImpl implements RestApiProvider { private Map&lt;String, Object&gt; restInstances = new HashMap&lt;String, Object&gt;(); private RestAdapter restAdapter; @Inject RestApiProvider(RestAdapter restAdapter) { this.restAdapter = restAdapter; } public &lt;T&gt; T getRestClient(Class&lt;T&gt; clazz) { T client = null; if ((client = (T) restInstances.get(clazz.getCanonicalName())) != null) { return client; } client = restAdapter.create(clazz); restInstances.put(clazz.getCanonicalName(), client); return client; } } In your module you would have @Provides @Singleton public RestAdapter providesRestAdapter() { return new RestAdapter.Builder() .setEndpoint("http://192.168.0.23:9000/api") .setLogLevel(RestAdapter.LogLevel.FULL).build(); } @Provides @Singleton public RestApiProvider providesRestApiProvider(RestApiProviderImpl impl) { return impl; } The way this works is the the RestAdapter Provider from your module would be used as dependency in your RestApiProviderImpl instance. Now anywhere you'd need to get a RestApi class instance you'd simply need to inject your RestApiProvider. @Inject RestApiProvider restApiProvider; // Somewhere in your code RestApiClassOfSomeSort instance = restApiProvider.getRestClient(RestApiClassOfSomeSort.class); instance.// do what you need!
accepted answer of: http://stackoverflow.com/q/25025935
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/25025935
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/38923973
has comment: http://stackoverflow.com/comment/38924302

http://stackoverflow.com/comment/38702112
type: AnswerComment
comment on: http://stackoverflow.com/a/24909666
score: 0
type: Comment
has text: When i set as program arguement ,it is treating as file and getting java.io.FileNotFoundException C:\workspace\test\-DFOO=bar

rpc
tag name: rpc
tags question: http://stackoverflow.com/q/24991275
type: Tag
tags question: http://stackoverflow.com/q/25047938

http://stackoverflow.com/comment/38937067
has text: @Bart I just put a debugging break point in the constructor of the class I would like to have constructed and see it is not be called.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25035009
score: 0

http://stackoverflow.com/a/24977787
has body: This is not doing what you want. Please use a stack switch statement: for(int j = 0; j &lt; str.length(); j++) switch(str.charAt(j)) { case 'a': case 'e': case 'i': case 'o': case 'u': count++; } Or, since I'm a regex enthusiast, here's an approach using regular expressions! :) Matcher matcher = Pattern.compile("[aeiou]").matcher(str); while(matcher.find()) count++; There was a mistake in this code fixed later on, thanks to user2980077
score: 30
accepted answer of: http://stackoverflow.com/q/24977783
answers question: http://stackoverflow.com/q/24977783
has comment: http://stackoverflow.com/comment/38829115
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/39182397
upvote count: 30
type: Answer

http://stackoverflow.com/comment/38865517
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24997414
has text: "I want to copy another variable's value into another variable and then have the newly created variable preserve that value." This is what Java does and Java doesn't support any other approach. It can't do what you say you don't want (Unlike C++ which can do it if you really want to, but not by default)
score: 0

http://stackoverflow.com/a/25005206
type: Answer
accepted answer of: http://stackoverflow.com/q/25004913
downvote count: 0
score: 1
upvote count: 1
type: AcceptedAnswer
has body: In order to bind the options property/collection correctly your parameters should be posted with element names like: options.optionText. Otherwise it's going to expect you are posting ids and try and locate the QuestionOptionSurvey matching those ids.
answers question: http://stackoverflow.com/q/25004913

http://stackoverflow.com/a/25063225
has comment: http://stackoverflow.com/comment/38994331
accepted answer of: http://stackoverflow.com/q/25063150
downvote count: 0
answers question: http://stackoverflow.com/q/25063150
has comment: http://stackoverflow.com/comment/38995173
has comment: http://stackoverflow.com/comment/38993978
has comment: http://stackoverflow.com/comment/38994157
has comment: http://stackoverflow.com/comment/38989374
score: 4
type: AcceptedAnswer
has body: I1 clearly defines a method that returns a type of List&lt;I2&gt;. You can't change that for any reason in the implementing class, to return List&lt;Class2&gt;; that's the whole point of an interface. Your contract for implementing I1 forces you to return a type of List&lt;I2&gt; under any circumstance. Apart from the restriction that the interface implementation places on you, you should also know that "generics" are not forgiving; the I2 in List&lt;I2&gt; cannot be cast to anything else. Not even a class in the same hierarchy. The typesafety provided by java is quite strict in that regard Consider this: Class2 is-a I2 List&lt;Class2&gt; defines a typesafe collection of Class2s List&lt;I2&gt; defines a typesafe collection of I2s Java will not, at any point allow List&lt;Class2&gt; be substituted for List&lt;I2&gt;. Not in a variable declaration, a method argument or method return value
has comment: http://stackoverflow.com/comment/38989395
type: Answer
upvote count: 4

http://stackoverflow.com/q/24960385
has comment: http://stackoverflow.com/comment/38795817
linked to: http://stackoverflow.com/q/1899683
has comment: http://stackoverflow.com/comment/38795808
type: AnsweredQuestion
tagged with: java
has body: I am reading Uncle Bob's Clean Code. In chapter 16, the book shows how to refactor an example. There is one part that I cannot catch the purpose of writing in such way. What the purpose of using protected keyword here? Why do some methods like _getMinimumYear() start with an underscore? Why do use a pair of method with same name rather than an abstract method like public abstract int getMinimumYear(); public abstract class DayDateFactory { private static DayDateFactory factory = new SpreadsheetDateFactory(); public static void setInstance(DayDateFactory factory) { DayDateFactory.factory = factory; } protected abstract DayDate _makeDate(int ordinal); protected abstract DayDate _makeDate(int day, Month month, int year); protected abstract DayDate _makeDate(int day, int month, int year); protected abstract DayDate _makeDate(java.util.Date date); protected abstract int _getMinimumYear(); protected abstract int _getMaximumYear(); public static DayDate makeDate(int ordinal) { return factory._makeDate(ordinal); } public static DayDate makeDate(int day, Month month, int year) { return factory._makeDate(day, month, year); } public static DayDate makeDate(int day, int month, int year) { return factory._makeDate(day, month, year); } public static DayDate makeDate(java.util.Date date) { return factory._makeDate(date); } public static int getMinimumYear() { return factory._getMinimumYear(); } public static int getMaximumYear() { return factory._getMaximumYear(); } } public class SpreadsheetDateFactory extends DayDateFactory { public DayDate _makeDate(int ordinal) { return new SpreadsheetDate(ordinal); } public DayDate _makeDate(int day, Month month, int year) { return new SpreadsheetDate(day, month, year); } public DayDate _makeDate(int day, int month, int year) { return new SpreadsheetDate(day, month, year); } public DayDate _makeDate(Date date) { final GregorianCalendar calendar = new GregorianCalendar(); calendar.setTime(date); return new SpreadsheetDate( calendar.get(Calenda…
has comment: http://stackoverflow.com/comment/38796136
type: Question
has comment: http://stackoverflow.com/comment/38864973
linked to: http://stackoverflow.com/q/8689964
downvote count: 0
score: 4
favorite count: 0
has answer: http://stackoverflow.com/a/24960518
accepted answer: http://stackoverflow.com/a/24960518
has comment: http://stackoverflow.com/comment/38799730
answer count: 1
upvote count: 4
has title: Clean Code - what's the purpose of protected method starting with an underscore?

http://stackoverflow.com/comment/38965978
comment on: http://stackoverflow.com/a/25050658
has text: Google for set Marquee property for textview, you will get good blogs
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/39051090
type: Comment
type: QuestionComment
has text: The resume column contains the binary data and filename column is the name of the file which is a varchar data type. Btw, any type of file can be stored in the database. But I am focusing on documents only.
comment on: http://stackoverflow.com/q/25050376
score: 0

http://stackoverflow.com/q/24928851
has answer: http://stackoverflow.com/a/24930624
type: UnansweredQuestion
tagged with: spring
has title: executing requests parallelly with http-outbound-gateway
type: Question
has body: I need to execute a lot of http requests on a specific domain with different query paramerters and I am planning to use outbound-gateway of spring integration with configuration similar to below snippet: &lt;int-http:outbound-gateway id="httpOutboundGateway" request-channel="requestChannel" url="http://www.google.com" http-method="GET" reply-channel="responseChannel" expected-response-type="java.lang.String" charset="UTF-8" reply-timeout="5000" message-converters="" &gt; &lt;/int-http:outbound-gateway&gt; I want to execute the requests in request-channel parallelly using some thread pool. I have the following questions in this context: Will configuring the request-channel as ExecutorChannel automatically executes requests in parallel. If the answer to question 1 is yes, is it http:outbound-gateway thread safe. If the answer to question 1 is no, how to configure to execute http requests in parallel
tagged with: spring-integration
tagged with: java
score: 0
answer count: 1

http://stackoverflow.com/a/24921455
has body: HashSet is the correct collection for my case. It won't call equals while adding elements unless there is hashCode match. That way I can still use my equals methods for my specific purpose.
type: Answer
score: 0
accepted answer of: http://stackoverflow.com/q/24920563
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24920563

http://stackoverflow.com/comment/38875856
type: Comment
comment on: http://stackoverflow.com/a/25002809
has text: @arshajii I am not saying it should use the methods, but it does. even the constructors and the static initializer block. !?
score: 0
type: AnswerComment

http://stackoverflow.com/comment/60838424
comment on: http://stackoverflow.com/a/28447167
score: 0
type: Comment
has text: I was facing this problem for 3 days and this was the ideal sotlution. The main cause was the conflict conflict between the file **jasperreports_extension.properties** after create the big jar the last one override all previous file with the same name.
type: AnswerComment

http://stackoverflow.com/comment/38959045
has text: I already had an ASTVisitor visiting `ConditionalExpression`s. I tried it about 50 times with no success. Now that you proposed using it, I retried running my already existing code - and it works! I don't know why, I don't know how - but that doesn't matter. Thank you!
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25031313

http://stackoverflow.com/q/24960420
type: Question
upvote count: 2
tagged with: android
has comment: http://stackoverflow.com/comment/38809529
tagged with: java
has comment: http://stackoverflow.com/comment/38795816
answer count: 1
has comment: http://stackoverflow.com/comment/38795898
tagged with: android-layout
has title: How to view my whole layout when my content goes off the screen?
has body: So, I know this may be a very simple question but, I have my layout in a scroll view. Everything works fine, but when I go to the Graphical layout tab in my xml file, it shows everything that would fit on the screen and not the rest of my content. How do I scroll up and down or view my whole layout in the graphical tab without having to constantly update the app on my phone and seeing whether everything is laid out the way I want it?
type: UnansweredQuestion
score: 2
has answer: http://stackoverflow.com/a/24961811
downvote count: 0
has comment: http://stackoverflow.com/comment/38795813
favorite count: 0

spring-security
tags question: http://stackoverflow.com/q/25049404
tags question: http://stackoverflow.com/q/24926646
tags question: http://stackoverflow.com/q/24917583
type: Tag
tags question: http://stackoverflow.com/q/25036671
tags question: http://stackoverflow.com/q/24967452
tags question: http://stackoverflow.com/q/24922873
tags question: http://stackoverflow.com/q/25017285
tags question: http://stackoverflow.com/q/24983046
tags question: http://stackoverflow.com/q/24948651
tags question: http://stackoverflow.com/q/25015629
tags question: http://stackoverflow.com/q/24912735
tags question: http://stackoverflow.com/q/25057591
tags question: http://stackoverflow.com/q/25058112
tags question: http://stackoverflow.com/q/25059684
tags question: http://stackoverflow.com/q/25055338
tags question: http://stackoverflow.com/q/25011420
tags question: http://stackoverflow.com/q/24948882
tags question: http://stackoverflow.com/q/24912099
tags question: http://stackoverflow.com/q/24912146
tags question: http://stackoverflow.com/q/24992373
tags question: http://stackoverflow.com/q/25035125
tags question: http://stackoverflow.com/q/25004081
tag name: spring-security
tags question: http://stackoverflow.com/q/25032751
tags question: http://stackoverflow.com/q/25061918
tags question: http://stackoverflow.com/q/25017242

http://stackoverflow.com/comment/38800265
has text: Is the path accessible to Jenkins? Take a look at [this](http://stackoverflow.com/questions/8185593/jenkins-specifying-java-home)
comment on: http://stackoverflow.com/q/24962451
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/a/25041669
type: Answer
downvote count: 1
has body: try changing your equals method to this @Override public boolean equals(Object obj) { if (obj == null) //first you check if object is null return false; if (getClass() != obj.getClass()) // then you check if object is of the same class return false; Person other = (Person) obj; if (name == null) { if (other.name != null) return false; } else if (!name.equals(other.name)) return false; return true; } the statement if (this == obj) checks the objects by address in memory. Address in memory of every object will be different! if you used new on the object
has comment: http://stackoverflow.com/comment/38949179
has comment: http://stackoverflow.com/comment/38949302
score: -1
answers question: http://stackoverflow.com/q/25041593
upvote count: 0

http://stackoverflow.com/comment/38796364
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24960280
has text: (Add additional info into the question.)

http://stackoverflow.com/comment/38925323
comment on: http://stackoverflow.com/q/25028816
has text: I guess every search engine can answer this (too broad) question in minutes.
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/38970373
comment on: http://stackoverflow.com/q/25052818
score: 0
has text: logically doesn't make sense to re-read same file again and again. Still make use of multi-threading and schedule thread to run every minute.
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25034425
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38935665
accepted answer of: http://stackoverflow.com/q/25034352
has comment: http://stackoverflow.com/comment/38934897
answers question: http://stackoverflow.com/q/25034352
type: Answer
has body: It gives me an array of type Vector with each index holding a Settings array No, as shown in your debugger, it returns a Vector that only contains one element (the one you want). Just retrieve that object and use getters to read its columns. Settings settings = (Settings)results.get(0); long batLow = settings.getBatLow(); long batUp = settings.getBatUp(); ...

http://stackoverflow.com/comment/134122839
type: QuestionComment
comment on: http://stackoverflow.com/q/24945356
type: Comment
has text: The real reason is that the market demand for floating point exponentiation is vastly greater than the demand for integer exponentiation in the upper ranges of the `long` type. And `BigInteger.pow` exists for larger integer needs.
score: 0

http://stackoverflow.com/a/24989244
answers question: http://stackoverflow.com/q/24988797
score: 2
has comment: http://stackoverflow.com/comment/38851830
upvote count: 2
downvote count: 0
type: Answer
has body: Don't use a null layout. Always use a proper layout manager. As has been already suggested, consider using a CardLayout While adding/removing child components from a parent which is already visible, invoke parent#revalidate() and parent#repaint() (in that order) after the code which removes/adds the children

http://stackoverflow.com/comment/38840275
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24984016
has text: What are INSERT privileges ?

http://stackoverflow.com/a/24973455
has comment: http://stackoverflow.com/comment/38821201
answers question: http://stackoverflow.com/q/24973394
accepted answer of: http://stackoverflow.com/q/24973394
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: Different array objects have different hashCode() values even if their contents are equal. Offhand, I can't think of anything better than to wrap the arrays into a class and to hash all wrapped arrays using a hashCode based on the value and the Arrays.equals as an equals. This would be O(n) as opposed to searching for duplicates in a nested loop (O(n^2)).
upvote count: 2
has comment: http://stackoverflow.com/comment/38821053
score: 2

http://stackoverflow.com/q/24995266
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/24995964
favorite count: 0
tagged with: multithreading
accepted answer: http://stackoverflow.com/a/24995964
upvote count: 1
type: AnsweredQuestion
score: 1
tagged with: java
type: Question
has title: Updating a label from within a separate thread
has body: I just recently picked up Java and I've been working on a time keeping app (we all have those dreaded time sheets to fill in these days...). I've been making good progress and finding the Window Builder in Eclipse pretty awesome but I've been stumped completely by the last thing on my todo list. I am trying to update a label on the UI with a time string that I've calculated based on a start timestamp minus a current timestamp which is calculated every second. This will represent how much time the current task is taking. This is my code so far and everything else is working apart from updating the label on the UI. It's 20(ish) lines from the bottom of the code. import java.io.FileWriter; import java.io.IOException; import javax.swing.*; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.TableColumn; import org.eclipse.swt.widgets.TableItem; import org.eclipse.swt.SWT; import org.eclipse.swt.widgets.Text; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.wb.swt.SWTResourceManager; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.events.MouseAdapter; import org.eclipse.swt.events.MouseEvent; import org.eclipse.swt.widgets.Table; public class mainDisplay { private static Text txtTask; static boolean timerRunning = false; static long timePassed = 0; static long startTime = 0; static long currTime = 0; static String timeString = ""; /** * Launch the application. * @param args */ public static String timeString(long timePassed) { if(timePassed &lt; 10) { timeString = "00:00:0"+String.valueOf(timePassed); } else if(timePassed &lt; 60 &amp;&amp; timePassed &gt;= 10){ timeString = "00:00:"+String.valueOf(timePassed); } else if(timePassed &gt;= 60 &amp;&amp; timePassed &lt; 600){ timeString = "00:0" + String.valueOf(timePassed/60) + ":"; if(timePassed % 60 &lt; 10){ timeString = timeString + "0"+String.value…
tagged with: label

http://stackoverflow.com/comment/38797220
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24959948
has text: What primefaces-version are you using?

http://stackoverflow.com/comment/38922517
type: Comment
type: QuestionComment
has text: There is no difference between 0.0001 and 1.0e-4. How do you put it in the database?
comment on: http://stackoverflow.com/q/25027467
score: 0

http://stackoverflow.com/comment/38951223
has text: @JonK That might be true, I'll have to look into that, thanks. But that still doesn't fully cover my problem. I want to dynamically create new server instances trough the web interface. This also means I need to start new processes on the server side, which RCON doesn't allow me.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25042849
score: 0

http://stackoverflow.com/a/25036502
upvote count: 1
score: 1
downvote count: 0
type: Answer
has body: Yes, the author is talking about environment variables. You can read environment variables from java code using the following snippet: System.getenv(env); See: http://docs.oracle.com/javase/8/docs/api/java/lang/System.html#getenv-java.lang.String- If you want OS agnostic way, you can use JVM arguments and read using System.getProperties(); For example, if you want a variable called var1 to be passed, use java -Dvar1=true -jar myJar.jar
has comment: http://stackoverflow.com/comment/38938651
answers question: http://stackoverflow.com/q/25036357

http://stackoverflow.com/comment/38782297
type: AnswerComment
score: 0
type: Comment
has text: Got some results. I cant get the `registerReceiver(receiver, new IntentFilter(DownloadManager.ACTION_DOWNLOAD_COMPLETE));` line to work. I've read everything on the Android Developers site I can about it but still don't get it. For me, in Android Studio, registerReceiver gives error `cannot resolve method` but I do have `import android.content.Context;`. (Without **completely** understanding your code) I am calling your code in its own method and at `/** Do your coding here **/` I am simply writing to logcat with `System.out.println("GOT INTO BroadcastReceiver !!");` but nothing is written...?
comment on: http://stackoverflow.com/a/24930682

http://stackoverflow.com/comment/38811638
has text: I tried using the rownum with the order by.. I see that my query is now taking more time! Which I guess is because of the order by!
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24951758

http://stackoverflow.com/comment/38826120
type: Comment
has text: Adding `[` and `]` will fix it for most symbols.
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/24976442

http://stackoverflow.com/comment/39027082
has text: Thanks a lot, that's one of the answers where you question yourself "why didn't I actually think of that...". That link was quite helpful, in case anybody is trying to do something similar: http://tutorials.jenkov.com/java-reflection/dynamic-class-loading-reloading.html#example
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25064524

http://stackoverflow.com/comment/38958805
type: AnswerComment
has text: This is a bad solution, I'm afraid: it's not thread-safe, since different elements may be processed by different threads, even on a sequential stream. Also (less important) forEach is not guaranteed to maintain order.
comment on: http://stackoverflow.com/a/25041562
type: Comment
score: 3

http://stackoverflow.com/comment/38817447
comment on: http://stackoverflow.com/q/24971331
has text: What do you mean with "700+ rows"? Your code does not retrieve anything from the database, so it's completely irrelevant how many rows the "database" contains.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38849898
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24988969
score: 1
has text: @SantoshPavate in java you can name a method exactly the same as the class name !! daah!!

http://stackoverflow.com/q/24991810
tagged with: java
linked to: http://stackoverflow.com/q/48249
has comment: http://stackoverflow.com/comment/38854870
linked to: http://stackoverflow.com/q/19701105
downvote count: 0
has answer: http://stackoverflow.com/a/24991945
type: UnansweredQuestion
has body: I'm developing a java swing application in which i need to show the map of some area and allow user to put markers on it. I've goggled a lot on the topic but unfortunately i haven't got any how i can do it. I came across some ideas like displaying a web browser in swing just like JXBrowser (i can't afford JXBrowser). And i'm also not sure if this way will allow me adding markers. Please guide me some proper way to do the trick. Please do tell me if i can do it offline or online any way suitable.
type: Question
tagged with: jxbrowser
score: 1
has title: Embedding maps in java swing application
favorite count: 0
has comment: http://stackoverflow.com/comment/38857768
upvote count: 1
has comment: http://stackoverflow.com/comment/38854893
answer count: 1

http://stackoverflow.com/comment/55153411
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25030947
has text: This is to strict, matching emails will be correct, but some non-matching will be correct too !

http://stackoverflow.com/comment/38781861
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24952125
has text: I put it there and it seems maven 'can see that', bacause it shows `[INFO] Copying 1 resource`, but it doesn't work. I'll check out if every other thing is ok, and I let you know.

http://stackoverflow.com/q/25021376
favorite count: 0
score: -1
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38910865
has body: 8fd14735-b195-4c27-b99c-5bf1a2d35834 { "Slaves": "1", "kdt build Box Gen": "0.00323034008", "Job Render": "19.1420002", "Adaptation Luminance": "0.00553634018", "LightMan finalize PA": "6.93000004e-07", "GeomMan finalize Total": "0.163755", "IES bytes": "0" } The above is the kind of data in my file.txt. I am trying to parse it through the json parse but i shows various exception. { "Slaves": "1", "kdt build Box Gen": "0.00323034008", "Job Render": "19.1420002", "Adaptation Luminance": "0.00553634018", "LightMan finalize PA": "6.93000004e-07", "GeomMan finalize Total": "0.163755", "IES bytes": "0" } It only works when i try to parse the above shown lines within curly braces. I dont know the implementation to parse the file containing jobid and other fields between curly braces which are in json format. I wrote the following code to parse the data within curly braces: package com.journaldev.json; import java.sql.DriverManager; import java.sql.Connection; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.BufferedReader; import java.io.IOException; //import java.util.Iterator; //import org.json.simple.JSONArray; import org.json.simple.JSONObject; import org.json.simple.parser.JSONParser; import org.json.simple.parser.ParseException; public class FileInsert2 { private static final String DB_DRIVER = "com.mysql.jdbc.Driver"; private static final String DB_CONNECTION = "jdbc:mysql://localhost:3306/"; private static final String DB_USER = "root"; private static final String DB_PASSWORD = "root"; private static final String dbName = "raas"; private static final String jsonFilePath = "/Users/t_shetd/Meta.txt"; public static void main(String[] args) throws ClassNotFoundException { JSONParser jsonParser = new JSONParser(); try { Connection conn = null; Statement stmt = null; //STEP 2: Register JDBC driver Class.forName(DB_DRIVER); //STEP 3: Open a connection System…
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/38911013
has comment: http://stackoverflow.com/comment/38911808
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/25021585
upvote count: 0
has comment: http://stackoverflow.com/comment/38911189
has comment: http://stackoverflow.com/comment/38911207
has comment: http://stackoverflow.com/comment/38910780
has title: Json Parsing using java
answer count: 1

http://stackoverflow.com/a/25016342
has body: Another alternative is to display a popup window to edit the cell: import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.swing.table.*; /* * The editor button that brings up the dialog. */ //public class TablePopupEditor extends AbstractCellEditor public class TablePopupEditor extends DefaultCellEditor implements TableCellEditor { private PopupDialog popup; private String currentText = ""; private JButton editorComponent; public TablePopupEditor() { super(new JTextField()); setClickCountToStart(1); // Use a JButton as the editor component editorComponent = new JButton(); editorComponent.setBackground(Color.white); editorComponent.setBorderPainted(false); editorComponent.setContentAreaFilled( false ); // Make sure focus goes back to the table when the dialog is closed editorComponent.setFocusable( false ); // Set up the dialog where we do the actual editing popup = new PopupDialog(); } public Object getCellEditorValue() { return currentText; } public Component getTableCellEditorComponent( JTable table, Object value, boolean isSelected, int row, int column) { SwingUtilities.invokeLater(new Runnable() { public void run() { popup.setText( currentText ); // popup.setLocationRelativeTo( editorComponent ); Point p = editorComponent.getLocationOnScreen(); popup.setLocation(p.x, p.y + editorComponent.getSize().height); popup.show(); fireEditingStopped(); } }); currentText = value.toString(); editorComponent.setText( currentText ); return editorComponent; } /* * Simple dialog containing the actual editing component */ class PopupDialog extends JDialog implements ActionListener { private JTextArea textArea; public PopupDialog() { super((Frame)null, "Change Description", true); textArea = new JTextArea(5, 20); textArea.setLineWrap( true ); textArea.setWrapStyleWord( true ); KeyStroke keyStroke = KeyStroke.getKeyStroke("ENTER"); textArea.getInputMap().put(keyStroke, "none"); JScrollPane scrollPane = new JScrollPane( textArea ); getContentPane().add( scro…
answers question: http://stackoverflow.com/q/25015808
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25015808
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/38906211
has comment: http://stackoverflow.com/comment/38922557
upvote count: 2
has comment: http://stackoverflow.com/comment/38906912

http://stackoverflow.com/a/35130920
upvote count: 4
answers question: http://stackoverflow.com/q/25067059
downvote count: 0
has body: Spin Waiting is that you constantly wait for a condition comes true. The opposite is waiting for a signal (like thread interruption by notify() and wait()). There are two ways of waiting, first semi-active (sleep / yield) and active (busy waiting). On busy waiting a program idles actively using special op codes like HLT or NOP or other time consuming operations. Other use just a while loop checking for a condition comming true. The JavaFramework provides Thread.sleep, Thread.yield and LockSupport.parkXXX() methods for a thread to hand over the cpu. Sleep waits for a specific amount of time but alwasy takes over a millisecond even if a nano second was specified. The same is true for LockSupport.parkNanos(1). Thread.yield allows for a resolution of 100ns for my example system (win7 + i5 mobile). The problem with yield is the way it works. If the system is utilized fully yield can take up to 800ms in my test scenario (100 worker threads all counting up a number (a+=a;) indefinitively). Since yield frees the cpu and adds the thread to the end of all threads within its priority group, yield is therefore unstable unless the cpu is not utilized to a certain extend. Busy waiting will block a CPU (core) for multiple milliseconds. The Java Framework (check Condition class implementations) uses active (busy) wait for periodes less then 1000ns (1 microsecond). At my system an average invocation of System.nanoTime takes 160ns so busy waiting is like checking the condition spend 160ns on nanoTime and repeat. So basically the concurrency framework of Java (queues etc) has something like wait under a microsecond spin and hit the waiting periode within a N granulairty where N is the number of nanoseconds for checking time constraints and wait for one ms or longer (for my current system). So active busy waiting increases utilization but aid in the overall reactiveness of the system. While burning CPU time one should use special instructions reducing the power consumption of the core …
score: 4
type: Answer

http://stackoverflow.com/a/25016972
type: Answer
score: 2
downvote count: 0
has body: Look at your example as a lesson of how not to build your layouts. Absolute positioning cannot cope with various challenges that Java GUI applications face: font changes (human) language switches different screen resolutions changes in DPI various operating systems and their layout standards Therefore, programmers need to use layout managers. Over the years, multiple layout managers were created for Swing. I recommend the following three (in that particular order): MigLayout GroupLayout FormLayout MigLayout and FormLayout are third-party managers. Therefore, we need to download and add their libraries to our projects. These three managers are most flexible and powerful of all managers. I create your simple layout with all these three managers. MigLayout MigLayout has a rich set of tools to build the required layout. package com.zetcode; import java.awt.EventQueue; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JPasswordField; import javax.swing.JTextField; import net.miginfocom.swing.MigLayout; public class MigLayoutPassword extends JFrame { public MigLayoutPassword() { initUI(); setTitle("Password application"); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setLocationRelativeTo(null); } private void initUI() { JPanel pnl = new JPanel(new MigLayout("wrap 2, ins dialog", "[right][grow]")); JLabel serviceLbl = new JLabel("Service:"); JLabel userNameLbl = new JLabel("User name:"); JLabel passwordLbl = new JLabel("Password:"); JTextField field1 = new JTextField(10); JTextField field2 = new JTextField(10); JPasswordField field3 = new JPasswordField(10); pnl.add(serviceLbl); pnl.add(field1, "growx"); pnl.add(userNameLbl); pnl.add(field2, "growx"); pnl.add(passwordLbl); pnl.add(field3, "growx"); add(pnl); pack(); } public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { @Override public void run() { MigLayoutPassword ex = new MigLayoutPassword(); ex.setVisible(true); } }); } } Note that there …
upvote count: 2
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24914907
answers question: http://stackoverflow.com/q/24914907

http://stackoverflow.com/comment/39016579
type: Comment
has text: Those describe setting a fixed order before executing tests. I don't know how can I use these methods to modify order during the process.
comment on: http://stackoverflow.com/q/25063674
score: 0
type: QuestionComment

http://stackoverflow.com/a/24982349
upvote count: 1
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/24982318
score: 1
has body: Here is a Reference Code that uses an Android App , Arduino to Control a Bot. You can see its Structure thats what i have used in my robot as well. AsynkTasks wont be a good option in this aspect. Using a Service is a goodIdea for Long Running Communication https://code.google.com/p/mover-bot/ Here is a Live Demo of This Android Controlled Robot. Mover Bot

http://stackoverflow.com/comment/38906873
type: Comment
has text: Try setting `@XmlAccessorType(XmlAccessType.FIELD)` on the `UzivatelSave` class. Apart from that, your code here seems Ok. Verify that the entities have their fields properly set
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/25018627

http://stackoverflow.com/comment/38946388
type: Comment
type: QuestionComment
has text: @bowmore No I noticed. But the author preferred the enhanced for loop.
comment on: http://stackoverflow.com/q/25040459
score: 0

http://stackoverflow.com/q/25018056
tagged with: geometry
has title: Spherical Geometry lib for java
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25018130
type: Question
has comment: http://stackoverflow.com/comment/38904623
has body: I want to get distance of two cities having their latitude and longitude. Is there a java lib to do it? Apache common math seems to have a spherical class. Is there any one used it?
linked to: http://stackoverflow.com/q/3694380
tagged with: java
tagged with: apache-commons-math
score: 0
accepted answer: http://stackoverflow.com/a/25018130
answer count: 1

http://stackoverflow.com/comment/38740462
has text: Preventing users from doing something that they're accustomed to being able to do is pretty much always bad for UX. Unless you have an *extremely good* reason for preventing them from closing the documents, don't try to. (Note: 'because I don't want them to' does not constitute a good reason).
score: 1
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24930925

http://stackoverflow.com/comment/38886115
comment on: http://stackoverflow.com/q/25007427
score: 0
type: Comment
type: QuestionComment
has text: in that case, yes the implementation. the hotspot one might be interesting to know about.

http://stackoverflow.com/comment/38816192
type: Comment
has text: How can I do that, I mean, I have the mysql-connector in Libraries folder, so now how can I add to my classpath?
type: AnswerComment
comment on: http://stackoverflow.com/a/24971276
score: 0

http://stackoverflow.com/q/24975869
tagged with: java
score: -1
tagged with: eclipse
has comment: http://stackoverflow.com/comment/39776440
tagged with: aspectj
downvote count: 1
answer count: 1
favorite count: 0
type: UnansweredQuestion
has body: When i create AspectJ project eveyrthing is ok. When i create new Project(Not with aspectJ) and i link a Spring libs it's ok also, but when i Create AspectJ project and then link Spring libs i am getting "User operation is Waiting, building workspace" - and it's never ending, or causes an error and i have to restart eclipse I don't know what to do. I used aspect J from eclipse side http://www.eclipse.org/ajdt/downloads/ for eclipse 4.3 kepler. - installed this with help -> install new software. Spring libs = spring-framework-4.0.6.RELEASE-dist + apache logging 1.2. - I made a user lib and just adding to Project. I use eclipse 4.3. I have tried this in so many ways and don't know what to do Before, I was using eclipse luna 4.4 and spring worked there awesome, but i had to change on kepler because i can't install aspectJ on luna 4.4
tagged with: spring
upvote count: 0
has title: AspectJ And Spring eclipse configuration
has answer: http://stackoverflow.com/a/25467251
type: Question

http://stackoverflow.com/comment/38845774
comment on: http://stackoverflow.com/a/24986787
type: Comment
score: 0
has text: Thanks, I have my server side application, but I don't know how to apply this concept. Because, one option is bind to the IP Address, but what happen if the user change the IP? The user can launch one instance more of the application, and I want to avoid this.
type: AnswerComment

http://stackoverflow.com/a/25010506
type: Answer
score: 2
upvote count: 2
has body: The question sounds strange to me. Java compiler has an input: source files and an output: class files. I believe you are talking about specifying encoding for an input. Of course it is possible to customize it with Gradle. See for example http://mrhaki.blogspot.cz/2012/06/gradle-goodness-set-java-compiler.html (note that Compile task is changed to JavaCompile in Gradle 2.0). The output is a class file and it does not depend on your language.
downvote count: 0
has comment: http://stackoverflow.com/comment/38965099
answers question: http://stackoverflow.com/q/25007433

http://stackoverflow.com/comment/38886307
type: QuestionComment
comment on: http://stackoverflow.com/q/25008518
score: 0
has text: Save it to a file/DB. If you're referring to Android you can use [*SharedPreferences*](http://developer.android.com/reference/android/content/SharedPreferences.html)
type: Comment

http://stackoverflow.com/comment/38953658
score: 0
has text: So basically upload the twitter4j jar file on my server also? Not sure what that code actually does to be honest but I wonder if I just move my twitter jar to the same folder would it work
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25044175

http://stackoverflow.com/a/24923774
answers question: http://stackoverflow.com/q/24923757
type: Answer
has body: There is no Int type in Java unless you create it yourself. You should use int instead. String is a class rather than a primitive type like int, which is why it's capitalised.
score: 0

http://stackoverflow.com/comment/38842309
comment on: http://stackoverflow.com/a/24984657
type: AnswerComment
type: Comment
has text: For those that don't want to stick their head in the sand, see [Should I avoid the use of set(Preferred|Maximum|Minimum)Size methods in Swing?](http://stackoverflow.com/q/7229226/418556) (Yes.)
score: 2

http://stackoverflow.com/a/25008046
type: Answer
has body: No. You shouldn't do what you're doing. You have numGrades, I think you are should use it to track the correct position in addGrade()! if (numGrades &lt; grades.length) { grades[numGrades] = newGrade; numGrades++; return true; } return false; Also then public double computeScore() { double total = 0; if (numGrades == 0) { return total; } if (numGrades &gt; grades.length) { numGrades = grades.length; } for (int i = 0; i &lt; numGrades; i++) { total += grades[i]; } return total / numGrades; }
has comment: http://stackoverflow.com/comment/38885468
has comment: http://stackoverflow.com/comment/38885495
answers question: http://stackoverflow.com/q/25007990
score: 0

http://stackoverflow.com/a/25028073
answers question: http://stackoverflow.com/q/25028067
accepted answer of: http://stackoverflow.com/q/25028067
has comment: http://stackoverflow.com/comment/38927722
has comment: http://stackoverflow.com/comment/38923812
has body: You can't refer to this in a static method (your init method), since a static method has no access to an instance of the class (unless you pass it such an instance as an argument). If you want to create an instance with the default constructor and initialize its members with the init method, remove the static keyword. Other than the issue of the static method, you can certainly use a non-constructor method to initialize the instance. However, what do you gain here? The call to the init method looks the same as a constructor with arguments. The main difference is that, as you mentioned, you can call this init method multiple times.
upvote count: 2
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38923843
type: Answer
score: 2
downvote count: 0

http://stackoverflow.com/a/24995882
downvote count: 0
has body: Use either web.xml declaration or use annotation you are using both that's why conflicting situation occurs and 404 has been returned.So either remove annotation or mappings from xml file. Moreover specify action for submit button &lt;input type="submit" name="callservlet" value="Call Servlet." onClick="action"/&gt; ^^^^^^^^^^^^^^^^^
upvote count: 2
has comment: http://stackoverflow.com/comment/38862362
type: Answer
score: 2
answers question: http://stackoverflow.com/q/24995773

http://stackoverflow.com/comment/38957277
score: 1
type: QuestionComment
has text: Not quite following you - regex capability is built-in to Java, and the pattern for matching the protocol portion of a URL is not going to change, so I don't see any drawbacks to including a regex in your code.
comment on: http://stackoverflow.com/q/25044957
type: Comment

http://stackoverflow.com/a/24983009
upvote count: 38
accepted answer of: http://stackoverflow.com/q/24979557
answers question: http://stackoverflow.com/q/24979557
has comment: http://stackoverflow.com/comment/85395997
type: AcceptedAnswer
score: 38
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/89272161
has body: In addition to JB's answer, I would like to propose a solution that queries the runtime for available algorithms. This method is of course easily converted to one for Cipher, SecureRandom, Mac, KeyAgreement, KeyFactory or any other type of algorithm. Program import java.security.MessageDigest; import java.security.Provider; import java.security.Provider.Service; import java.security.Security; import java.util.ArrayList; import java.util.List; import java.util.Set; public class ShowHashAlgorithms { private static final void showHashAlgorithms(Provider prov, Class&lt;?&gt; typeClass) { String type = typeClass.getSimpleName(); List&lt;Service&gt; algos = new ArrayList&lt;&gt;(); Set&lt;Service&gt; services = prov.getServices(); for (Service service : services) { if (service.getType().equalsIgnoreCase(type)) { algos.add(service); } } if (!algos.isEmpty()) { System.out.printf(" --- Provider %s, version %.2f --- %n", prov.getName(), prov.getVersion()); for (Service service : algos) { String algo = service.getAlgorithm(); System.out.printf("Algorithm name: \"%s\"%n", algo); } } // --- find aliases (inefficiently) Set&lt;Object&gt; keys = prov.keySet(); for (Object key : keys) { final String prefix = "Alg.Alias." + type + "."; if (key.toString().startsWith(prefix)) { String value = prov.get(key.toString()).toString(); System.out.printf("Alias: \"%s\" -&gt; \"%s\"%n", key.toString().substring(prefix.length()), value); } } } public static void main(String[] args) { Provider[] providers = Security.getProviders(); for (Provider provider : providers) { showHashAlgorithms(provider, MessageDigest.class); } } } Sun provider output This code will generate the following output for Java 1.8. Note that because of some old mistake by the API providers, the provider version is only present as a double. It is not possible to distinguish between version 1.80 or version 1.8.0 because of this. The aliases are below the actual implementations. Some of these aliases are Object Identifiers or O…

http://stackoverflow.com/a/25299518
score: 0
answers question: http://stackoverflow.com/q/25017368
accepted answer of: http://stackoverflow.com/q/25017368
type: Answer
has body: Answer here James_D import javafx.application.Application; import javafx.application.Platform; import javafx.beans.property.SimpleStringProperty; import javafx.beans.property.StringProperty; import javafx.beans.value.ChangeListener; import javafx.scene.Scene; import javafx.scene.control.TableColumn; import javafx.scene.control.TableView; import javafx.scene.layout.HBox; import javafx.stage.Stage; public class TwoTableTest extends Application { private ChangeListener&lt;Number&gt; table1SelectionListener ; private ChangeListener&lt;Number&gt; table2SelectionListener ; @Override public void start(Stage primaryStage) { TableView&lt;Person&gt; table1 = createTableView() ; TableView&lt;Person&gt; table2 = createTableView() ; table1.getSelectionModel().select(0); table2.getSelectionModel().select(0); table1SelectionListener = (obs, oldIndex, newIndex) -&gt; { int table1SelectedIndex = table1.getSelectionModel().getSelectedIndex() ; int table2SelectedIndex = table2.getSelectionModel().getSelectedIndex() ; if (table1SelectedIndex != table2SelectedIndex) { Platform.runLater(() -&gt; table2.getSelectionModel().select(table1SelectedIndex)); } }; table2SelectionListener = (obs, oldIndex, newIndex) -&gt; { int table1SelectedIndex = table1.getSelectionModel().getSelectedIndex() ; int table2SelectedIndex = table2.getSelectionModel().getSelectedIndex() ; if (table1SelectedIndex != table2SelectedIndex) { Platform.runLater(() -&gt; table1.getSelectionModel().select(table2SelectedIndex)); } }; table1.getSelectionModel().selectedIndexProperty().addListener(table1SelectionListener); table2.getSelectionModel().selectedIndexProperty().addListener(table2SelectionListener); HBox root = new HBox(5, table1, table2); Scene scene = new Scene(root, 800, 600); primaryStage.setScene(scene); primaryStage.show(); } private TableView&lt;Person&gt; createTableView() { TableView&lt;Person&gt; table = new TableView&lt;&gt;(); TableColumn&lt;Person, String&gt; firstNameCol = new TableColumn&lt;&gt;("Firs…
type: AcceptedAnswer

http://stackoverflow.com/comment/38928426
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/25029785
has text: @MikkelLøkke I tried this because I wanted 3 liners to be 1 liners in my code, not because I thought there was a bottleneck. Also, this _is_ the profiler. The "what am I doing wrong" is regarding the code. I didn't even know the JVM was doing optimization.

http://stackoverflow.com/comment/38827212
comment on: http://stackoverflow.com/q/24977080
type: Comment
type: QuestionComment
has text: I don't know if those are the names you are using in reality, but I'd suggest you to use more *descriptive* names of variables.
score: 0

http://stackoverflow.com/q/25054274
has body: I am really confused as to how overriding is very different from overloading in java since when I implement overloading I call a method by the same name but different signature that is a different datatype parameter or a different return type. In overriding also I call different methods(Different block of code) by passing objects of different type. Now when I am passing different types of objects its the same as passing a different datatype as different classes represent different user-defined datatype. So apart from the difference of Overloading being in the same class and overriding being in different classes are the two conceptually the same?
favorite count: 0
linked to: http://stackoverflow.com/q/154577
has answer: http://stackoverflow.com/a/25054340
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25054834
has answer: http://stackoverflow.com/a/25054361
tagged with: java
has answer: http://stackoverflow.com/a/25054372
downvote count: 1
has answer: http://stackoverflow.com/a/25054485
type: Question
has answer: http://stackoverflow.com/a/25054353
has title: Java method overriding
has answer: http://stackoverflow.com/a/25054543
tagged with: overriding
score: -1
upvote count: 0
has comment: http://stackoverflow.com/comment/38972548
answer count: 7

http://stackoverflow.com/comment/48574820
has text: Not sure, that would be better addressed as a separate question
comment on: http://stackoverflow.com/a/24968771
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/38878388
has text: I get that, but my game demands that on decline i want the other players to continue. And moreover, i would have other places in my code where i need to override the common behaviour and that's why the the more general question on how can i override.
type: AnswerComment
comment on: http://stackoverflow.com/a/25004060
score: 0
type: Comment

http://stackoverflow.com/comment/38745311
score: 0
type: Comment
type: QuestionComment
has text: I can't see any reason that loop would slow down over time, it appears that you don't even create anything new within the loop body. The only thing I can think is that it's in the body of one of your `getByCode*` methods.
comment on: http://stackoverflow.com/q/24933492

http://stackoverflow.com/comment/38928194
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25030619
has text: Thx for your answer! However, I still get an exception. How to set the entityManagerFactory properly? Please have a look at my update.
score: 0

http://stackoverflow.com/a/30703984
has comment: http://stackoverflow.com/comment/49474565
has comment: http://stackoverflow.com/comment/49477447
has comment: http://stackoverflow.com/comment/49474074
answers question: http://stackoverflow.com/q/24961072
score: 0
type: Answer
has body: I agree on creating a custom maven plugin seems like a better option. I dont know about an existing plugin provides solution for what you asked. md5 checksum (or sha-1 in my repository) is generated with install plugin, so seems like you need to extend this or write a new plugin which works after install phase. I have 2 suggestions about this plugin: 1) When thinking simple, this plugin should: Read generated jar: Extract all entries. Exclude some entries (e.g. MANIFEST.MF). Sort remaining entries . Extract md5s for each in memory. Generate a single md5 from all of those extracted. However when considering about where &amp; when independency: Accordig to .class file structure Java_class_file there is minor, major versions entries are held in compiled class files. So if compiler changes, .class files will be changed. In this case we need a check on source code level from this point :( So this solution become useless if there is no guarantee on copiler version. 2) As very dirty but easy solution, this plugin may only extract your module's pom.xml file's md5 code. But you must guarantee each change in your jar reflects to a minor version (or built number) manually.

http://stackoverflow.com/q/24981619
tagged with: java
has body: I currently have a constructor: private int num; private String let; private Set&lt;Integer&gt; set; public Constructor(int num, String let, Set&lt;Integer&gt; set) { this.number = num; this.letter = letter; this.setint = set; } Is there a way to add additional fields inside the constructor without modifying the number of parameters? This is what I'd like to do: private int num; private String let; private Set&lt;Integer&gt; set; private List&lt;String&gt; los; public Constructor(int num, String let, Set&lt;Integer&gt; set) { this.number = num; this.letter = letter; this.setint = set; this.los = los; } But Eclipse does not like that, saying that my statement does nothing unless I add los as a parameter in the constructor. Is there a way for me to do this?
has comment: http://stackoverflow.com/comment/38835397
downvote count: 1
type: Question
score: -1
has title: How can I associate fields with a constructor if it is not a parameter?
upvote count: 0
has answer: http://stackoverflow.com/a/24981700
answer count: 1
has comment: http://stackoverflow.com/comment/38835393
has comment: http://stackoverflow.com/comment/38835410
favorite count: 0
tagged with: constructor
tagged with: field
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24981700

http://stackoverflow.com/a/24931549
has body: i'd simply convert the arraylist in an 2 dimensional array ... somethin like that public void convertToArray(){ int count = 0; for (int j = 0; j &lt; entrys.length; j++) { for (int i = 0; i &lt; 2; i++) { entrys[j][i] = list.get(count++); } } } then create the table String[] header = {"col1", "col2"}; table = new JTable(entrys, header); and add to frame etc.
type: Answer
accepted answer of: http://stackoverflow.com/q/24930545
answers question: http://stackoverflow.com/q/24930545
score: 0
type: AcceptedAnswer

http://stackoverflow.com/q/24964242
downvote count: 0
has comment: http://stackoverflow.com/comment/38803298
has comment: http://stackoverflow.com/comment/38803340
accepted answer: http://stackoverflow.com/a/24964335
has comment: http://stackoverflow.com/comment/38803429
favorite count: 0
answer count: 3
has comment: http://stackoverflow.com/comment/38803357
has answer: http://stackoverflow.com/a/24964335
upvote count: 6
has title: Unsigned int (primitive) and Integer (Object) usage in Java
has answer: http://stackoverflow.com/a/24964350
has answer: http://stackoverflow.com/a/24964638
score: 6
has comment: http://stackoverflow.com/comment/38803353
type: AnsweredQuestion
tagged with: unsigned-integer
tagged with: java
has comment: http://stackoverflow.com/comment/38803418
type: Question
possible better answer: http://stackoverflow.com/a/24964350
has body: I'm following the Java tutorial on Primitive Data Types. Early on, it states that In Java SE 8 and later, you can use the int data type to represent an unsigned 32-bit integer, which has a minimum value of 0 and a maximum value of 2^32-1. Use the Integer class to use int data type as an unsigned integer. What I'm understanding from this quote is that I can now store up to 2^32-1 as an int as long as I use the Integer wrapper object rather than the int primitive data type. But when I tried this out, my compiler is complaining that the value I'm using is too large, 2^31. I've tried this using both the primitive data type and Object. Integer integerObjectLarge = 2147483648; //2^31 int integerPrimitiveLarge = 2147483648; //2^31 How exactly do I use an int/Integer to store unsigned value, such as 2^31?

http://stackoverflow.com/comment/38817969
has text: Thank you for the answer but this violates the "via GUI" constraint ;-)
type: Comment
comment on: http://stackoverflow.com/a/24972135
type: AnswerComment
score: 0

http://stackoverflow.com/a/25010164
answers question: http://stackoverflow.com/q/25008939
has comment: http://stackoverflow.com/comment/38890573
score: 0
has comment: http://stackoverflow.com/comment/38889586
type: Answer
has comment: http://stackoverflow.com/comment/38889406
has body: We have setMaxRow(int numOfRow) in Statement Object this will limit number of rows generated by the Statement Object and simply ignore the remaining. Take the look at the doc.

http://stackoverflow.com/a/24921636
has comment: http://stackoverflow.com/comment/38723449
has comment: http://stackoverflow.com/comment/38723556
has comment: http://stackoverflow.com/comment/38723586
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24921450
has comment: http://stackoverflow.com/comment/38723728
answers question: http://stackoverflow.com/q/24921450
has comment: http://stackoverflow.com/comment/38723680
type: Answer
has comment: http://stackoverflow.com/comment/38723515
has comment: http://stackoverflow.com/comment/38723733
has comment: http://stackoverflow.com/comment/38725544
has body: Is it possible to simplify this piece of code without slowing down performance too much? If I understand your question, yes! You could make the method static. You could also shorten it up significantly with String.format() private static String formatPrice(int price) { if (price &lt; 0) { return ""; } if (price &gt; 1000 * 1000) { return String.format("(%.1fm)", ((double) price) / (1000 * 1000)); } else if (price &gt; 1000) { return String.format("(%dk)", price / 1000); } return String.format("(%dgp)", price); }
downvote count: 0
has comment: http://stackoverflow.com/comment/38723610
score: 1

http://stackoverflow.com/q/24982482
has answer: http://stackoverflow.com/a/24982569
tagged with: java
has answer: http://stackoverflow.com/a/24982641
has title: How to identify a piece of data in an SQLite database's column?
type: Question
possible better answer: http://stackoverflow.com/a/24982569
score: 0
answer count: 3
accepted answer: http://stackoverflow.com/a/24982641
has answer: http://stackoverflow.com/a/24982718
tagged with: sqlite
has body: This is my first time setting up an SQLite DataBase, and I'm having trouble figuring out how to control the cursor. Let's say my column names are (author,yearPublished, title) in that order. And lets say I already saved a few entries into the data base like: Bob, 2007, "The Builder" Jack, 2003, "The Headless Horseman" Andy, 2012, "The Mysterious Legend" So for each book title there is a button with the books name on it(For example, "The Builder" would be on a button the user created). The user can then click on this button, go to another activity page, and have information for this book already put in. For example, it's almost like a library where a new book comes in called "Green Eggs and Ham" by Dr.Seuss, published:1960. The user goes through the other parts of my app, entering the information for this book, thus saving the data into the SQLite database as an entry and creating a button with "Green Eggs and Ham" on it. And when the user clicks on this button, it leads to a page with information: Author: Dr.Seuss/ Published: 1960/ Title: Green Eggs and Ham My question is, how can I identify a title in my database like "Green Eggs and Ham" and then retrieve all the other information that came with it. My thoughts on how I want it to work: cursor=DataBase.column("title").StringWithId("GreenEggsAndHam").getRowInformation(); String title=cursor.get("title"); int published=cursor.get("yearPublished"); String author=cursor.get("author") But obviously this isn't valid syntax. My DataBase Code: public class DataHandler { public static final String PRIORITY="priority"; public static final String LEASTHOURS="leastHours"; public static final String LEASTMINUTES="leastMinutes"; public static final String EXACTHOURS="exactHours"; public static final String EXACTMINUTES="exactMinutes"; public static final String SETHOURS="setHours"; public static final String SETMINUTES="setMinutes"; public static final String SETAMPM="setAmPm"; public static final String ACTIVITYNAME="activityN…
tagged with: android
type: AnsweredQuestion

http://stackoverflow.com/comment/38927973
has text: I thought you where a little harsh.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25030274

http://stackoverflow.com/a/25032160
answers question: http://stackoverflow.com/q/25032018
type: AcceptedAnswer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/38934244
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/38931167
has comment: http://stackoverflow.com/comment/38931064
has comment: http://stackoverflow.com/comment/38930820
accepted answer of: http://stackoverflow.com/q/25032018
has body: What endianness has received packet in Java? It has whatever the sender put in it. Are these numbers automatically converted to big-endian upon receival? Java doesn't change anything.

http://stackoverflow.com/comment/38795393
score: 0
type: AnswerComment
type: Comment
has text: @Welbog "The null string, of course, can't be matched by any regular expression." This isn't correct, since `"".matches("")` returns `true`.
comment on: http://stackoverflow.com/a/24943340

http://stackoverflow.com/comment/38821321
type: Comment
comment on: http://stackoverflow.com/a/24973865
has text: it is my typing mistake here since am a new user for stack overflow.forgiv me for this time.but i had imported import java.io.FileInputStream; in my program
type: AnswerComment
score: 0

http://stackoverflow.com/comment/38837378
has text: Redis is a simple Key,Value system. If I go a different way like Jsons It would destroy the design and it would be slower. For redis I could get the data as byte array aswell,but that wouldnt help. I though there would be something like the boost lexical_cast which can decide on runtime which way to go.
comment on: http://stackoverflow.com/q/24982487
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/55973076
type: Answer
has body: Clean Caches File -&gt; Invalidate Caches / Restart...
answers question: http://stackoverflow.com/q/25041104
upvote count: 3
score: 3
downvote count: 0

http://stackoverflow.com/q/24916213
upvote count: 2
has title: Jackson: Map Deserialization
answer count: 1
downvote count: 1
accepted answer: http://stackoverflow.com/a/24916459
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: AnsweredQuestion
score: 1
tagged with: jackson
has comment: http://stackoverflow.com/comment/38713909
favorite count: 0
type: Question
has body: I want to deserialize the following json-string to this map Map&lt;String, IAnimal&gt;. My problem is that the values of the animals in the json-string does not contain any type information and are only dependant of the keys. { "dog": { "age": 5 }, "cat": { "age": 2 } } interface IAnimal { } class Dog implements IAnimal { int age; // getter &amp; setter } class Cat implements IAnimal { int age; // getter &amp; setter }
has answer: http://stackoverflow.com/a/24916459

http://stackoverflow.com/a/24951985
accepted answer of: http://stackoverflow.com/q/24951934
score: 0
has comment: http://stackoverflow.com/comment/38781444
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24951934
type: Answer
has comment: http://stackoverflow.com/comment/38782157
has body: Solve the red markers in the View "Markers" first.

http://stackoverflow.com/comment/38774107
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24948163
has text: But I am running this from a thumbdrive. Does it matter?
score: 0

http://stackoverflow.com/comment/38901815
comment on: http://stackoverflow.com/q/25016526
score: 0
type: Comment
has text: this is the output http://www.davidedellai.net/jsonphp.php
type: QuestionComment

http://stackoverflow.com/comment/38844269
type: QuestionComment
has text: Worth taking a look at the [Javadoc for `PipedInputStream`](http://docs.oracle.com/javase/7/docs/api/java/io/PipedInputStream.html).
comment on: http://stackoverflow.com/q/24986097
score: 0
type: Comment

http://stackoverflow.com/comment/38741776
score: 0
type: Comment
type: QuestionComment
has text: why you have to make it static?
comment on: http://stackoverflow.com/q/24931776

http://stackoverflow.com/a/25029536
answers question: http://stackoverflow.com/q/25016482
type: AcceptedAnswer
downvote count: 0
has body: I use alfresco-mmt.jar to deploy amp file for custom theme. I use below command. and restart my server. It work. java -jar alfresco-mmt.jar install D:\Alfresco\amps_share\alfrescoThemes_myFirstTheme.amp D:\Alfresco\Tomcat\webapps\share.war java -jar alfresco-mmt.jar install &lt;amp file path&gt; &lt;destination war file path&gt; Thanks Gagravarr for your hint.
type: Answer
upvote count: 1
score: 1
accepted answer of: http://stackoverflow.com/q/25016482

http://stackoverflow.com/a/24978738
score: -1
downvote count: 4
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24978388
type: Answer
has comment: http://stackoverflow.com/comment/38830294
upvote count: 3
has comment: http://stackoverflow.com/comment/38830387
answers question: http://stackoverflow.com/q/24978388
has body: You can do: ObjectMapper mapper = new ObjectMapper(); JsonNode actualObj = mapper.valueToTree("{\"k1\":\"v1\"}") JsonNode it is a super class of ObjectNode. You can find the differences in the API.

http://stackoverflow.com/comment/38826045
comment on: http://stackoverflow.com/a/24976442
type: AnswerComment
score: 0
type: Comment
has text: `removeable` needs to be a regular expression.

http://stackoverflow.com/comment/38845793
score: 1
has text: Why the extra method though? What is wrong with keeping it all in one method?
type: AnswerComment
comment on: http://stackoverflow.com/a/24986845
type: Comment

http://stackoverflow.com/a/25063360
score: 0
has comment: http://stackoverflow.com/comment/38990819
answers question: http://stackoverflow.com/q/25062473
type: Answer
has comment: http://stackoverflow.com/comment/38996634
has comment: http://stackoverflow.com/comment/38990091
has comment: http://stackoverflow.com/comment/38989773
has comment: http://stackoverflow.com/comment/38989992
has body: Need more details about your question. Do you just want to split the file into 3 files with random size or is there some business requirement that you have on which you have to split the file. However whatever your scenario is you can write a Mapper alone and save the output of the mapper to a file or you can write a Pig script to do the same. Sample Pig Script(Assuming that you already have Pig installed on your machine) Let's say you input file is the one given below and is saved as InputData.txt Shabbir Khan 9314573259 Bangalore Engineer Manish Sharma 8882148796 Gurgaon Lecturer Mahesh Kumar 8521548932 Noida Business Sampath Reddy 8547987412 Hyderabad Engineer Mohan Reddy 9256458798 Hyderabad Professor Pig script to load and store the file based on a condition that I need only the records with City as Hyderabad. A = LOAD 'InputData.txt' using PigStorage (‘\t’) as (FName: chararray, LName: chararray, MobileNo: chararray, City: chararray, Profession: chararray); FilteredLst = FILTER A BY City='Hyderabad'; store FilteredLst '/user/output';

http://stackoverflow.com/a/25333505
downvote count: 0
score: 1
upvote count: 1
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/24929852
has body: I thing you have to use this: DriverManager.getConnection("jdbc:mysql://" + this.hostname + ":" + this.port + "/" + this.database, this.user, this.password);
answers question: http://stackoverflow.com/q/24929852

http://stackoverflow.com/comment/39155449
type: QuestionComment
comment on: http://stackoverflow.com/q/24944171
score: 0
has text: `readline()` also blocks until input is received.
type: Comment

http://stackoverflow.com/q/25022409
favorite count: 0
answer count: 0
type: UnansweredQuestion
has body: I started a java process and it seems to be running fine. It is also working according to expectations. But every now and then it prints this thread dump. I am not sure if it is having some problems (memory?). Can anyone tell me what are the possible reasons for a java process to print thread dumps on its own? Here is the thread dump. https://gist.github.com/tispratik/270869e17aaaf0d1b092
upvote count: 1
tagged with: thread-dump
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/38914833
type: Question
has comment: http://stackoverflow.com/comment/38913093
has comment: http://stackoverflow.com/comment/38914768
downvote count: 0
has title: Java process printing thread dump
has comment: http://stackoverflow.com/comment/38953404

http://stackoverflow.com/q/24977882
tagged with: java
tagged with: lwjgl
has answer: http://stackoverflow.com/a/24978717
has comment: http://stackoverflow.com/comment/38828659
type: Question
has comment: http://stackoverflow.com/comment/38828823
has comment: http://stackoverflow.com/comment/38828711
has comment: http://stackoverflow.com/comment/38828695
has comment: http://stackoverflow.com/comment/38828734
has title: Open AL Null Pointer Exception
tagged with: openal
has comment: http://stackoverflow.com/comment/38828683
score: 0
tagged with: nullpointerexception
accepted answer: http://stackoverflow.com/a/24978717
answer count: 1
has comment: http://stackoverflow.com/comment/38828676
tagged with: audio
type: AnsweredQuestion
has body: I'm attempting to do my first test with open AL and I keep getting a null pointer error as per below: Exception in thread "main" C:\Users\Rob\Desktop\Programming Workspace\Android\RPG Test Engine\res\sounds\test1.wav java.lang.NullPointerException at com.evylgaming.rpg.SoundManager.getSoundsFromFile(SoundManager.java:119) at com.evylgaming.rpg.RPGMain.main(RPGMain.java:14) AL lib: (EE) alc_cleanup: 1 device not closed The link you're seeing is in reference to where the error is. I wanted to ensure the file was loaded so am I doing something incorrectly? package com.evylgaming.rpg; import java.io.*; import java.nio.FloatBuffer; import java.util.HashMap; import org.lwjgl.LWJGLException; import org.lwjgl.openal.AL; import org.lwjgl.openal.AL10; import org.newdawn.slick.openal.WaveData; import javax.sound.sampled.*; public class SoundManager { private File soundsFolder; private File[] soundFolderFiles; static HashMap&lt;String, Integer&gt; buffers = new HashMap&lt;&gt;(); static HashMap&lt;String, Integer&gt; sources = new HashMap&lt;&gt;(); static HashMap&lt;String, float[]&gt; sourcePositions = new HashMap&lt;&gt;(); static HashMap&lt;String, float[]&gt; sourceVelocitys = new HashMap&lt;&gt;(); static float[] listenerPosition; static float[] listenerVelocity; // static HashMap&lt;String, Point&gt; locations = new Hashmap&lt;String, Point&gt;(); // AL_BUFFER, AL_POSITION, AL_PITCH, AL_GAIN public void playSound(int index) { AL10.alSourcePlay(sources.get(index)); } public void stopSound(int index) { AL10.alSourceStop(sources.get(index)); } public void pauseSound(int index) { AL10.alSourcePause(sources.get(index)); } public void playSound(String name) { if(sources.containsKey(name)) { AL10.alSourcePlay(sources.get(name)); } else {} } public void stopSound(String name) { if(sources.containsKey(name)) { AL10.alSourceStop(sources.get(name)); } else {} } public void pauseSound(String name) { if(sources.containsKey(name)) { AL10.alSourcePause(sources.get(name)); } else {} } p…

http://stackoverflow.com/comment/38957952
has text: Please show the following: The original arraylist contents; The expected output.
type: Comment
score: 1
comment on: http://stackoverflow.com/q/25045844
type: QuestionComment

http://stackoverflow.com/q/25000415
answer count: 1
has answer: http://stackoverflow.com/a/25000556
favorite count: 0
has comment: http://stackoverflow.com/comment/38871683
tagged with: pdf-generation
type: AnsweredQuestion
has title: Print Avery Label from Java, need template standards
upvote count: 3
score: 1
tagged with: java
downvote count: 2
accepted answer: http://stackoverflow.com/a/25000556
has body: I want to print Avery Labels from Java. What are all the template standards (size, margin...) for all the Avery Labels?
type: Question

http://stackoverflow.com/comment/38931662
type: AnswerComment
type: Comment
has text: Thank you, i just had to inject my first service (EnvVarApi) into the second as to not hardcode the url. Then remove the callbackSuccess and add a return in the getUrlApi method and it works fine.
comment on: http://stackoverflow.com/a/25020473
score: 0

http://stackoverflow.com/comment/38787629
score: 0
type: AnswerComment
type: Comment
has text: @erik no problem, +1 for being -1
comment on: http://stackoverflow.com/a/24955601

http://stackoverflow.com/comment/38968778
has text: What changes to `btn_1` would change it's state so that it would either require a `repaint` or change visibly in anyway?
score: 0
comment on: http://stackoverflow.com/q/25052077
type: QuestionComment
type: Comment

http://stackoverflow.com/q/25065572
tagged with: java
type: Question
score: 3
has answer: http://stackoverflow.com/a/25065913
has comment: http://stackoverflow.com/comment/38997764
has comment: http://stackoverflow.com/comment/39026321
upvote count: 3
answer count: 3
has comment: http://stackoverflow.com/comment/38994576
tagged with: apache
has answer: http://stackoverflow.com/a/25083637
tagged with: tomcat
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25083696
has title: tomcat leaves time_wait connection
has comment: http://stackoverflow.com/comment/38994422
has body: we are using an Apache Sever as a front server an a Tomcat server for the backend. The frontend client is a java swing application. The protocol is hessian. Sometimes we got a lot of small requests. When doing a "nestat -a" there are a lot of TIME_WAIT connections, which are blocking the server to open new connections. Only the connections to the tomcat seem to stay. The connections to the apache seem to be closed. We are using a rewrite rule to forward the requests to the tomcat RewriteEngine On RewriteCond %{REQUEST_URI} .*\.servlet.*$ RewriteRule ^/(.*)$ http://localhost:8080/$1 [P] Any ideas? UPDATE: Thanks for your advice, but it still doesn't work. Every stream is closed and there are still these TIME_WAIT's: if (conn != null) { try { IOUtils.closeQuietly(conn.getInputStream()); } catch (IOException e) { // do nothing } try { IOUtils.closeQuietly(conn.getOutputStream()); } catch (Exception ex) { // do nothing } try { IOUtils.closeQuietly(((HttpURLConnection) conn).getErrorStream()); } catch (Exception ex) { // do nothing } } if (conn instanceof HttpURLConnection) { ((HttpURLConnection) conn).disconnect(); }
downvote count: 0

http://stackoverflow.com/a/24977839
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: This is untested, but I see two things wrong here: You should call setWebViewClient with your WebViewClient implementation before you call loadUrl. However, loadUrl is asynchronous, so it probably would not make a difference, but this is worth a try I think. You are not calling super.onPageFinished(view, url); in onPageFinshed. You should add this call. EDIT 2: I finally took a look at the actual page you are working with. The problem is that the page loads content in a different frame, so you actually have to make the getElementsByName call on a different document. The frame in which both of the inputs you want are located has the name mainFrame in your page. So, you should write the javascript like this and load that into the WebView as you have done above: window.frames["mainFrame"].document. getElementsByName('p_codigo_c')[0].value = "user"; window.frames["mainFrame"].document. getElementsByName('p_clave_c')[0].value = "password";
answers question: http://stackoverflow.com/q/24977781
score: 3
upvote count: 3
accepted answer of: http://stackoverflow.com/q/24977781
has comment: http://stackoverflow.com/comment/38840568
has comment: http://stackoverflow.com/comment/38848506
has comment: http://stackoverflow.com/comment/38829004

security
tags question: http://stackoverflow.com/q/24917212
tags question: http://stackoverflow.com/q/25058364
tags question: http://stackoverflow.com/q/24966780
tags question: http://stackoverflow.com/q/24974796
tags question: http://stackoverflow.com/q/24961538
tags question: http://stackoverflow.com/q/25006931
tags question: http://stackoverflow.com/q/24948651
tags question: http://stackoverflow.com/q/24948882
tags question: http://stackoverflow.com/q/24913510
tags question: http://stackoverflow.com/q/24995566
tags question: http://stackoverflow.com/q/24965570
tags question: http://stackoverflow.com/q/25046942
type: Tag
tags question: http://stackoverflow.com/q/24984698
tags question: http://stackoverflow.com/q/24986500
tags question: http://stackoverflow.com/q/24915753
tag name: security
tags question: http://stackoverflow.com/q/24927623

http://stackoverflow.com/a/24990221
has body: Both OpenSessionInViewFilter and spring's delegate for EntityManager use ThreadLocal to store real EntityManager implementation. And they bind an EntityManager to this ThreadLocal each time request being initiated, in a thread of this request. So EM won't be bound to the thread you create manually. You should observe your stack trace and figure out where does spring look for EM (or session). According to stack trace you provided, learn the SpringSessionContext to find a way to bind session manually. Also you need to perform some work to clean up session as thread completes.
upvote count: 2
answers question: http://stackoverflow.com/q/24989925
downvote count: 0
type: Answer
score: 2

http://stackoverflow.com/a/24919265
type: Answer
has comment: http://stackoverflow.com/comment/38719190
upvote count: 4
answers question: http://stackoverflow.com/q/24919152
has body: Instead of multiple threads writing to the same file, you could have one thread writing to the file, with multiple threads producing the data but storing it in some kind of buffer for the file writer thread.
has comment: http://stackoverflow.com/comment/38720491
score: 4
downvote count: 0
has comment: http://stackoverflow.com/comment/38720357
has comment: http://stackoverflow.com/comment/38719501
has comment: http://stackoverflow.com/comment/38719620
has comment: http://stackoverflow.com/comment/38719052

http://stackoverflow.com/comment/38897435
has text: If the data you want to display uses a different layout and looks different, then you need a new `Adapter`. If the data in both `ListViews` uses the same layouts and looks identical than you can use the same `Adapter`.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25014340
type: QuestionComment

http://stackoverflow.com/comment/38749036
type: Comment
has text: yeah, there's a bunch of problems wrong with his code, made an updated suggestion to just maintain an infinite loop instead of this `Menu_check` boolean
comment on: http://stackoverflow.com/a/24935326
score: 0
type: AnswerComment

meta-inf
tag name: meta-inf
tags question: http://stackoverflow.com/q/25006284
type: Tag

http://stackoverflow.com/q/25016952
downvote count: 0
tagged with: dam
tagged with: assets
has title: How to avoid adding renditions for pdf uploading into DAM?
tagged with: http://stackoverflow.com/tag/pdf
answer count: 1
accepted answer: http://stackoverflow.com/a/25020298
favorite count: 0
has body: When I upload pdf file to cq5 I see following structure in my crx: This structure looks strange for me. I don't understand why do I see png renditions here. How can I use these renditions? My current vision that these renditions couldn't be helpful. Thus I want to achieve that after uploading PDF files into DAM these renditions doesn't generate. Can you provide steps for this? after my changes in workflow: before my changes: update 2 I set dimensions follows: but I see old result after pdf and jpg uploading
upvote count: 2
tagged with: aem
type: AnsweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/25020298
score: 2

http://stackoverflow.com/q/24928803
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/38739203
has comment: http://stackoverflow.com/comment/38737823
possible better answer: http://stackoverflow.com/a/24930036
has title: Design pattern to delegate different operations to different classes
favorite count: 0
upvote count: 5
has comment: http://stackoverflow.com/comment/38816670
has comment: http://stackoverflow.com/comment/38746121
linked to: http://stackoverflow.com/q/3291637
has comment: http://stackoverflow.com/comment/38736631
accepted answer: http://stackoverflow.com/a/24929103
has comment: http://stackoverflow.com/comment/38736333
has body: I have a class ABC that can do operation a(), b() and c() (operation == method), which are all closely related. I also have simimar classes DE and FGH. In the future, it is possible new classes are added with additional operations. Classes never share operations (for example, there is no class ADF) My program should be able to perform all these operations, and the timing is "kind of random", meaning I have no estimate beforehand of which operation will be executed when/how many times. I tackled this program by creating a wrapper class "OperationInvoker". My program can only access this invoker, and it has one method for each operation. The advantage of this is encapsulation: if new operations are created or existing one or edited, onlt the wrapper class needs editing. My question is whether a "huge" wrapper is the best pattern to solve this? I looked into the observer pattern for this by I think this is not a suitable case because the classes ABC, DE, FGH ... never have any mutual interests. Like, if operation A needs to be executed, all registered classes will receive event A and only 1 class (namely, ABC) will be actually interested in this event. all other registered classes will discard the event. This seems like overkill/overhead with all the registering and observing. The delegation pattern also suffers the same problem: i don't have many classes doing the same operation in a different way, so there is no point in having a flexible delegation system. Are there other, better patterns, or is this just a simple case of having a delegating wrapper class? EDIT: someone asked what exactly ABC does. Well, I have a WSDL file that describes SOAP web services. I use a tool to convert this file to java classes. This means I cannot control the content of these classes as they are auto generated. So I wrote a class WebServiceInvoker which acts as a wrapper around these web services. This wrapper class has 3 methods: do web service A, do web service B, and do web service C.…
has answer: http://stackoverflow.com/a/24930036
tagged with: design-patterns
downvote count: 1
has answer: http://stackoverflow.com/a/24929103
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38807227
tagged with: java
has comment: http://stackoverflow.com/comment/38736860
score: 4

http://stackoverflow.com/q/24961581
has body: created a "java" class in eclipse, when try to use same class name in same package again it showing error "type already defined". when write program in notepad and running in command prompt it overwriting class and not showing error, why not overwriting when using eclipse, to overwrite what need to do.
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/24961626
has comment: http://stackoverflow.com/comment/38798020
tagged with: eclipse
score: 0
answer count: 2
has title: why same class file in eclipse not overwriting and showing error type already defined
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38798013
has answer: http://stackoverflow.com/a/24961648

http://stackoverflow.com/comment/38978648
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25057365
score: 0
has text: Just a trick to get ASCII code as result :)

http://stackoverflow.com/comment/38898238
type: Comment
has text: @AnkitLamba They followed [best practices.](http://www.javapractices.com/topic/TopicAction.do?Id=58)
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/25014814

http://stackoverflow.com/comment/38906665
score: 1
comment on: http://stackoverflow.com/a/25019006
type: AnswerComment
type: Comment
has text: override your getArgCHFKey() method to return msv.getKey();

http://stackoverflow.com/comment/38816670
comment on: http://stackoverflow.com/q/24928803
score: 0
has text: @Fuhrmanator: Yes, I will add them now.
type: QuestionComment
type: Comment

http://stackoverflow.com/a/24962350
has comment: http://stackoverflow.com/comment/38808677
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24962280
type: Answer
answers question: http://stackoverflow.com/q/24962280
score: 1
upvote count: 1
has body: if there is anyway to import a java based code into python The Jython implementation of Python will allow you to import Java based code. Otherwise, you can use cross-language techniques such as XMLRPC, a REST API, a message queue.
downvote count: 0

http://stackoverflow.com/a/24991251
has body: You need to annotate the StudentsManager and DepartmentsManager either with @Component, @Repository or @Service based on what those classes do. And Also make sure they fall under the packages you are scanning in spring.
downvote count: 0
has comment: http://stackoverflow.com/comment/38855114
has comment: http://stackoverflow.com/comment/38853957
type: Answer
has comment: http://stackoverflow.com/comment/38854840
has comment: http://stackoverflow.com/comment/38854195
has comment: http://stackoverflow.com/comment/38854928
score: 1
has comment: http://stackoverflow.com/comment/38854620
has comment: http://stackoverflow.com/comment/38854014
answers question: http://stackoverflow.com/q/24991123
upvote count: 1

http://stackoverflow.com/q/24982634
has answer: http://stackoverflow.com/a/24987308
tagged with: sql
answer count: 1
tagged with: postgresql
has body: I have a question reqarding function/triggers in postgreSql. I havae 2 following classes: abstract public class person(){ int personid; } public class employee extends person(){ int employeeid; } I have also a sequence "hibernate_sequence" So what I want to achieve is: by inserting into employee I'd like to get the current value of the hibernate_sentence and pass it to "employeid", so that both id's are equal. So the trigger would be: CREATE TRIGGER equalid before insert on employee EXECUTE PROCEDURE setid; The function should do this: CREATE FUNCTION setid() RETURNS numeric as ' update employee set employeeid = select currval(hibernate_sequence) where personid = select currval(hibernate_sequence)' language SQL; But I have no idea how to achieve it. Postgresc doku is not clear to me at this point...
has title: PostgreSQL getSequence current value and pass to id
type: UnansweredQuestion
tagged with: java
tagged with: hibernate
type: Question
score: 0

http://stackoverflow.com/comment/38882444
comment on: http://stackoverflow.com/q/25005999
has text: How would you know that it was malicious? lol
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25055896
upvote count: 1
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/38977552
tagged with: java
answer count: 1
has title: How to show the SVG image in the android imageview
score: 0
tagged with: android
favorite count: 0
tagged with: http://stackoverflow.com/tag/svg
has answer: http://stackoverflow.com/a/25055985
has comment: http://stackoverflow.com/comment/38975769
has body: I have downloaded the svg-android library from the google code and parsed the SVG image using the SVG parser of svg-android as shown but its displaying nothing. SVG CODE &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14948) --&gt; &lt;!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"&gt; &lt;svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="500px" height="500px" viewBox="0 0 500 500" enable-background="new 0 0 500 500" xml:space="preserve"&gt; &lt;g id="max_width__x2F__height" display="none"&gt; &lt;path display="inline" d="M499.001,1v498H1V1H499.001 M500.001,0H0v500h500.001V0L500.001,0z"/&gt; &lt;/g&gt; &lt;g id="androd"&gt; &lt;path fill="#9FBF3B" d="M301.314,83.298l20.159-29.272c1.197-1.74,0.899-4.024-0.666-5.104c-1.563-1.074-3.805-0.543-4.993,1.199 L294.863,80.53c-13.807-5.439-29.139-8.47-45.299-8.47c-16.16,0-31.496,3.028-45.302,8.47l-20.948-30.41 c-1.201-1.74-3.439-2.273-5.003-1.199c-1.564,1.077-1.861,3.362-0.664,5.104l20.166,29.272 c-32.063,14.916-54.548,43.26-57.413,76.34h218.316C355.861,126.557,333.375,98.214,301.314,83.298"/&gt; &lt;path fill="#FFFFFF" d="M203.956,129.438c-6.673,0-12.08-5.407-12.08-12.079c0-6.671,5.404-12.08,12.08-12.08 c6.668,0,12.073,5.407,12.073,12.08C216.03,124.03,210.624,129.438,203.956,129.438"/&gt; &lt;path fill="#FFFFFF" d="M295.161,129.438c-6.668,0-12.074-5.407-12.074-12.079c0-6.673,5.406-12.08,12.074-12.08 c6.675,0,12.079,5.409,12.079,12.08C307.24,124.03,301.834,129.438,295.161,129.438"/&gt; &lt;path fill="#9FBF3B" d="M126.383,297.598c0,13.45-10.904,24.354-24.355,24.354l0,0c-13.45,0-24.354-10.904-24.354-24.354V199.09 c0-13.45,10.904-24.354,24.354-24.354l0,0c13.451,0,24.355,10.904,24.355,24.354V297.598z"/&gt; &lt;path fill="#9FBF3B" d="M140.396,175.489v177.915c0,10.566,8.566,19.133,19.135,19.133h22.633v54.744 c0,13.451…
type: UnansweredQuestion

http://stackoverflow.com/comment/38936542
type: QuestionComment
comment on: http://stackoverflow.com/q/25033896
has text: Yes. The parent table TRACKS has an ID with NOT NULL AUTO_INCREMENT
score: 0
type: Comment

opencv
type: Tag
tags question: http://stackoverflow.com/q/25059576
tags question: http://stackoverflow.com/q/25038064
tags question: http://stackoverflow.com/q/24909852
tag name: opencv
tags question: http://stackoverflow.com/q/25059951
tags question: http://stackoverflow.com/q/24934612
tags question: http://stackoverflow.com/q/25029042

http://stackoverflow.com/q/25030278
type: UnansweredQuestion
has title: Validate each object in a complex JSON string
has answer: http://stackoverflow.com/a/25030642
has comment: http://stackoverflow.com/comment/38927513
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: Question
has comment: http://stackoverflow.com/comment/38927814
score: 0
answer count: 1
has body: Need your expert advise here. So I have a complex JSON string that has multiple Java objects. Here is my JSON string. I have only listed one java object but it has plenty (each mapped to a java class in my code) { "myStoreInfo": { "id": "12370034", "address": australia, "partnerInfo": { "retailPartner": false }, "customerContactInfo": { "name": { "firstName": "Ricky", "middleName": "Sage", "lastName": "Higging", "gender": "Male", }, "customerPhone": { "areaCode": "", "extension": "", "completeNumber": "1234567", }, "contactEmail": { "emailAddress": "ricky@gmail.com" } } } } I basically need to validate a few elements in the entire JSON string to make sure they are not null. Here is the code for validation - public static String validateJSON(String jsonFile, Object objToValidate) throws JSONException { JSONObject myStoreInfo = jsonFileObj.getJSONObject("myStoreInfo"); JSONObject jsonObj = null; if(myStoreInfo!=null) { if(myStoreInfo.isNull("id")) return "myStoreInfo info id is null"; if(myStoreInfo.isNull("address")) return "myStoreInfo address field is null"; jsonObj = myStoreInfo.getJSONObject("partnerInfo"); if(jsonObj!=null) { if(jsonObj.isNull("retailPartner")) return "partner info retail partner is null"; } jsonObj = myStoreInfo.getJSONObject("customerContactInfo"); JSONObject name = jsonObj.getJSONObject("name"); if(name!=null) { if(name.isNull("firstName")) return "myStoreInfo first name is null"; if(name.isNull("lastName")) return "myStoreInfo last name is null"; } jsonObj = myStoreInfo.getJSONObject("customerContactInfo"); jsonObj = jsonObj.getJSONObject("contactEmail"); if(jsonObj==null) return "myStoreInfo email id is null"; } return null; } } This works well if I am doing the validation for one java object, and my json file has that java object only. But the fact is my json file has too many of these strings that internally map to various java objects. My question here is - I need to be able to pass these objects to validate them individually. As you can…
has comment: http://stackoverflow.com/comment/38927808

http://stackoverflow.com/a/68420347
has body: Yes..Abstract classes extend Java.lang.Object class like any other classes in Java. Compiler inserts "extends java.lang.Object" during compilation when a class is not extending any other class which means, a class extends Object class only when it doesn't have any other user defined Parent class. abstract class A { public abstract int hashCode(); public abstract boolean equals(Object obj); } class C extends A { // Compile error because methods are not overridden } Here, Class C is already extending A so it won't extend Object class. As you haven't provided the implementation of equals method , you will see a compilation error.
score: 0
answers question: http://stackoverflow.com/q/24938564
type: Answer

http://stackoverflow.com/comment/38873629
comment on: http://stackoverflow.com/a/25001527
score: 0
type: AnswerComment
has text: Did you try replacing backslash with forward slash?
type: Comment

http://stackoverflow.com/comment/43811241
comment on: http://stackoverflow.com/a/24982926
type: AnswerComment
type: Comment
has text: @Trejkaz: I don't know, but recent [screenshots](http://stackoverflow.com/a/27663749/230513) look promising.
score: 0

http://stackoverflow.com/comment/38807478
type: Comment
has text: Post your logcat or check logcat to see at which line it crashes.
comment on: http://stackoverflow.com/a/24966468
type: AnswerComment
score: 0

zxing
tags question: http://stackoverflow.com/q/24922433
tags question: http://stackoverflow.com/q/24981623
tag name: zxing
type: Tag
tags question: http://stackoverflow.com/q/24987990

http://stackoverflow.com/q/24956975
answer count: 2
tagged with: arrays
score: -1
has body: This is my 1st post on this website. So I apologize if do not format this message properly. For my project we are told to import a .dat file into the program and have the program read the file in reverse and print it on the screen. So far I have been able to print it on the screen however not in reverse. Any help would be greatly appreciated. import java.io.*; //Imports any file operation (ie Reading or Writing) import java.util.*; //Imports classes from util public class program2 { public static void main(String [] ars) throws IOException { int [] Values; //creating array called value Values = new int [20]; //establishing array has 20 cells int k; //creating counter integer Scanner InputFile = new Scanner( new FileReader("temp.dat")); /*temp.dat is simply a .dat file containing integers 1-20 in ascending order*/ for (k = Values.length - 1 ; k &gt;= 0 ; k--) { Values[k] = InputFile.nextInt(); System.out.println("Cell " + k + " contains a value of " + Values[k]); } InputFile.close(); } }
possible better answer: http://stackoverflow.com/a/24957182
has answer: http://stackoverflow.com/a/24957182
tagged with: reverse
accepted answer: http://stackoverflow.com/a/24957081
favorite count: 0
downvote count: 2
upvote count: 1
has title: problems printing Reverse Array from .dat file JAVA (Yes i have looked, still cannot figure it out)
type: AnsweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/24957081

http://stackoverflow.com/a/24978339
has comment: http://stackoverflow.com/comment/38850223
answers question: http://stackoverflow.com/q/24978218
has comment: http://stackoverflow.com/comment/38840715
has comment: http://stackoverflow.com/comment/38843549
has comment: http://stackoverflow.com/comment/38840952
has body: The file name you are using in the code is "accounts", not "accounts.txt". Also, I don't see a button being defined. After fixing the path name Now the Scanner complains (in line 54) that next() is called although there is no next token to be scanned. Normally, one calls `hasNext()? and proceeds only if this returns true. However, the idea of writing a file and reading from it before writing has been completed (i.e., close() has been called) is a no-no. I'm not sure what you want to achieve with your code, so I can't really suggest an improvement.
score: 0
type: Answer

http://stackoverflow.com/comment/38939172
has text: You wanted the program to exit once it reached turn 2. So once it gets to turn 2, there is no chance of changing it again.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25036200
type: Comment

http://stackoverflow.com/q/24926786
has answer: http://stackoverflow.com/a/53724328
has comment: http://stackoverflow.com/comment/92136695
has comment: http://stackoverflow.com/comment/115151332
has answer: http://stackoverflow.com/a/24928683
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: gson
answer count: 5
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24929569
has comment: http://stackoverflow.com/comment/38736428
upvote count: 12
downvote count: 0
has title: Make GSON deserialize numbers to integers or doubles
favorite count: 0
linked to: http://stackoverflow.com/q/16590377
has comment: http://stackoverflow.com/comment/38734341
type: Question
has answer: http://stackoverflow.com/a/24927288
score: 12
has body: I am having a hard time with GSON. I have a simple JSON that I want to deserialize to a Map&lt;String,Object&gt;. It's really intuitive to me that 123 should be parsed as an int (or long), 123.4 as a float( or double). GSON on the other hand creates Doubles all the time. Can I tell GSON to not abuse double all the time? My actual code: Type mapType = new TypeToken&lt;Map&lt;String, Object&gt;&gt;() {}.getType(); GSON gson = new Gson(); Map&lt;String, Object&gt; map = gson.fromJson(someString, mapType);
linked to: http://stackoverflow.com/q/23695649
has answer: http://stackoverflow.com/a/78028230

http://stackoverflow.com/comment/38759813
type: QuestionComment
score: 1
has text: If the crash is within the Java code, you would get a call stack. So is the crash within Java, or is it within your C++ code? If it's in the C++ code, you get those "HotSpot JVM" error log generated. Do you see any?
comment on: http://stackoverflow.com/q/24940878
type: Comment

http://stackoverflow.com/comment/38924642
comment on: http://stackoverflow.com/q/25028682
type: Comment
has text: Add a break point, fire up the debugger, step through the code...
type: QuestionComment
score: 2

http://stackoverflow.com/q/24936763
upvote count: 2
downvote count: 2
has answer: http://stackoverflow.com/a/24936808
linked to: http://stackoverflow.com/q/24909882
tagged with: startup
type: Question
has body: I started coding my first app in Android Studio, what it should do at this stage is that you click a button with the digit and it outputs it into the textfield. When i run this code the application crashes right on startup and I have no idea what's wrong. MyActivity.java package com.example.david.calculator; import android.app.Activity; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.Button; import android.widget.EditText; import org.w3c.dom.Text; public class MyActivity extends Activity { EditText results; private int number; final EditText result = (EditText) findViewById(R.id.number); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_my); Button one = (Button) findViewById(R.id.button); one.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { BtnPressed(1); } }); } private void BtnPressed(int i) { result.setText(Integer.toString(i)); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.my, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } } activity_my.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:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" android:pa…
tagged with: java
has title: Android application crashes every time on startup
accepted answer: http://stackoverflow.com/a/24936851
score: 0
tagged with: crash
has comment: http://stackoverflow.com/comment/38752520
favorite count: 0
possible better answer: http://stackoverflow.com/a/24936840
tagged with: android
has answer: http://stackoverflow.com/a/24936840
answer count: 4
has answer: http://stackoverflow.com/a/24936807
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24936851

http://stackoverflow.com/q/24949018
has answer: http://stackoverflow.com/a/24951963
has body: I am trying to fill my struts2 select with this method but all I am getting is empty dropdown. This is my action method private List&lt;String&gt; districtList = new ArrayList&lt;String&gt;(); public String get_DistrictList(){ try{ currentCon = ConnectionManager.getConnection(); Statement stmt = (Statement) currentCon.createStatement(); rs = stmt.executeQuery("SELECT district_id, district_name FROM district"); while(rs.next()) districtList.add(rs.getString("district_name")); districtList.add(rs.getString("district_id")); }catch(Exception e){ System.out.println("Error From DAO:" + e); } return SUCCESS; } my jsp &lt;s:select label="Select District" id="district_list" headerKey="-1" headerValue="Select District" list="districtList" listKey="district_id" listValue="district_name" tooltip="Select District" name="notaryposition.district" /&gt; when i used only single add in districtList &amp; deleted listKey &amp; listValue it was working properly but I want both key and value in my select. Is there a way? Thanks in advance :)
tagged with: list
tagged with: java
tagged with: select
upvote count: 1
has title: fill select in struts2
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/24949105
has comment: http://stackoverflow.com/comment/38775005
tagged with: struts2
score: 0
answer count: 2
linked to: http://stackoverflow.com/q/10429804
tagged with: jsp
linked to: http://stackoverflow.com/q/8609752
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/q/24956379
has comment: http://stackoverflow.com/comment/38788353
has comment: http://stackoverflow.com/comment/38790112
favorite count: 0
has body: Hi I an using an expandable listview in android. For populating the list I am using an hashmap as i want to map the corresponding categories to its child. My hashmap is like Hashmap> .Now the following code is used : public class ExpandableListAdapter extends BaseExpandableListAdapter { private Context _context; // child data in format of header title, child title private Map&lt;SaleDetailsMenuItems, List&lt;ModifList&gt;&gt; _listDataChild; public ExpandableListAdapter(Context context, Map&lt;SaleDetailsMenuItems, List&lt;ModifList&gt;&gt; listChildData) { this._context = context; this._listDataChild = listChildData; } @Override public Object getChild(int groupPosition, int childPosititon) { Set&lt;SaleDetailsMenuItems&gt; s = _listDataChild.keySet(); SaleDetailsMenuItems key = (SaleDetailsMenuItems) s.toArray()[groupPosition]; //List&lt;SaleDetailsMenuItems&gt; list = new ArrayList&lt;SaleDetailsMenuItems&gt;(s); //Log.e("Child in adapter get Child","get child "+this._listDataChild.get(key).get(childPosititon)); return this._listDataChild.get(key).get(childPosititon); } @Override public long getChildId(int groupPosition, int childPosition) { return childPosition; } @Override public View getChildView(int groupPosition, final int childPosition,boolean isLastChild, View convertView, ViewGroup parent) { String childText = ((ModifList)getChild(groupPosition, childPosition)).getName(); String childText1 = "1"; String childText2 = ((ModifList)getChild(groupPosition, childPosition)).getPrice(); if (convertView == null) { LayoutInflater infalInflater = (LayoutInflater) this._context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); convertView = infalInflater.inflate(R.layout.list_item, null); } TextView txtListChild = (TextView) convertView.findViewById(R.id.lblListItem); TextView txtListChild1 = (TextView) convertView.findViewById(R.id.lblListItem1); TextView txtListChild2 = (TextView) convertView.findViewById(R.id.lblListItem2); txtListChild.setText(childText); txtList…
has comment: http://stackoverflow.com/comment/38788230
tagged with: android
downvote count: 0
accepted answer: http://stackoverflow.com/a/24956614
has title: How to convert a set to list ? The set is used as a key in Hashmap
tagged with: expandablelistview
type: AnsweredQuestion
tagged with: list
tagged with: hashmap
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/38788124
has answer: http://stackoverflow.com/a/24956614
type: Question
upvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/38789356

http://stackoverflow.com/a/25072252
has body: Try moving the definition of the onClickListener object into the onCreate method. You can declare it as a member variable, but you should create the object and assign it to the field in onCreate()
type: Answer
answers question: http://stackoverflow.com/q/25069037
score: 0

http://stackoverflow.com/comment/38871645
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25000708
score: 1
has text: What error are you getting? If you are getting an exception, please include the full stack trace in your question. Also, you probably should not call `con.disconnect()` on an HttpURLConnection you are about to use.

http://stackoverflow.com/comment/38729503
score: 1
type: AnswerComment
has text: Create another class, which models the virtual state of your world. Maintains information about where paricales are, where objects are. You could use `Point` and `Rectangle` to do this, but that's up to you. You would create this model in the constructor and then pass it to whatever is rendering/updating the state of the world. The panel would use the model to determine what to paint and the updater would determine what needs to be updated (or instructs the model that it should update)
type: Comment
comment on: http://stackoverflow.com/a/24923935

findbugs
tags question: http://stackoverflow.com/q/24968959
type: Tag
tag name: findbugs
tags question: http://stackoverflow.com/q/24952015
tags question: http://stackoverflow.com/q/24990996

http://stackoverflow.com/comment/38818782
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24964674
type: Comment
has text: F2 should be bound to the show information action as long as the `org.eclipse.ui.textEditorScope` context is active.

http://stackoverflow.com/comment/38781836
comment on: http://stackoverflow.com/q/24950277
type: Comment
type: QuestionComment
has text: This is just testing Google's Analytics JavaScript (which Google will already do!). I don't understand how this achieves anything.
score: 0

http://stackoverflow.com/comment/38842679
comment on: http://stackoverflow.com/q/24978867
has text: No. You really need to be able to do some research for yourself. You can't expect to be spoonfed every single detail of everything. Look up the documentation for `javac`, search on the web... there are *lots* of places to find more information.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25041245
has body: That xProcRESTFramework does not exist in the Maven's repository. http://search.maven.org/#search%7Cga%7C1%7CxProcRESTFramework If you can find the xProcRESTFramework files you can create a local maven repository and add it to your maven project.
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25041070
answers question: http://stackoverflow.com/q/25041070
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/38948146
has comment: http://stackoverflow.com/comment/38947984

http://stackoverflow.com/comment/38815919
score: 0
has text: And `s` will not point to the interned string -- it will be its own object.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24971120

http://stackoverflow.com/a/24967856
has body: 1.) Make your app which sends your Location to the server and save the info with device ID and location there. 2.) From your server send the location of your app to your device and let the details retrieved from server locate your device(eg, on maps). 3.) Now, for multiple devices scenario all the devices with your app sends their location to server individually and then from server, you need to send the cumulative list of data back to each of the device requesting it. 4.) Now you have got all the location data(say address or latitude, longitude or GeoPoint etc.,.) of near by devices. you can just show that on Google Maps. For reference you need GOOGLE MAPS Location Manager Also, check this Giude for Location Then add Markers
score: 0
type: Answer
answers question: http://stackoverflow.com/q/24965901

http://stackoverflow.com/a/25015585
upvote count: 1
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/25014814
has body: Here's a quick re-factoring that reuses the connection and uses prepared statements. I'm not sure what database driver you're using so the open/close and prepared statement stuff should get you into the ballpark but is likely syntactically incorrect. private static final String KEYWORD_INSERT = "INSERT INTO " + dbtablename + "(company_name, job_title, date_created, location, platform, keyword)" + "VALUES(?, ?, ?, ?, ?, ?)"; public void getData(Database c) throws IOException { try { Connection connection = c.getDbConnection(); PreparedStatement stmt = connection.prepareStatement(KEYWORD_INSERT); CSVReader reader = new CSVReader(new FileReader(csvFilename), ';'); String[] row; while((row = reader.readNext()) != null) { for (int i=0; i&lt; row.length; i=i+2 ) { Document document = Jsoup.parse(new File("C:/Talend/workspace/WEBCRAWLER/output/keywords_"+row[i].trim()+".txt"), "utf-8"); Elements elements = document.select(".joblisting"); for (Element element : elements) { // Parse Data into Elements Elements jobTitleElement = element.select(".job_title span"); Elements companyNameElement = element.select(".company_name span[itemprop=name]"); Elements locationElement = element.select(".locality span[itemprop=addressLocality]"); Elements dateElement = element.select(".job_date_added [datetime]"); // Strip Data from unnecessary tags String companyName = companyNameElement.text(); String jobTitle = jobTitleElement.text().replaceAll("\"", ""); String location = locationElement.text(); String timeAdded = dateElement.attr("datetime"); stmt.setString(1, companyName); stmt.setString(2, jobTitle); stmt.setString(3, timeAdded); stmt.setString(4, location); stmt.setString(5, platform); stmt.setString(6, row[i].trim()); stmt.executeUpdate(); } } } } finally { stmt.close(); connection.close(); } }
score: 1

http://stackoverflow.com/a/24969420
has comment: http://stackoverflow.com/comment/38812919
type: Answer
has comment: http://stackoverflow.com/comment/38813042
has comment: http://stackoverflow.com/comment/38812921
has body: Your constructor requires a string as an argument (which you have called name): public BusRoute(String name) { // ... } If you want to use the argumentless-contrstructor, you need to declare it as so: public BusRoute() { this.name = "Unknown"; } This is because, as other answers have pointed out, when you declare your own constructor, the Java compiler no longer automatically creates an argument-less one for you. EDIT: This would also work as a simplified version: public BusRoute(String name) { this.name = name; this.bounds = new BoundingBox(); segments = new ArrayList&lt;Segment&gt;(); //this.mapURL = mapURL; } public BusRoute() { this("Unknown"); } This way, you also get those bounds and segments being set up properly.
score: 0
has comment: http://stackoverflow.com/comment/38813067
answers question: http://stackoverflow.com/q/24969399

http://stackoverflow.com/a/24914394
score: 1
has comment: http://stackoverflow.com/comment/38710730
upvote count: 1
answers question: http://stackoverflow.com/q/24914099
has body: What you need is to have a reference to the JFrame you want to modify. I'm assuming your code looks something like this: class MyFrame extends JFrame{ public JTextArea textArea = new JTextArea(); public MyFrame(){ super(); FontChooser fc = new FontChooser(); fc.applyFont(); } } class FontChooser{ public void applyFont(){ Font f; //code to set font values MyFrame.textArea.setFont(f);//Won't work, because textArea isn't static } } What you need is something like this class MyFrame extends JFrame{ public JTextArea textArea = new JTextArea(); public MyFrame(){ super(); fc.applyFont(textArea) } } class FontChooser{ public void applyFont(JTextArea textArea){//Notice the added parameter Font f; //code to set font values textArea.setFont(f);//Will work, because we have an instance of the object we want to modify. } } Obviously this needs to be modified for your code, but that's the idea. You need to pass a reference to the Object you want to modify.
type: Answer
has comment: http://stackoverflow.com/comment/38710698
has comment: http://stackoverflow.com/comment/38710804
downvote count: 0

http://stackoverflow.com/comment/38825803
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24976138
has text: tried that multiple times as well

http://stackoverflow.com/a/24935495
has comment: http://stackoverflow.com/comment/38749092
score: 0
has body: @Override protected void doInBackground(params....) { //Download sourcecode on String String secondaChar = result; //Strings declaration String First = ""; String Second = ""; try { //Writing sourcecode on string Write(secondaChar); String ReadingFile="FileSorgente"; First=reading(ReadingFile); while (true) { // Downloading new sourcecode on string secondaChar = result.replaceAll("[^a-zA-Z]+", ""); //writing new SC on string Scrittura(secondaChar); // new SC on second string Second = Reading(ReadingFile); // check until 2 strings are the same if(First.equalsIgnoreCase(Second)) { publishProgress( "Keep Checking" ); } else { publishProgress( "FALSE" ); break; } Thread.sleep(60 * 1000); } } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } publishProgress("Usless"); } @Override protected void onProgressUpdate(String... progress) { showToast(progress[0]); }
answers question: http://stackoverflow.com/q/24935434
type: Answer

http://stackoverflow.com/comment/105830347
has text: This question is as relevant in 2020 as when it was written in 2014. I have just added a comment to the current single answer, explaining why it seems not the current "right" answer. So I'd love to hear if anyone else may have any other solutions.
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/25035543

http://stackoverflow.com/comment/38979981
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25058351
score: 3
has text: i was terrified by tags ON seeing **Java** and **pointers** together .. (O_o)

http://stackoverflow.com/a/24989918
answers question: http://stackoverflow.com/q/24989609
type: Answer
has body: No need for anything 'in background'. Just set a reasonable read timeout with Socket.setSoTimeout(), and handle the resulting SocketTimeoutException by closing the socket and exiting the thread.
score: 0

http://stackoverflow.com/q/24919841
has answer: http://stackoverflow.com/a/24919953
has answer: http://stackoverflow.com/a/24919957
has comment: http://stackoverflow.com/comment/38722241
has body: I recently saw an online presentation of JRebel in which they explain what their product does, in one of the slides they mention they don't use class loaders (see screenshot below). I have some projects in which I use class loaders for dynamically loading classes at runtime, for example for dependency injection (like in the Maker Factory framework that I developed). I thought the only way to load a class in Java was by using a class loader.
upvote count: 5
score: 5
has comment: http://stackoverflow.com/comment/38720210
has answer: http://stackoverflow.com/a/24920668
downvote count: 0
answer count: 7
favorite count: 0
possible better answer: http://stackoverflow.com/a/24920008
tagged with: classloader
has title: How to dynamically load a Java class without using a class loader?
accepted answer: http://stackoverflow.com/a/24943298
has answer: http://stackoverflow.com/a/62453511
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24919947
tagged with: java
tagged with: jrebel
has answer: http://stackoverflow.com/a/24943298
type: Question
has answer: http://stackoverflow.com/a/24920008

http://stackoverflow.com/q/24926747
type: Question
has answer: http://stackoverflow.com/a/24926777
upvote count: 0
has comment: http://stackoverflow.com/comment/38732618
score: -1
tagged with: deadlock
answer count: 3
favorite count: 0
accepted answer: http://stackoverflow.com/a/24926777
has title: this code is deadlocked.how can i solve it?
has answer: http://stackoverflow.com/a/24926773
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24926829
tagged with: java
possible better answer: http://stackoverflow.com/a/24926773
has body: Is there any way to solve this code? I cannot go past the runtime ... and why is this happening? public void method1(){ synchronized(String.class){ System.out.println("Aquired lock on String.class object"); synchronized (Integer.class) { System.out.println("Aquired lock on Integer.class object"); } } } public void method2(){ synchronized(Integer.class){ System.out.println("Aquired lock on Integer.class object"); synchronized (String.class) { System.out.println("Aquired lock on String.class object"); } } }
downvote count: 1

http://stackoverflow.com/q/24939349
tagged with: java
has body: I'm studying Java using the book by Gosling. There is a question in the chapter devoted to the multithread programming: Write a program, which will create a message each second from the beginning of the session. Another thread of this program should create a message each 15 sec. You should provide the possibility of every second-notification by the thread which is counting time. Here is my solution (it doesn't work and i can't understand why, i think, i just can't properly understand the principle on creating a thread): public class test { public static void main (String [] args) throws InterruptedException{ chrono my=new chrono(); my.timer(); Runnable t1=new messenger(5); Runnable t2=new messenger(1); new Thread(t1, "t1").start(); new Thread(t2, "t2").start(); } } class chrono { static int time=0; public synchronized void timer() throws InterruptedException { Thread.sleep(1000); time++; System.out.println(time); notifyAll(); } } class messenger implements Runnable { int time; messenger(int time) { this.time=time; } synchronized void timerListener() { try { while (chrono.time%time!=0) { wait(); } System.out.println("Thread "+this.time); } catch(InterruptedException e) {} } public void run() { timerListener(); } } New version: public class test { public static void main (String [] args) throws InterruptedException{ Chronometr my=new Chronometr(); Runnable t1=new Messenger(5, my); new Thread(t1, "t1").start(); for (int i=0;i&lt;6;i++) { synchronized(my) { my.timeCount(); my.notifyAll(); } } } } class Chronometr { static int time=0; public void timeCount() throws InterruptedException { Thread.sleep(1000); time++; System.out.println(time); } } class Messenger implements Runnable{ int time; public Chronometr ch; Messenger(int time, Chronometr ch) { this.time=time; this.ch=ch; } public void waitForTime() { synchronized (ch) { try{ while (Chronometr.time%time!=0) ch.wait(); System.out.println("Thread "+this.time); } catch(InterruptedException e) {} } } public void run() { …
downvote count: 3
has comment: http://stackoverflow.com/comment/38756642
type: Question
upvote count: 1
score: -2
answer count: 1
has title: Problems with multithread programming in Java
favorite count: 0
has comment: http://stackoverflow.com/comment/38756406
type: UnansweredQuestion
tagged with: multithreading
has comment: http://stackoverflow.com/comment/38756329
has answer: http://stackoverflow.com/a/24942710

http://stackoverflow.com/q/25053124
has body: I have developed a web service for Portal 7.0 and deployed the application into an environment. The installation and start up of the application is fine, however, when the web service is invoked, the following error appears in the SystemOut.log a few hundred times. The server then starts reporting other errors about 'Too many open files' until the application is stopped or the services restarted. [7/29/14 8:45:56:647 EST] 00000057 WSClassFinder E WSWS7058E: A JAXBContext could not be created correctly because of the following error: java.util.zip.ZipException: error in opening zip file [7/29/14 8:45:56:647 EST] 00000057 WSClassFinder E WSWS7058E: A JAXBContext could not be created correctly because of the following error: java.util.zip.ZipException: error in opening zip file Strange thing is we have a development and production environment that are basically identical (Same Linux OS version + WAS and Portal 7.0.0.23). Initially the web service worked fine in dev, but an attempt to use it in production failed (Not a good look). After rebooting dev, the problem started to occur there as well (at least it is now consistent). I also tried to build the most basic of basic web service applications (it just returns a single static string) and even that failed with exactly the same result when invoked. I have a separate development environment where I do most of my work which is separate to the one above, but with the same app versions. This one has always worked fine. This suggests it is a configuration or server issue. I have used tracing on the com.ibm.ws.classloader and java.util.zip without any very useful information. Class loader didn't seem to clearly indicate the root of the problem and java.util.zip didn't report anything in the trace. Unfortunately I'm stuck with where to look for options to correct this. It could be an OS file permissions problem, but its not clear where this may be. There is an upgrade of this environment planned, but because it was previously …
tagged with: web-services
has title: How to correct the error 'java.util.zip.ZipException: error in opening zip file' invoking web service on WAS with Portal
type: Question
score: 0
has comment: http://stackoverflow.com/comment/38971194
answer count: 2
possible better answer: http://stackoverflow.com/a/25053764
has answer: http://stackoverflow.com/a/25053764
tagged with: websphere-portal
type: AnsweredQuestion
tagged with: http://stackoverflow.com/tag/zip
has answer: http://stackoverflow.com/a/25151274
accepted answer: http://stackoverflow.com/a/25151274
tagged with: java

http://stackoverflow.com/q/25057176
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25057274
score: 0
tagged with: java
has title: Java Tipification
type: Question
accepted answer: http://stackoverflow.com/a/25057274
answer count: 1
tagged with: mvp
has body: I have the following classes: public abstract class _AbstractModel {} public abstract class _AbstractPresenter&lt;V extends _AbstractView&lt;?&gt;, M extends _AbstractModel&gt; {} public abstract class _AbstractView&lt;P extends _AbstractPresenter&lt;?, ?&gt;&gt; {} How can I write: public abstract class _AbstractModel {} public abstract class _AbstractPresenter&lt;V extends _AbstractView&lt;P extends this&gt;, M extends _AbstractModel&gt; {} public abstract class _AbstractView&lt;P extends _AbstractPresenter&lt;V extends this, M extends _AbstractModel&gt;&gt; {} Thank you in advance.

http://stackoverflow.com/comment/38811813
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/24967768
score: 0
has text: But problem is why he is repeating. If I remove this code(redirect), everything will be ok

http://stackoverflow.com/comment/38737122
comment on: http://stackoverflow.com/q/24929265
has text: but i have done it u can see!!
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24961253
favorite count: 0
upvote count: 2
type: UnansweredQuestion
tagged with: android
score: 2
tagged with: java
has body: Is there any dynamic linking to classes outside of classes.dex when running Android app at device? Or all the Java (Dalvik) code is inside.
type: Question
downvote count: 0
has title: Understanding Java code linking in classes.dex
has answer: http://stackoverflow.com/a/24961323
answer count: 1

web-services
type: Tag
tags question: http://stackoverflow.com/q/25015416
tags question: http://stackoverflow.com/q/24927817
tags question: http://stackoverflow.com/q/24927864
tags question: http://stackoverflow.com/q/24943629
tags question: http://stackoverflow.com/q/24998026
tags question: http://stackoverflow.com/q/25012989
tags question: http://stackoverflow.com/q/25060321
tags question: http://stackoverflow.com/q/24992452
tags question: http://stackoverflow.com/q/24915008
tags question: http://stackoverflow.com/q/24917712
tags question: http://stackoverflow.com/q/24934558
tags question: http://stackoverflow.com/q/24928734
tags question: http://stackoverflow.com/q/25049730
tags question: http://stackoverflow.com/q/25059114
tags question: http://stackoverflow.com/q/24999791
tags question: http://stackoverflow.com/q/24934469
tags question: http://stackoverflow.com/q/25033435
tags question: http://stackoverflow.com/q/24955184
tags question: http://stackoverflow.com/q/25009365
tags question: http://stackoverflow.com/q/25045688
tags question: http://stackoverflow.com/q/24959225
tags question: http://stackoverflow.com/q/24928313
tags question: http://stackoverflow.com/q/24962909
tags question: http://stackoverflow.com/q/24998524
tags question: http://stackoverflow.com/q/25041894
tags question: http://stackoverflow.com/q/25050840
tags question: http://stackoverflow.com/q/24995358
tags question: http://stackoverflow.com/q/24952403
tags question: http://stackoverflow.com/q/24991200
tags question: http://stackoverflow.com/q/24911813
tags question: http://stackoverflow.com/q/25053506
tags question: http://stackoverflow.com/q/24909724
tags question: http://stackoverflow.com/q/25043212
tags question: http://stackoverflow.com/q/24995307
tags question: http://stackoverflow.com/q/24933819
tags question: http://stackoverflow.com/q/24923755
tags question: http://stackoverflow.com/q/24958040
tags question: http://stackoverflow.com/q/25052053
tags question: http://stackoverflow.com/q/25032651
tags question: http://stackoverflow.com/q/25046942
tags question: http://stackoverflow.com/q/25038393
tags question: http://stackoverflow.com/q/25041931
tag name: web-services
tags question: http://stackoverflow.com/q/25041089
tags question: http://stackoverflow.com/q/24979035
tags question: http://stackoverflow.com/q/24924484
tags question: http://stackoverflow.com/q/25056692
tags question: http://stackoverflow.com/q/24950276
tags question: http://stackoverflow.com/q/24938472
tags question: http://stackoverflow.com/q/24962664
tags question: http://stackoverflow.com/q/25045267
tags question: http://stackoverflow.com/q/25015622
tags question: http://stackoverflow.com/q/25050073
tags question: http://stackoverflow.com/q/25053124
tags question: http://stackoverflow.com/q/25059555
tags question: http://stackoverflow.com/q/24963647
tags question: http://stackoverflow.com/q/25066282
tags question: http://stackoverflow.com/q/24952440
tags question: http://stackoverflow.com/q/24941509
tags question: http://stackoverflow.com/q/24953103
tags question: http://stackoverflow.com/q/25028384
tags question: http://stackoverflow.com/q/24910286
tags question: http://stackoverflow.com/q/25030989
tags question: http://stackoverflow.com/q/24948659

http://stackoverflow.com/a/24963553
answers question: http://stackoverflow.com/q/24963352
has comment: http://stackoverflow.com/comment/38804281
accepted answer of: http://stackoverflow.com/q/24963352
has comment: http://stackoverflow.com/comment/38803619
has comment: http://stackoverflow.com/comment/38804192
score: 0
has body: Create a method that checks if a value exists more than once in the array boolean isDuplicate(double x, double[] array, int checkUpTo){ numOfOccurencies = 0; for(int i = 0; i &lt;= checkUpTo; i++) if(x == array[i]) numOfOccurencies++; return(numOfOccurencies &gt; 1)? true : false; } and then for (k = 0 ; k &lt; values.length ; k++) if(!isDuplicate(values[k], values, k) System.out.println(values[k]); So every time you try to print a double from the array you check up to that index if the double appears more than once. That way you guarantee than you will print everything at least once. for example if you have a value appear at index 2 and index 4 then you check first at index 2 and since you check up to that index the value is not duplicate and gets printed. After that you check up to 4 and find the second occurrance so value is not printed. Hope this helps EDIT: i was assuming that you only want to get rid of duplicates when you print. If you dont want to store duplicate values you need something similar: boolean isDuplicate(double x, double[] array){ for(int i = 0; i &lt; array.length; i++) if array[i] == x return true; return false; } while (InputFile.hasNextDouble()) //read values from file using ascending while loop { double temp = InputFile.nextDouble(); if(!isDuplicate(temp, values){ values[k] = temp k++; } } for (k = 0 ; k &lt; values.length ; k++) System.out.println(values[k]);
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/38804229
has comment: http://stackoverflow.com/comment/38803687
has comment: http://stackoverflow.com/comment/38804083

http://stackoverflow.com/comment/38895656
has text: How? "SELECT * FROM sample_final_attendance limit 1000" - this will only ever return the first 1000 rows from the database - doesn't matter what you fetch size is - you'll only ever get 1000 rows. And if you move to the 200,000th row on the result set, you'll be placed after the end of the result set, and `rs.next()` will return `false`.
comment on: http://stackoverflow.com/q/25008939
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/24936566
score: 5
tagged with: android
has body: i need a piece of code to check whether is my url reachable to download a pdf file. here is my own attemp: @Override protected Boolean doInBackground(String... strings) { String fileUrl = strings[0]; // -&gt; http://maven.apache.org/maven-1.x/maven.pdf String fileName = strings[1]; // -&gt; maven.pdf try { //this is piece of code i use for check url reachable, not working atm. if(InetAddress.getByName(fileUrl).isReachable(10000) &amp;&amp; !fileName.contains(".pdf")){ String extStorageDirectory = Environment.getExternalStoragePublicDirectory( Environment.DIRECTORY_DOWNLOADS).toString(); File folder = new File(extStorageDirectory, documentActivity.getString(R.string.pdf_file_store_folder)); folder.mkdir(); File pdfFile = new File(folder, fileName); try{ pdfFile.createNewFile(); }catch (IOException e){ e.printStackTrace(); } FileDownloader.downloadFile(fileUrl, pdfFile); return true; } } catch (IOException e) { return false; } return false; } this is piece of code in my async task... my downloader class all working good. i just need one line to check to see if my url is reachable or not... and the obove code doesnt really work.. please help with some example code. thx
type: AnsweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/24937165
upvote count: 5
has comment: http://stackoverflow.com/comment/38750990
has comment: http://stackoverflow.com/comment/38750995
has comment: http://stackoverflow.com/comment/38751408
downvote count: 0
answer count: 1
tagged with: url
has title: android, check url is reachable to download stuff
favorite count: 0
tagged with: download
accepted answer: http://stackoverflow.com/a/24937165

http://stackoverflow.com/comment/38916600
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25009278
score: 1
has text: A Hibernate Session is the same thing with the JPA's EntityManager. In standard JEE, an extended persistence context is usually implemented with [Stateful Session Beans](https://blogs.oracle.com/enterprisetechtips/entry/extended_persistence_context_in_stateful). Adam Bien's "Rethinking Best Practices" has a very good example of this pattern. For "detached objects" you just have to pass entities out of your service layer to the View layer and they become "detached", being no longer managed by the Persistence Context. The next request might resend the "detached entities" back to service.

http://stackoverflow.com/comment/38918706
comment on: http://stackoverflow.com/a/25025414
type: Comment
score: 0
has text: +1 You can store meta data as a String and parse it however you like e.g. method names with arguments/expressions as well as classes.
type: AnswerComment

http://stackoverflow.com/q/25010502
downvote count: 0
tagged with: web
accepted answer: http://stackoverflow.com/a/25050947
favorite count: 0
upvote count: 2
has comment: http://stackoverflow.com/comment/38891573
has comment: http://stackoverflow.com/comment/38890336
tagged with: annotations
tagged with: spring
possible better answer: http://stackoverflow.com/a/25010564
tagged with: model-view-controller
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25015923
has answer: http://stackoverflow.com/a/25010564
has title: Get the class on which the annotation is applied
tagged with: java
has body: I am building a custom annotation inside which there is a field of Class type. How do I set a value in it while using the annotation? Code is given below : @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.TYPE) public @interface SpringCache { String putIt(); String getIt(); Class c(); } This is my custom annotation. Now while I use it how do I give class to variable "c"? @SpringCache(putIt="I'm put", getIt="I'm get", c=&lt;??&gt;) public class TestSpringCache { public static void main(String[] args) { System.out.println(); } } As in this case I want c=TestSpringCache.class.
has answer: http://stackoverflow.com/a/25050947
type: Question
has comment: http://stackoverflow.com/comment/38890048
answer count: 3
score: 2

http://stackoverflow.com/comment/38774593
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24925723
has text: Hi, thanks for the fn: suggestion. I updated the question to make my real problem clearer.
score: 0

http://stackoverflow.com/q/25003404
accepted answer: http://stackoverflow.com/a/25003519
answer count: 1
downvote count: 0
has title: Are there alternatives to extending/overriding private classes/methods?
favorite count: 0
has answer: http://stackoverflow.com/a/25003519
tagged with: android
score: 2
has body: I want to customize the way a CalendarView is drawn in Android. Here's how CalendarView.java looks in the AOSP source code: public class CalendarView extends FrameLayout{ private class WeekView extends View{ protected void onDraw(..){ drawBackground(..); drawWeekNumbersAndDates(..); drawWeekSeparators(..); drawSelectedDateVerticalBars(..); } private void drawBackground(..){..} private void drawWeekNumbersAndDates(..){..} private void drawWeekSeparators(..){..} private void drawSelectedDateVerticalBars(..){..} } } Since the relevant bits are declared private, I can't just extend/override them (or can I?). Copying the whole source file and then making changes may be problematic, because the file is part of a package (android.widget) I do not own.
upvote count: 2
type: AnsweredQuestion
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/38876830

http://stackoverflow.com/a/24910596
has comment: http://stackoverflow.com/comment/38703163
upvote count: 1
has body: Your purchase Method uses a different signature than you are calling. purchase requires String, double, int, Book[] as arguments, but you are trying to call it with String, double, int. Try adding a Book-Array. On top of that, looking through purchase it looks like most of the arguments are not even being used. You should consider using those arguments or removing them. PS: You may want to consider using an IDE like Eclipse, Netbeans, or IntelliJ IDEA to help catch such common mistakes :)
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38704038
has comment: http://stackoverflow.com/comment/38702119
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/38704679
has comment: http://stackoverflow.com/comment/38702249
has comment: http://stackoverflow.com/comment/38703430
has comment: http://stackoverflow.com/comment/38703742
accepted answer of: http://stackoverflow.com/q/24910541
has comment: http://stackoverflow.com/comment/38704567
has comment: http://stackoverflow.com/comment/38703009
score: 1
answers question: http://stackoverflow.com/q/24910541
has comment: http://stackoverflow.com/comment/38703205
has comment: http://stackoverflow.com/comment/38704454
has comment: http://stackoverflow.com/comment/38702799

http://stackoverflow.com/comment/38842747
score: 0
comment on: http://stackoverflow.com/q/24983373
type: Comment
type: QuestionComment
has text: The basic trick is to write a custom adapter that always reports three items, but manages which three are the previous, current, and next.

http://stackoverflow.com/a/24916702
downvote count: 0
has comment: http://stackoverflow.com/comment/38714809
has body: How about making a method: public void inputThenShow() { input(); show(); } Then call with new Emp().inputThenShow();
type: Answer
has comment: http://stackoverflow.com/comment/38714716
has comment: http://stackoverflow.com/comment/38715961
answers question: http://stackoverflow.com/q/24916639
has comment: http://stackoverflow.com/comment/38713867
score: 4
upvote count: 4

http://stackoverflow.com/a/24991905
has body: Possibly the underlying code uses AES with a 256 bit key, which is not allowed by the default Java security-policy (due to US export laws). To fix this you can install the unlimited policy files for JCE. Download them from: http://www.oracle.com/technetwork/java/javase/downloads/index.html
type: Answer
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/24991671
upvote count: 2

header
type: Tag
tags question: http://stackoverflow.com/q/24981879
tag name: header
tags question: http://stackoverflow.com/q/24979362

http://stackoverflow.com/comment/38810896
type: Comment
comment on: http://stackoverflow.com/q/24964674
has text: What is it you want to do that can't be done using the various extension interfaces supported by `InformationDispatchAction`? Such as `ITextViewerExtension2`, `ITextViewerExtension4`, `ISourceViewerExtension3`, `IInformationProviderExtension2`
score: 0
type: QuestionComment

http://stackoverflow.com/a/25012757
downvote count: 1
answers question: http://stackoverflow.com/q/25012675
score: -1
has body: You should remove final. Instead use nothing or public
type: Answer
upvote count: 0

http://stackoverflow.com/q/25040691
tagged with: jmockit
has body: I am currently using a invocation class to implement my current test requirements however these will get very messy as more conditions need to be added, Does anyone know a better solution with some examples? @Rogério @Mock boolean next(Invocation in) { logger.info("invocation count" + in.getInvocationCount()); if (in.getInvocationCount() % 2 == 0 &amp;&amp; in.getInvocationCount() != 1) { logger.info("from resultset" + in.getInvocationCount()); return false; } return true; }
has comment: http://stackoverflow.com/comment/38952697
downvote count: 0
favorite count: 0
tagged with: resultset
has comment: http://stackoverflow.com/comment/38948013
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38973544
answer count: 0
score: 1
tagged with: java
upvote count: 1
type: Question
tagged with: testing
has comment: http://stackoverflow.com/comment/38946784
has title: How to mock ResultSet methods next() and getString() using JMockit?

http://stackoverflow.com/q/24964393
type: Question
accepted answer: http://stackoverflow.com/a/24972664
tagged with: inno-setup
has body: I'm trying to install the most current platform (x64 or x86) appropriate Java Runtime Environment via Inno Setup (along with another application). I've found some script examples for how to detect the version and install if correct and adapted them to my needs but I keep running into this: Unable to open file "path\to\JREInstall.exe": CreateProcess failed: Code 5: Access Is Denied This is the code strictly responsible for installing the JRE: [Setup] AppName="JRE Setup" AppVersion=0.1 DefaultDirName="JRE Setup" [Languages] Name: "english"; MessagesFile: "compiler:Default.isl" [Files] Source: "jre-8u11-windows-x64.exe"; DestDir: "{tmp}\JREInstall.exe"; \ Check: IsWin64 AND InstallJava(); Source: "jre-8u11-windows-i586.exe"; DestDir: "{tmp}\JREInstall.exe"; \ Check: (NOT IsWin64) AND InstallJava(); [Run] Filename: "{tmp}\JREInstall.exe"; Parameters: "/s"; \ Flags: nowait postinstall runhidden runascurrentuser; Check: InstallJava() [Code] procedure DecodeVersion(verstr: String; var verint: array of Integer); var i,p: Integer; s: string; begin { initialize array } verint := [0,0,0,0]; i := 0; while ((Length(verstr) &gt; 0) and (i &lt; 4)) do begin p := pos ('.', verstr); if p &gt; 0 then begin if p = 1 then s:= '0' else s:= Copy (verstr, 1, p - 1); verint[i] := StrToInt(s); i := i + 1; verstr := Copy (verstr, p+1, Length(verstr)); end else begin verint[i] := StrToInt (verstr); verstr := ''; end; end; end; function CompareVersion (ver1, ver2: String) : Integer; var verint1, verint2: array of Integer; i: integer; begin SetArrayLength (verint1, 4); DecodeVersion (ver1, verint1); SetArrayLength (verint2, 4); DecodeVersion (ver2, verint2); Result := 0; i := 0; while ((Result = 0) and ( i &lt; 4 )) do begin if verint1[i] &gt; verint2[i] then Result := 1 else if verint1[i] &lt; verint2[i] then Result := -1 else Result := 0; i := i + 1; end; end; function InstallJava() : Boolean; var ErrCode: Integer; JVer: String; InstallJ: Boolean; begin RegQueryStringValue( HKLM, 'SOFTWARE\Ja…
answer count: 2
has answer: http://stackoverflow.com/a/42596077
has comment: http://stackoverflow.com/comment/38818892
tagged with: permission-denied
downvote count: 0
favorite count: 0
possible better answer: http://stackoverflow.com/a/42596077
has comment: http://stackoverflow.com/comment/38809561
has answer: http://stackoverflow.com/a/24972664
score: 6
upvote count: 6
tagged with: permissions
type: AnsweredQuestion
tagged with: java
has title: How do I install a JRE from an Inno Setup?

http://stackoverflow.com/a/24954317
type: Answer
has body: One way could be the usage of a flag. Just a boolean stillWriting which is readable from outside. As soon process A did its Job, this flag is set to false and your processes B/C can start their work with this file. Assuming A wants to start again editing this file, it'll set this flag back to true and block the other two processes.
score: 0
answers question: http://stackoverflow.com/q/24953321

http://stackoverflow.com/q/24939840
tagged with: java
tagged with: multithreading
type: Question
has comment: http://stackoverflow.com/comment/38763924
answer count: 6
score: 4
has answer: http://stackoverflow.com/a/24940016
has answer: http://stackoverflow.com/a/24940001
upvote count: 4
has comment: http://stackoverflow.com/comment/38757427
has answer: http://stackoverflow.com/a/24940065
has answer: http://stackoverflow.com/a/24939891
has title: How to keep running a Thread after specific time
downvote count: 0
possible better answer: http://stackoverflow.com/a/24939922
has answer: http://stackoverflow.com/a/24939922
favorite count: 0
has comment: http://stackoverflow.com/comment/38757457
accepted answer: http://stackoverflow.com/a/24940065
has answer: http://stackoverflow.com/a/24939899
type: AnsweredQuestion
has body: I have a Thread which I wants to run after every 15 minute. Currently I am calling this thread from another class like Class B{ public void start(){ while(true){ new Thread(new A()).start(); } } } Class A implements Runnable{ @override public void run(){ //some operation } } How can I invoke Thread A on every 15 minute.

http://stackoverflow.com/comment/38819341
has text: If the code in your question reads a non-empty file, lines.get(0) cannot "crash". - What is the error message anyway? And how is List `lines` passed on to the app?
comment on: http://stackoverflow.com/a/24972303
score: 0
type: AnswerComment
type: Comment

ssl
tags question: http://stackoverflow.com/q/25032597
tags question: http://stackoverflow.com/q/25005906
tags question: http://stackoverflow.com/q/25059196
tags question: http://stackoverflow.com/q/24933819
tags question: http://stackoverflow.com/q/25002819
tags question: http://stackoverflow.com/q/25032651
type: Tag
tags question: http://stackoverflow.com/q/24939595
tags question: http://stackoverflow.com/q/24971552
tags question: http://stackoverflow.com/q/24910942
tags question: http://stackoverflow.com/q/25017050
tags question: http://stackoverflow.com/q/25053572
tag name: ssl
tags question: http://stackoverflow.com/q/24974796
tags question: http://stackoverflow.com/q/24920973
tags question: http://stackoverflow.com/q/24931463
tags question: http://stackoverflow.com/q/24934090
tags question: http://stackoverflow.com/q/25025271
tags question: http://stackoverflow.com/q/25052691
tags question: http://stackoverflow.com/q/25023685
tags question: http://stackoverflow.com/q/25069122

http://stackoverflow.com/comment/38807295
type: QuestionComment
type: Comment
has text: Please show your StackTrace. Where are you getting the Exception?
comment on: http://stackoverflow.com/q/24966453
score: 0

http://stackoverflow.com/comment/38767626
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24945091
has text: can you give me a example?
score: 0

http://stackoverflow.com/a/24957457
upvote count: 1
has comment: http://stackoverflow.com/comment/38792140
type: Answer
has comment: http://stackoverflow.com/comment/38792303
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/24957294
has body: Perhaps a thread pool, but with ParallelVisit implementing Runnable instead? class ParallelVisit implements Runnable { } ExecutorService threadPool = Executors.newFixedThreadPool(maxConcurrentThreads); taskPool.submit(new ParallelVisit(newList, p));

http://stackoverflow.com/comment/38764830
has text: @shekharsuman Isn't that the correct way to declare the class? I have tried ` TEST_Authenticate ` as well but it dien't work. `restapi` is the name of the package.
comment on: http://stackoverflow.com/q/24942153
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/a/25061166
has body: If part of you application will consist of repeating same actions on different objects, it can make sense to have a generic abstract parent class for common operations. You will have to decide if the gain in de-duplication of code is worth the complexity of the generic. There is no general rule ...
downvote count: 0
answers question: http://stackoverflow.com/q/25054652
type: Answer
score: 2
upvote count: 2

http://stackoverflow.com/comment/38701159
comment on: http://stackoverflow.com/q/24910276
score: 0
type: Comment
type: QuestionComment
has text: You should specify what "median" means. But I think that it is simply the average value of each of the RGB components, right?

http://stackoverflow.com/comment/38868245
type: Comment
has text: You could also change the frequency condition to == 1 and then use the resultant list as the list of those numbers not repeated.
comment on: http://stackoverflow.com/a/24998916
type: AnswerComment
score: 4

http://stackoverflow.com/q/24940043
has comment: http://stackoverflow.com/comment/38803473
has comment: http://stackoverflow.com/comment/38759092
has body: I want to use java2python to be able to get a good head start converting a bunch of files over to python. The first thing I did to install was installed antlr 3.1.3 as prescribed. Then I installed java2python 0.5.0. Everything went well during this step: C:\Users\Patrick&gt;pip install java2python Downloading/unpacking java2python Running setup.py (path:c:\users\patrick\appdata\local\temp\pip_build_Patrick\j ava2python\setup.py) egg_info for package java2python Requirement already satisfied (use --upgrade to upgrade): antlr-python-runtime== 3.1.3 in c:\users\patrick\anaconda\lib\site-packages\antlr_python_runtime-3.1.3- py2.7.egg (from java2python) Installing collected packages: java2python Running setup.py install for java2python Successfully installed java2python Cleaning up.. However, when I try to use the command: C:\Users\Patrick\Dekstop\Test\j2py DataWriter.java I get the following error: The program or feature "\??\C:\Users\Patrick\Anaconda\Scripts\j2py.exe" cannot start or run due to incompatibility with 64-bit versions of Windows. Please contact the software vendor to ask if a 64-bit Windows compatible version is available. At this link it seems like there is some kind of download for windows 64-bit but it required ActivePython..? Anyways, if anyone has been able to get this work or knows another tool I can use to do the same thing please let me know. I am using Python 2.7.6 and my system is in fact 64-bit Windows 7.
type: AnsweredQuestion
has title: java2python only for 64-bit OS? j2py.exe says its incompatible for 64-bit OS when run from command line
has comment: http://stackoverflow.com/comment/38824707
type: Question
has answer: http://stackoverflow.com/a/24969594
has comment: http://stackoverflow.com/comment/38803559
tagged with: python
has comment: http://stackoverflow.com/comment/38812964
has comment: http://stackoverflow.com/comment/38757896
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/38758389
answer count: 1
accepted answer: http://stackoverflow.com/a/24969594

http://stackoverflow.com/comment/38730188
has text: yep, check the answer poster by user3167555, thats your issue fix.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24925204

http://stackoverflow.com/comment/38912553
type: Comment
comment on: http://stackoverflow.com/a/25022179
has text: Is the html saved in a string before serialization?
type: AnswerComment
score: 0

http://stackoverflow.com/a/31456627
type: Answer
has comment: http://stackoverflow.com/comment/53906069
has comment: http://stackoverflow.com/comment/54055238
score: 102
has body: You can use the groupingBy method to manage aggregation, for example: public static void main(String[] args) { List<String> list = Arrays.asList("A", "B", "C", "D", "A"); Map<String, List<String>> map = list.stream().collect(Collectors.groupingBy(Function.identity())); } If you want more flexibility (for example to map the value and return a Set instead of a List) you can always use the groupingBy method with more parameters as specified in javadoc: Map<City, Set<String>> namesByCity = people.stream().collect(Collectors.groupingBy(Person::getCity, mapping(Person::getLastName, toSet())));
answers question: http://stackoverflow.com/q/24917053
downvote count: 0
upvote count: 102

http://stackoverflow.com/comment/38991405
type: Comment
has text: [Use the jsoup library](http://jsoup.org/cookbook/input/load-document-from-file)
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/25064273

http://stackoverflow.com/a/25056636
type: AcceptedAnswer
upvote count: 2
answers question: http://stackoverflow.com/q/25055992
type: Answer
has comment: http://stackoverflow.com/comment/38977082
score: 2
has body: Use GridBagConstraints#fill property that is used when the component's display area is larger than the component's requested size. It determines whether to resize the component. gbc_progressBar.fill=GridBagConstraints.HORIZONTAL; Note: There is no need to create multiple instance of GridBagConstraints. you can achieve same thing using single object as well. Read more about How to Use GridBagLayout and have a look at the example.
accepted answer of: http://stackoverflow.com/q/25055992
downvote count: 0

http://stackoverflow.com/q/24976319
has answer: http://stackoverflow.com/a/24979935
accepted answer: http://stackoverflow.com/a/24979935
has comment: http://stackoverflow.com/comment/38826706
has comment: http://stackoverflow.com/comment/38831847
has comment: http://stackoverflow.com/comment/38826331
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38826607
score: 1
has comment: http://stackoverflow.com/comment/38827011
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/38826929
has comment: http://stackoverflow.com/comment/38832804
has body: I am looking for a simple java Text parser that parses a piece of text just like a XML SAX parser but with customized open and closing tags. Instead of "&lt;" I have to deal with "[". Which one can I use, or do I have to make some myself? Example text: [hlpLnk key=hlpId]some text and [lnk key=PrfS]products[/lnk] and some more text[/hlpLnk]
upvote count: 1
has title: Java Text Parser with customized open and closing tags?
answer count: 1
downvote count: 0
favorite count: 0

http://stackoverflow.com/q/24947833
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24947911
has comment: http://stackoverflow.com/comment/38772862
linked to: http://stackoverflow.com/q/17160974
has comment: http://stackoverflow.com/comment/38772813
has body: I am trying to write code to find the day difference between two dates it work will when the month has 31 days but when the month has 30 days the result is less by 1 day this the case with 29 ,28 days month less by 2,3 days I hope I can know why the code : public int dateAfterMod (Calendar endDate){ //TO GET THE CURRENT DATE GregorianCalendar currentDate = new GregorianCalendar (); currentDate=(GregorianCalendar) endDate; //THE CAL.ADD BECUSE THE 1ST MONTH IN THE YEAR IS 0 NOT 1 currentDate.add(Calendar.MONTH, 1); //TO SET THE DATE TO THE FIRST DAY IN THE MOTH FOR COMPAISSON currentDate.set(Calendar.DAY_OF_MONTH, 1); //TO SET THE START DATE WICH IS 1/1/2013 GregorianCalendar startDate = new GregorianCalendar(2013, 1, 1); //TO FIND THE DIFF BETWEEN THE START DATE AND CUREENT DATE long diff=(((currentDate.getTimeInMillis()- startDate.getTimeInMillis())/(1000*60*60*24)));
tagged with: android
has comment: http://stackoverflow.com/comment/38775006
type: Question
has title: Android ,Day difference between two month
answer count: 1
has comment: http://stackoverflow.com/comment/38772789
linked to: http://stackoverflow.com/q/4786169
score: 0
tagged with: java
linked to: http://stackoverflow.com/q/6897027
duplicate of: http://stackoverflow.com/q/6897027

http://stackoverflow.com/a/25041574
has body: You can edit the remote repositories and set the ones you don't want to use to "Offline". Artifactory will not try to fetch artifacts from offline repositories.
score: 0
accepted answer of: http://stackoverflow.com/q/25040924
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25040924
type: Answer

http://stackoverflow.com/comment/38947984
type: Comment
has text: Thanks Konstantin, I am new to maven, do you have any good tutorials for me to follow in order to create a local maven repository and add it to my maven project once I get a hold of the files?
comment on: http://stackoverflow.com/a/25041245
score: 0
type: AnswerComment

algorithm
tags question: http://stackoverflow.com/q/25039731
tags question: http://stackoverflow.com/q/24938677
tags question: http://stackoverflow.com/q/24916514
tags question: http://stackoverflow.com/q/25020061
tag name: algorithm
tags question: http://stackoverflow.com/q/24983281
tags question: http://stackoverflow.com/q/24914525
tags question: http://stackoverflow.com/q/25023521
tags question: http://stackoverflow.com/q/24921310
tags question: http://stackoverflow.com/q/24919901
tags question: http://stackoverflow.com/q/25002618
tags question: http://stackoverflow.com/q/24909272
tags question: http://stackoverflow.com/q/24929663
tags question: http://stackoverflow.com/q/24946740
tags question: http://stackoverflow.com/q/25065061
tags question: http://stackoverflow.com/q/24970913
tags question: http://stackoverflow.com/q/25005165
tags question: http://stackoverflow.com/q/24923851
tags question: http://stackoverflow.com/q/24956968
type: Tag
tags question: http://stackoverflow.com/q/25028612
tags question: http://stackoverflow.com/q/24941167
tags question: http://stackoverflow.com/q/24922303
tags question: http://stackoverflow.com/q/24974703
tags question: http://stackoverflow.com/q/24983336
tags question: http://stackoverflow.com/q/25041675
tags question: http://stackoverflow.com/q/25031414
tags question: http://stackoverflow.com/q/25015479
tags question: http://stackoverflow.com/q/25068233
tags question: http://stackoverflow.com/q/25006856
tags question: http://stackoverflow.com/q/25011327
tags question: http://stackoverflow.com/q/24919600
tags question: http://stackoverflow.com/q/24993979

http://stackoverflow.com/q/25009024
tagged with: class
score: 0
has answer: http://stackoverflow.com/a/25009525
tagged with: android-framework
type: UnansweredQuestion
tagged with: android
has title: Adding custom frameworks in android
tagged with: java
type: Question
has body: I'm making a root access app which generates touch event from the background. Generating touch events requires INJECT_EVENTS permission which is actually a Signature level permission. Since I cannot have the same signature as the ROM so I thought of two solutions as of now : Create a .jar class out of a class which actually generates the touch event and call the method of this class from my app and pass coordinates as the arguments. And then push this jar file to /system/framework/ The second thing which I thought of was to inject the above created class inside the framework.jar only and then call the method of the class. I wanted to ask which of the solution might work or if anyone has another idea in their mind, it would be great.
answer count: 1
tagged with: jar

http://stackoverflow.com/comment/38920755
has text: I tried by doing this with no luck... [question](http://stackoverflow.com/questions/24419580/android-async-update-dialog-message-in-loop)
comment on: http://stackoverflow.com/a/24969193
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/25037399
favorite count: 0
tagged with: android
score: -3
tagged with: http://stackoverflow.com/tag/xml
has title: JAVA Android dowload XML resource file with strings
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/25037805
downvote count: 3
type: Question
has comment: http://stackoverflow.com/comment/38940317
has comment: http://stackoverflow.com/comment/38940534
accepted answer: http://stackoverflow.com/a/25037805
upvote count: 0
answer count: 1
has body: I'm developping an Android APP, and my questions is this: The app is done and working, i have every string in the XML file and different languages, my problem is, the app can do a lot off different thing, imagine this, the app can be used by a farmer who need to retrieve info about some cows, but then, it can be used by a car shop, where he collects data from his storage facilty, so, the app has to make some changes, specially in the strings, it's quite awkward to have "Insert COW ID" on a byer form for example.... I just need some ideias and to know if it's possible and how Thanks EDIT: why the hell is this downvoted??? seriously... just because i don't ask specifics is trash?? off-topic?? i've seen wuestions worse and nobody cars and still online. thanks to the guys who bothered to answear...

http://stackoverflow.com/q/24979610
has answer: http://stackoverflow.com/a/25026461
upvote count: 3
tagged with: java
has body: Unfortunately, I don't understand this output from the netty server: BUILD SUCCESSFUL Total time: 3 seconds Jul 27, 2014 2:04:44 AM io.netty.handler.logging.LoggingHandler channelRegistered INFO: [id: 0xcad25a31] REGISTERED Jul 27, 2014 2:04:44 AM io.netty.handler.logging.LoggingHandler bind INFO: [id: 0xcad25a31] BIND(0.0.0.0/0.0.0.0:4454) Jul 27, 2014 2:04:44 AM io.netty.handler.logging.LoggingHandler channelActive INFO: [id: 0xcad25a31, /0:0:0:0:0:0:0:0:4454] ACTIVE Jul 27, 2014 2:04:59 AM io.netty.handler.logging.LoggingHandler logMessage INFO: [id: 0xcad25a31, /0:0:0:0:0:0:0:0:4454] RECEIVED: [id: 0xff40b8a2, /127.0.0.1:37558 =&gt; /127.0.0.1:4454] Jul 27, 2014 2:04:59 AM net.bounceme.dur.netty.ServerHandler &lt;init&gt; INFO: starting.. Jul 27, 2014 2:04:59 AM io.netty.channel.DefaultChannelPipeline$TailContext exceptionCaught WARNING: An exceptionCaught() event was fired, and it reached at the tail of the pipeline. It usually means the last handler in the pipeline did not handle the exception. io.netty.handler.codec.TooLongFrameException: Adjusted frame length exceeds 1048576: 2901213193 - discarded at io.netty.handler.codec.LengthFieldBasedFrameDecoder.fail(LengthFieldBasedFrameDecoder.java:501) at io.netty.handler.codec.LengthFieldBasedFrameDecoder.failIfNecessary(LengthFieldBasedFrameDecoder.java:477) at io.netty.handler.codec.LengthFieldBasedFrameDecoder.decode(LengthFieldBasedFrameDecoder.java:403) at io.netty.handler.codec.serialization.ObjectDecoder.decode(ObjectDecoder.java:68) at io.netty.handler.codec.LengthFieldBasedFrameDecoder.decode(LengthFieldBasedFrameDecoder.java:343) at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:241) at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:149) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:333) at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContex…
type: Question
has comment: http://stackoverflow.com/comment/38838191
has comment: http://stackoverflow.com/comment/38832807
accepted answer: http://stackoverflow.com/a/25026461
tagged with: io
downvote count: 0
answer count: 1
has title: netty DefaultChannelPipeline exceptionCaught
favorite count: 0
tagged with: sockets
tagged with: multithreading
tagged with: netty
type: AnsweredQuestion
score: 3

http://stackoverflow.com/comment/38830574
comment on: http://stackoverflow.com/q/24978842
type: QuestionComment
type: Comment
has text: http://viralpatel.net/blogs/java-read-write-excel-file-apache-poi/
score: 0

http://stackoverflow.com/comment/38845539
type: Comment
type: QuestionComment
has text: Use `set()` not `get()`
score: 0
comment on: http://stackoverflow.com/q/24986748

http://stackoverflow.com/comment/47758717
type: QuestionComment
has text: Were you able to find a solution for it? Or a work around may be? If you did, could please post it? I'm facing the same problem; the difference is that I'm on version "6.1.0 Final" in which the method `newKieBaseConfiguration(Properties, ClassLoader)` is marked deprecated stating that a class loader passed here would be ignored, but in your version - 6.0.1 Final - no such this is indicated.
comment on: http://stackoverflow.com/q/24998247
score: 0
type: Comment

http://stackoverflow.com/comment/38859449
type: Comment
has text: Thanks! I think about `Entry` but don't know how to gather them back to `Map`. +1
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24986381

http://stackoverflow.com/q/24932838
upvote count: 3
has answer: http://stackoverflow.com/a/24932925
answer count: 3
has body: I have some android project and I am trying to read some file from the "res/drawable-xhdpi" directory so I put InputStream is = null; try { is = getResources().openRawResource(R.drawable.my_btn); //my_btn is inside drawable-xhdpi directory } catch (Exception e) { e.printStackTrace(); } but I get error opening trace file: No such file or directory How can I deal with this issue. I tried to read this directly from FileInputStream with an absolute path, then I realized that the root from which the files are fetched is the root of the JVM so I still got the same No such file or directoryerror message Update : I added an assets directory in side src/main, then I put my_btn.png inside it then I call inside my MainActivity class InputStream is = null; try { is = getAssets().open("my_btn.png"); } catch (Exception e) { e.printStackTrace(); } but I still get the same error
favorite count: 0
has comment: http://stackoverflow.com/comment/38744103
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/38744900
tagged with: android-studio
score: 3
downvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/36616849
has title: reading resource as InputStream in android
type: Question
has comment: http://stackoverflow.com/comment/38743863
has answer: http://stackoverflow.com/a/24933150
linked to: http://stackoverflow.com/q/6602417

http://stackoverflow.com/comment/39146398
type: Comment
comment on: http://stackoverflow.com/q/24975169
has text: Are you using LibGDX as an ECLIPSE project or as a GRADLE project?
score: 0
type: QuestionComment

http://stackoverflow.com/comment/38835880
type: Comment
comment on: http://stackoverflow.com/a/24978296
type: AnswerComment
has text: No Problem :) My Pleasure to Help My Fellow Programmers :)
score: 0

http://stackoverflow.com/comment/39143021
comment on: http://stackoverflow.com/q/25062172
score: 0
type: Comment
type: QuestionComment
has text: Note that the structural reasoner does no inferences

http://stackoverflow.com/q/25062176
tagged with: web.xml
tagged with: tomcat7
type: AnsweredQuestion
has body: I'm using a web.xml to try and disable the HTTP methods we're not using and to return a body that doesn't contain any tomcat info. So I've changed the web.xml of the app to have: <web-resource-collection> restricted methods /* TRACE PUT OPTIONS DELETE HEAD </web-resource-collection> <auth-constraint /> So the blocked methods are returning 403 with an empty body, for forbidden. But TRACE is returning a 405 with a Tomcat HTML page. I tried redirecting all errors through an ErrorServlet with: /ErrorServlet Which just makes sure that the content body is 0. But that doesn't seem to intercept these. So why is TRACE being treated differently? Thanks
downvote count: 0
score: 1
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/25062581
accepted answer: http://stackoverflow.com/a/25062581
has title: Tomcat security-constraints TRACE inconsistent
tagged with: tomcat
upvote count: 1
answer count: 1
favorite count: 0

http://stackoverflow.com/comment/38939796
comment on: http://stackoverflow.com/q/25031445
has text: I don't know how the method is implemented. After Insert operation to get the Auto Incremented ID it might require to look up the DataBase again, I suspected if some rows are added by other thread the result would get affected. But in case of executeStatement() it can easily keep track of successful execution.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25019495
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25019633
has title: Downloading and setting the classpath for apache classes
score: 1
tagged with: java
upvote count: 1
tagged with: classpath
type: Question
tagged with: apache
has body: I am refreshing my java knowhow and i want to write and run some code without using any kind of ide.I am doing my development on windows and the location of my java scripts is C:\java_apps I need to test and see how apache httpclient,httppost,httpresponse and httpentity work and to do that i need to download the classes first. I have created a lib folder to hopefully house the apache classes. In my application,i need to import import org.apache.http.HttpResponse; import org.apache.http.client.HttpClient; import org.apache.http.client.methods.HttpPost; import org.apache.http.impl.client.DefaultHttpClient; Where can i download the classes and how should i set the classpath for them?.
answer count: 1
downvote count: 0
favorite count: 0

http://stackoverflow.com/a/24941906
type: AcceptedAnswer
downvote count: 0
upvote count: 2
type: Answer
score: 2
answers question: http://stackoverflow.com/q/24941832
has body: You could use break. switch (view.getId()) { case R.id.thumbL: view.setLayoutParams(layoutParams); joystick1.LeftY = (byte) (layoutParams.topMargin + 37); joystick1.LeftX = (byte) (layoutParams.leftMargin + 37); System.out.println("Left X Value: " + layoutParams.leftMargin + 37); System.out.println("Left Y Value: " + layoutParams.topMargin + 37); **break;** case R.id.thumbR: view.setLayoutParams(layoutParams); joystick1.RightX = (byte) (layoutParams.leftMargin + 37); System.out.println(" Right X Value: " + layoutParams.leftMargin +37); **break;** }
accepted answer of: http://stackoverflow.com/q/24941832
has comment: http://stackoverflow.com/comment/38761559

http://stackoverflow.com/q/25066970
favorite count: 0
upvote count: 2
has title: Java Operator confusion
downvote count: 2
has answer: http://stackoverflow.com/a/25066995
type: AnsweredQuestion
duplicate of: http://stackoverflow.com/q/20390355
tagged with: java
linked to: http://stackoverflow.com/q/17206933
linked to: http://stackoverflow.com/q/20390355
type: Question
accepted answer: http://stackoverflow.com/a/25066995
has body: What is the difference between += and =+ in Java? I tried searching but got no results. How do those two work specifically? Any help will be appreciated!
score: 0
tagged with: operator-keyword
answer count: 1

http://stackoverflow.com/a/25121448
upvote count: 1
has comment: http://stackoverflow.com/comment/39318912
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/24934826
has body: It's not needed, just put your wearable apk in the /raw folder (I already published a wearable app created using Eclipse on the Play Store and everything went fine).
has comment: http://stackoverflow.com/comment/39255386

http://stackoverflow.com/comment/103490007
comment on: http://stackoverflow.com/a/24970929
score: 2
has text: Code-only answers are considered low quality: make sure to provide an explanation what your code does and how it solves the problem. It will help the asker and future readers both if you can add more information in your post. See also Explaining entirely code-based answers: https://meta.stackexchange.com/questions/114762/explaining-entirely-code-based-answers
type: AnswerComment
type: Comment

http://stackoverflow.com/q/24975641
has comment: http://stackoverflow.com/comment/38824548
has comment: http://stackoverflow.com/comment/38824436
upvote count: 0
answer count: 1
has title: Why my app 'Unfortunately, abc has stopped'
favorite count: 0
has body: Edit starts Sorry for messing up my code. All of you pointed out various mistakes and you all are correct. But what really happened is my original code was correct up to certain extend. Before posting the code here I changed my original code to check something and I used that edited code here forgetting that I changed, that's the reason you saw some wrong textviews, capitalization etc. Apologize for that. I checked my code replacing the textview that located on the other activity with a text view on the same activity where the button is and it worked fine. So I guess my Intent to start another activity caused the error. It's the first time I tried using Intent. All I used is Intent intent=new Intent(this, ViewAccount.class); startActivity(intent); But it seems that doesn't work. To cut it short, I have three activities activity1 contain editText1 editText2 and a save button. When save button clicked data from the edtiText1 and editText2 stored using sharedPreferences. activity2 contain a button called show. When button show is clicked activity3 should be opened up with saved values on it. I hope I didn't make it more complicated. Edit Ends. Old post Can somebody help me out to find what am I doing wrong. I am just a newbie to the Java and Android programming world. I am just trying to make a sample app where I will save and retrieve data using SharedPreferences. Saving part is working fine, I also put a Toast at saving. But when I click the button to retrieve data app get crashed. Please help me out. While saving I used Name and Age as keys. Following is the java code I used for retrieve data: package com.xyz.abc; import android.app.Activity; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.TextView; import android.widget.Toast; public class Card extends Activity{ public static final…
has comment: http://stackoverflow.com/comment/38824586
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38824632
tagged with: android
has comment: http://stackoverflow.com/comment/38824437
has comment: http://stackoverflow.com/comment/38824440
tagged with: android-xml
downvote count: 2
type: Question
linked to: http://stackoverflow.com/q/23353173
score: -2
tagged with: java
tagged with: android-sharedpreferences
has comment: http://stackoverflow.com/comment/38824516
has answer: http://stackoverflow.com/a/24975732

http://stackoverflow.com/comment/38708155
comment on: http://stackoverflow.com/q/24913612
type: Comment
type: QuestionComment
score: 1
has text: @Eran I don't think so, as that question asks: whether java allows so. Whereas my question is: why Java does not allow this?

http://stackoverflow.com/comment/62591205
has text: new BufferedImage(width, height ... should be new BufferedImage(width1, height1
score: 2
comment on: http://stackoverflow.com/a/25024344
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/38858626
type: Comment
type: QuestionComment
has text: @mKorbel I don't understand. Can you explain further?
comment on: http://stackoverflow.com/q/24993711
score: 0

http://stackoverflow.com/q/25036532
favorite count: 0
has comment: http://stackoverflow.com/comment/38938744
score: -6
downvote count: 6
duplicate of: http://stackoverflow.com/q/7899525
has answer: http://stackoverflow.com/a/25036585
has body: I want to make a simple program that can convert currencies and weights, etc. The only problem is that I don't know how to separate a string so that I can get each individual word. So, if I have the string "200 GBP USD", how can I separate it so that I get int currency = 200; String currencyFrom = "GBP"; String currencyTo = "USD";
type: AnsweredQuestion
tagged with: java
linked to: http://stackoverflow.com/q/7899525
has title: How can I split a string by a delimiter in Java?
has answer: http://stackoverflow.com/a/25036558
accepted answer: http://stackoverflow.com/a/25036558
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/38938714
possible better answer: http://stackoverflow.com/a/25036585
upvote count: 0
tagged with: string

http://stackoverflow.com/a/24915595
type: Answer
has comment: http://stackoverflow.com/comment/38712115
has comment: http://stackoverflow.com/comment/38712003
downvote count: 1
has comment: http://stackoverflow.com/comment/38712166
has body: You can not make objects of singleton class outside the class because the constructor is private. Constructor instantiate the object. if the constructor itself is private then the object will never be instantiated outside the class rather you can use getInstance method. then you can access its features outside the class.
score: -1
answers question: http://stackoverflow.com/q/24915336
upvote count: 0
has comment: http://stackoverflow.com/comment/38712266
has comment: http://stackoverflow.com/comment/38712216

http://stackoverflow.com/a/24936281
score: 0
answers question: http://stackoverflow.com/q/24919038
has body: I have got this to work(around) by using the output from the HQL query as input to the criteria API: final List&lt;UUID&gt; auditRecordIds = execute("select auditRecord from AuditRecordEntity auditRecord where auditRecord.accessTime = (select max(auditRecord2.accessTime) from AuditRecordEntity auditRecord2 where auditRecord2.auditRepository = auditRecord.auditRepository)") Root&lt;AuditRecordEntity&gt; root = criteriaQuery.from(AuditRecordEntity.class); criteriaQuery.select(root); List&lt;Predicate&gt; predicates = new ArrayList&lt;Predicate&gt;(); predicates.add(root.get("id").in(auditRecordIds.toArray())); entitySearchCriteria.addPredicates(predicates); ...
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24919038
type: Answer

http://stackoverflow.com/q/25053439
has body: I have a custom ArrayAdapter that uses an ArrayList&lt;OrderedProductItem&gt; for my ListView. Inside this ListView I have an AutoCompleteTextView that also uses a custom ArrayAdapter with an ArrayList&lt;Product&gt;. On initialization this AutoCompleteTextView contains the Names of all Products (around 1250), minus 1 (the OrderedProductItem's Product). The User can then use a Spinner to select a Product-Tag and I create a filtered ArrayList&lt;Product&gt;, so I only get a list of all Products containing this Product-Tag (still minus the 1). So, my question is: What is the best way to replace an ArrayAdapter's object-list? I know I can just re-create and re-assign a new ArrayAdapter instance in my ListActivity: myAdapter = new MyAdapter(this, R.layout.item_view, myList); setListAdapter(myAdapter); I also know I can use a clear and then an addAll to replace everything: // NOTE: myAdapter.setNotifyOnChange is kept on default (true) myAdapter.clear(); myAdapter.addAll(myList); I guess the second one is probably best, since we don't want to create a new Instance every time, or does ArrayAdapter have some kind of method like setArray() and I just missed it when looking for it? Or is there even another way that is better for performance than this second option?
has comment: http://stackoverflow.com/comment/38971371
linked to: http://stackoverflow.com/q/56454443
tagged with: android-arrayadapter
tagged with: java
type: AnsweredQuestion
tagged with: notifydatasetchanged
downvote count: 0
has title: Replace List of ArrayAdapter
possible better answer: http://stackoverflow.com/a/25053835
score: 6
favorite count: 0
tagged with: arraylist
has answer: http://stackoverflow.com/a/25053835
type: Question
tagged with: android
has comment: http://stackoverflow.com/comment/38971192
upvote count: 6
has comment: http://stackoverflow.com/comment/38971286
has comment: http://stackoverflow.com/comment/38971018
has answer: http://stackoverflow.com/a/25053646
answer count: 2
accepted answer: http://stackoverflow.com/a/25053646

http://stackoverflow.com/a/24998672
has comment: http://stackoverflow.com/comment/38867742
has body: You should look into the JEditorPane class, it allows you to do things like these easily: JEditorPane editorPane = new JEditorPane("text/html","this will be red, and this will be blue");
answers question: http://stackoverflow.com/q/24998580
score: 0
type: Answer

http://stackoverflow.com/comment/38918650
type: Comment
type: QuestionComment
has text: To get a working ant file, let Eclipse generate a build.xml for you =>Export / General / Ant Buildfiles / choose Project from workspace => the generated file is far away from a world class build file (using antcall f.e.) but it's working and might be sufficient to get you going..
comment on: http://stackoverflow.com/q/25019909
score: 0

http://stackoverflow.com/a/24979133
score: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/24976681
answers question: http://stackoverflow.com/q/24976681
has body: i searched and find twitter streaming api dose not support @ search or filter here is detail follow Available on POST statuses/filter. A comma-separated list of user IDs, indicating the users whose Tweets should be delivered on the stream. Following protected users is not supported. For each user specified, the stream will contain: Tweets created by the user. Tweets which are retweeted by the user. Replies to any Tweet created by the user. Retweets of any Tweet created by the user. Manual replies, created without pressing a reply button (e.g. “@twitterapi I agree”). The stream will not contain: Tweets mentioning the user (e.g. “Hello @twitterapi!”). Manual Retweets created without pressing a Retweet button (e.g. “RT @twitterapi The API is great”). Tweets by protected users. https://dev.twitter.com/docs/streaming-apis/parameters
type: AcceptedAnswer

http://stackoverflow.com/comment/38919051
has text: You could fix it by using n.trim() in the format statement ;) ... It's possible that the String value may come from at her source, file, web service or been sub-stringed in some way, so it's nice to "ensure" an accurate value ;)
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25025419
type: Comment

http://stackoverflow.com/q/24965825
has comment: http://stackoverflow.com/comment/38806171
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/38806163
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/24965910
tagged with: button
has title: Trying to switch between activities, don't know why this isn't working?
has comment: http://stackoverflow.com/comment/38913421
has answer: http://stackoverflow.com/a/24966050
tagged with: android-activity
has answer: http://stackoverflow.com/a/24966109
has comment: http://stackoverflow.com/comment/38806254
type: UnansweredQuestion
has body: Here is the code where I add the listener to the button in my activity file: get_started_imready = (Button) findViewById(R.id.im_ready); get_started_imready.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub //Log.v("BUTTON ACTIVITY ENTERED","hi"); startActivity(new Intent(ThirdActivity.this, SetupPageOne.class)); finish(); } }); Here is the button code in the corresponding xml file: &lt;Button android:id="@+id/im_ready" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/hello_world" android:clickable="true" /&gt; And here is the code of my second activity: SetupPageOne import android.support.v7.app.ActionBarActivity; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; public class SetupPageOne extends ActionBarActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_setup_page_one); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.setup_page_one, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } } When I try to run this code on my android device, the program runs without any runtime errors but the button itself is unresponsive and doesn't switch to the second activity. Anyone have any idea? Thanks!
tagged with: android
tagged with: http://stackoverflow.com/tag/xml

http://stackoverflow.com/comment/38810869
type: Comment
type: QuestionComment
score: 1
has text: [Maven 2 Reference](http://maven.apache.org/guides/MavenQuickReferenceCard.pdf), [The Essential Maven 2 Cheat Sheet](http://refcardz.dzone.com/refcardz/apache-maven-2)
comment on: http://stackoverflow.com/q/24966587

http://stackoverflow.com/comment/138172167
type: Comment
comment on: http://stackoverflow.com/a/75789103
score: 1
type: AnswerComment
has text: To add some clarity, run this command in the root folder where your proto files are `protoc --dart_out=[YOUR DESTINATION FOLDER] **/*.proto`

http://stackoverflow.com/a/24967765
type: Answer
score: 2
downvote count: 0
has body: First test for null, before you test for equality! while (theNode.getItem().getName() != searchName) { // &lt;-- NO! if (theNode.getItem().getName().equals(searchName)) { // &lt;-- B occurrences++; } else if (theNode.getNext() == null){ // &lt;-- A System.out.println("Flower not found!"); return; } theNode = theNode.getNext(); } I believe you wanted something like this while (theNode != null) { // &lt;-- null test. if (theNode.getItem().getName().equals(searchName)){ // &lt;-- B occurrences++; } else { //theNode.getItem().getName() != searchName break; } theNode = theNode.getNext(); } if (occurrences == 0) { // &lt;-- A System.out.println("Flower not found!"); return; }
answers question: http://stackoverflow.com/q/24967740
accepted answer of: http://stackoverflow.com/q/24967740
upvote count: 2
type: AcceptedAnswer

http://stackoverflow.com/comment/38853226
type: Comment
has text: This is very similar to what I did initially and didn't work. I'll give it a try later on today though, to make sure I'm not missing anything. Thanks.
type: AnswerComment
comment on: http://stackoverflow.com/a/24990897
score: 0

http://stackoverflow.com/comment/38952557
comment on: http://stackoverflow.com/q/25043526
has text: You are using `SupportMapFragment` in xml & extending `MapFragment`
type: Comment
type: QuestionComment
score: 2

http://stackoverflow.com/comment/86202638
score: 0
type: Comment
comment on: http://stackoverflow.com/a/29571677
has text: @HankCa - I am getting "Is there an unresolvable circular reference" error after configuring this. What could have gone wrong?
type: AnswerComment

http://stackoverflow.com/comment/38834400
comment on: http://stackoverflow.com/a/24980255
score: 0
type: AnswerComment
type: Comment
has text: the problem is how to use the library/class on google app engine. i found some info here https://crackstation.net/hashing-security.htm and i have tried the class in eclipse. however im planning to hash the password on google app engine but i dont know how

http://stackoverflow.com/q/24915686
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/28340189
has body: I installed android studio on my laptop .. (OS -> Windows 8) when I try to start it , i get this message "tools.jar' seems to be not in Android Studio classpath . Please ensure you have JAVA_HOME points to JDK rather than JRE" How can I fix this ? and please can you write the solution in details ? :) .. i'm new to JDK and this stuff .. Thanks in advance :)
has answer: http://stackoverflow.com/a/31596902
has title: Android Studio cant't start up on windows 8 .. how to fix this?
has comment: http://stackoverflow.com/comment/47857923
tagged with: java
downvote count: 0
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/43856353
linked to: http://stackoverflow.com/q/27528652
has answer: http://stackoverflow.com/a/24915777
tagged with: android
linked to: http://stackoverflow.com/q/16574189
answer count: 4
has answer: http://stackoverflow.com/a/24915742
has comment: http://stackoverflow.com/comment/43856531
has comment: http://stackoverflow.com/comment/53443607
type: UnansweredQuestion

http://stackoverflow.com/comment/38990091
type: Comment
score: 0
has text: The inputfile is the file I got as a output from a Mapreduce program. Can I use pig script to do this? Please guide me how to do this
type: AnswerComment
comment on: http://stackoverflow.com/a/25063360

http://stackoverflow.com/a/24921025
has comment: http://stackoverflow.com/comment/38768132
score: 2
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24918988
answers question: http://stackoverflow.com/q/24918988
has comment: http://stackoverflow.com/comment/38723873
upvote count: 2
has body: I recommend using Libgdx's Array class instead of a Java ArrayList, as it is optimized for game performance. Create an Array to hold all the active coins. Array&lt;Sprite&gt; activeCoins = new Array&lt;Sprite&gt;(); Then create a coin pool. A pool is a helper for creating copies of something without causing garbage collection hiccups. You need to make a subclass of Pool to use. It describes how to create a new coin when one is needed. public class CoinPool extends Pool&lt;Sprite&gt; { TextureRegion coinTextureRegion; public CoinPool(TextureRegion coinTextureRegion){ this.coinTextureRegion = coinTextureRegion; } protected Sprite newObject(){ return new Sprite(coinTextureRegion); } } Then create an instance of CoinPool to use in your game. Now whenever you want a new coin, pull one from the pool. It will only instantiate a new one if necessary. Otherwise, it will hand you a recycled one from earlier. And once you get it, set it's position and other parameters wherever you want it. Keep in mind it might still have old values attached to it, so if you are rotating your coins and moving them around or changing color, you'll want to be sure you reset position and rotation, and color. Sprite newCoin = coinPool.obtain(); newCoin.setPosition(x,y,z); //as desired newCoin.setRotation(0); //if you are rotating them newCoin.setColor(Color.WHITE); //if you have been changing their color activeCoins.add(newCoin); //Add your new coin to the list of active coins And whenever you are done with a coin (when it has been collected), you need to remove it from the active coins list and return it to the pool: for (Sprite coin : activeCoins){ boolean grabbed = isCoinGrabbed(coin); //however you want to do this if (grabbed){ coinGrabbed(); //whatever you want to happen when a coin is grabbed activeCoins.remove(coin); coinPool.free(coin); //return it to the pool } } And to draw them, you can just submit all the sprites currently in the activeCoins list to the sprite batch.
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38748886
type: Answer

http://stackoverflow.com/q/24948065
tagged with: java
has body: I have used IText to generate barcode for my pdf. I have question about this particular line of code. PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("C:/Mobile/billPayment.pdf"); When i point the output file to billPayment.pdf, it overwrites the existing data, erases everything what's on pdf and just give me barcode. Is there anyway I can persist my existing data as well as generated barcode?
type: Question
has title: Generate and use the barcode on the bottom of my PDF
has answer: http://stackoverflow.com/a/33183601
score: 0
tagged with: http://stackoverflow.com/tag/pdf
answer count: 1
has comment: http://stackoverflow.com/comment/38776742
type: UnansweredQuestion
tagged with: barcode

http://stackoverflow.com/comment/38880023
score: 2
comment on: http://stackoverflow.com/q/25005112
type: Comment
type: QuestionComment
has text: Use Java 8... Ha. Guava doesn't like checked exceptions.

http://stackoverflow.com/a/24961811
has body: If you just want to "see" the content, you can temporarily add android:layout_marginTop="-200dp" in the child of your ScrollView, just remember to delete it again before running the app :)
answers question: http://stackoverflow.com/q/24960420
score: 0
type: Answer

http://stackoverflow.com/comment/38886709
type: Comment
type: QuestionComment
has text: I mean this structure http://postimg.org/image/3r3e0v5n5/ As you can see the controller is just plain text.
score: 0
comment on: http://stackoverflow.com/q/24985473

http://stackoverflow.com/a/25018033
has body: I cannot see why Jsch could refuse to execute a command. In my tests any command (only cli command and not XWindow !) work perfectly. I could even launch vi (with ugly output of course ...), exit from it properly and logout from shell with ^D. The only problem I could identify is timing. Jsch is like any other bedirectionnal tool : it allows you to write and read, but you have to wait that the command has finished its output to read and of course to close the channel. If not, you will find an empty output (or only the login banner), and close communication before the command on server have even begun. That would explain why it works when you connect the inputStream to System.in because then, you wait for the output of one command to type the following. You can try to add delays in your code to confirm it.
has comment: http://stackoverflow.com/comment/38925980
has comment: http://stackoverflow.com/comment/38964332
has comment: http://stackoverflow.com/comment/38927816
answers question: http://stackoverflow.com/q/24990331
has comment: http://stackoverflow.com/comment/38931531
has comment: http://stackoverflow.com/comment/38932083
score: 0
has comment: http://stackoverflow.com/comment/38928913
has comment: http://stackoverflow.com/comment/38923152
type: Answer

http://stackoverflow.com/comment/48394654
type: AnswerComment
comment on: http://stackoverflow.com/a/25120431
score: 0
has text: Looks like you are creating a Spring Aries Blueprint to be deployed as a servicemix bundle. In this case , the blueprint.xml will have your service references, i'm assuming that you are declaring the spring beans in the same file, is this correct. In the event that are you're blueprint is separate and you are separate spring application-context files, then i'd recommend the creation of the context files for spring in /META-INF/spring the reason being that camel-spring can load them sans issue in this case.
type: Comment

http://stackoverflow.com/comment/39079340
has text: also `jsonString` what goes inside here?
comment on: http://stackoverflow.com/a/25043310
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/24940123
type: Question
tagged with: hashmap
score: -1
has answer: http://stackoverflow.com/a/24940148
answer count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/38757987
has body: How can we insert user defined types in HashMap as Key and Value? HashMap&lt;key, value&gt; Key as user defined. Value also as user defined.
tagged with: key
favorite count: 0
has comment: http://stackoverflow.com/comment/38758107
type: UnansweredQuestion
has title: Can we insert user defined types in HashMap as Key and Value?
has comment: http://stackoverflow.com/comment/38757956
upvote count: 0
tagged with: java
tagged with: collections

http://stackoverflow.com/comment/39000008
type: Comment
has text: Thank you. I went with this and it works perfectly as far as I can see. I had no idea symlinks were even a thing.
comment on: http://stackoverflow.com/a/25068168
type: AnswerComment
score: 0

http://stackoverflow.com/a/24985134
answers question: http://stackoverflow.com/q/24984769
type: Answer
score: 1
has body: This is probably an opinion-based question, but what the heck, I'll throw in my opinion. If someone types if (true), then either they know what they're doing, are just experimenting, or are hopeless. It's not likely for this to be a mistake. It would take special logic for Eclipse to catch this, and it doesn't seem worthwhile. You could say the same about if (false)--that Eclipse shouldn't warn about that because someone who types it in must know what they're doing. However, Eclipse already has logic to catch dead code in other situations besides this one, and it might take special logic not to display a warning in that case. Which is doable, but probably not worth the effort, since warnings aren't really a problem. (I sometimes use if(false) to temporarily disable a section of code, and this causes Eclipse to display yellow lines on the screen. Big deal.)
upvote count: 1
downvote count: 0

dialog
tag name: dialog
tags question: http://stackoverflow.com/q/24925740
tags question: http://stackoverflow.com/q/24962401
type: Tag
tags question: http://stackoverflow.com/q/25068046

annotations
tags question: http://stackoverflow.com/q/24993899
type: Tag
tags question: http://stackoverflow.com/q/25060871
tags question: http://stackoverflow.com/q/25024632
tags question: http://stackoverflow.com/q/25002681
tags question: http://stackoverflow.com/q/25055182
tags question: http://stackoverflow.com/q/25030412
tags question: http://stackoverflow.com/q/24928338
tags question: http://stackoverflow.com/q/25010502
tags question: http://stackoverflow.com/q/24960045
tags question: http://stackoverflow.com/q/24989604
tags question: http://stackoverflow.com/q/24948688
tags question: http://stackoverflow.com/q/25006932
tags question: http://stackoverflow.com/q/25065036
tags question: http://stackoverflow.com/q/25065580
tags question: http://stackoverflow.com/q/24979971
tag name: annotations
tags question: http://stackoverflow.com/q/25054460
tags question: http://stackoverflow.com/q/24931615
tags question: http://stackoverflow.com/q/24935991

http://stackoverflow.com/comment/38907882
type: Comment
type: QuestionComment
score: 3
has text: Does the second answer not work for you? It should. The one that uses Scanner
comment on: http://stackoverflow.com/q/25019789

http://stackoverflow.com/comment/38922304
type: QuestionComment
type: Comment
has text: Why are you not setting the side1/side2/side3 values in the exception object?
comment on: http://stackoverflow.com/q/25027249
score: 0

http://stackoverflow.com/comment/38745295
type: Comment
type: QuestionComment
score: 3
has text: Is the client sending the header `Content-Type: application/json`?
comment on: http://stackoverflow.com/q/24932080

http://stackoverflow.com/a/25042621
has body: From a behavioral standpoint, this appears to be a partial replacement for Java's built-in synchronization (monitor locks). In particular, it appears to provide correct mutual exclusion which is what most people are after when they're using locks. It also appears to provide the proper memory visibility semantics. The Atomic* family of classes has similar memory semantics to volatile, so releasing one of these "locks" will provide a happens-before relationship to another thread's acquisition of the "lock" which will provide the visibility guarantee that you want. Where this differs from Java's synchronized blocks is that it does not provide automatic unlocking in the case of exceptions. To get similar semantics with these locks, you'd have to wrap the locking and usage in a try-finally statement: void a() { while (!atomicBoolean.compareAndSet(false, true) { } try { // code to execute } finally { atomicBoolean.set(false); } } (and similar for b) This construct does appear to provide similar behavior to Java's built-in monitor locks, but overall I have a feeling that this effort is misguided. From your comments on another answer it appears that you are interested in avoiding the OS overhead of blocking threads. There is certainly overhead when this occurs. However, Java's built-in locks have been heavily optimized, providing very inexpensive uncontended locking, biased locking, and adaptive spin-looping in the case of short-term contention. The last of these attempts to avoid OS-level blocking in many cases. By implementing your own locks, you give up these optimizations. You should benchmark, of course. If your performance is suffering from OS-level blocking overhead, perhaps your locks are too coarse. Reducing the amount of locking, or splitting locks, might be a more fruitful way to reduce contention overhead than to try to implement your own locks.
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/65612305
downvote count: 0
answers question: http://stackoverflow.com/q/25038919
type: Answer
has comment: http://stackoverflow.com/comment/65565102

http://stackoverflow.com/comment/38878054
has text: Yes, I have import com.google.gwt.user.client.ui.CaptionPanel; Is there anything else I am missinghere
type: Comment
comment on: http://stackoverflow.com/a/25003378
score: 0
type: AnswerComment

http://stackoverflow.com/q/25051356
has comment: http://stackoverflow.com/comment/38972267
tagged with: android
has title: Move activity to front in AsyncTask
tagged with: android-asynctask
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38977515
has answer: http://stackoverflow.com/a/25054388
has comment: http://stackoverflow.com/comment/38973357
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/38967519
has body: In an activity, I have created a AsyncTask after hiding the activity: this.moveTaskToBack(true); (new MyTask(this)).execute(); To show a dialog in the task (in onPostExcecute), I want to bring the activity to front: alertDialog.show(); Intent intent = new Intent(mainActivity, MainActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); mainActivity.getBaseContext().startActivity(intent); But a new instance of the main activity is created and shown on top of the dialog, although the application was still running (the activity has also a dialog style Theme.Dialog). How should I fix this? Edit: According to javadoc, this code always recreates the activity and doesn't bring its previous instance to front, since startActivity is called from outside of an Activity Context.
answer count: 1
score: 0

http://stackoverflow.com/q/24945356
favorite count: 0
tagged with: floor
type: Question
has answer: http://stackoverflow.com/a/24945402
score: 5
has answer: http://stackoverflow.com/a/24945407
tagged with: pow
has answer: http://stackoverflow.com/a/47570760
tagged with: java
has comment: http://stackoverflow.com/comment/38769498
has comment: http://stackoverflow.com/comment/38768146
has title: Why is math.pow not natively able to deal with ints? (floor/ceil, too)
has comment: http://stackoverflow.com/comment/38768244
has comment: http://stackoverflow.com/comment/38768197
has comment: http://stackoverflow.com/comment/134122839
possible better answer: http://stackoverflow.com/a/24945592
accepted answer: http://stackoverflow.com/a/24945407
upvote count: 5
has comment: http://stackoverflow.com/comment/38768224
answer count: 5
has answer: http://stackoverflow.com/a/24945410
tagged with: ceil
has answer: http://stackoverflow.com/a/24945592
has body: I know that in Java (and probably other languages), Math.pow is defined on doubles and returns a double. I'm wondering why on earth the folks who wrote Java didn't also write an int-returning pow(int, int) method, which seems to this mathematician-turned-novice-programmer like a forehead-slapping (though obviously easily fixable) omission. I can't help but think that there's some behind-the-scenes reason based on the intricacies of CS that I just don't know, because otherwise... huh? On a similar topic, ceil and floor by definition return integers, so how come they don't return ints? Thanks to all for helping me understand this. It's totally minor, but has been bugging me for years.
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38768216
downvote count: 0

http://stackoverflow.com/comment/38740032
score: 1
type: Comment
type: QuestionComment
has text: @Ogen you can even write `for(;;)` to create a infinite loop, it's equivalent to while(true)
comment on: http://stackoverflow.com/q/24930274

http://stackoverflow.com/comment/38910711
type: QuestionComment
type: Comment
has text: I assume `TST_CATAGORY="+catg+"";` is a string... so shouldn't it be... `TST_CATAGORY='"+catg+"'";`
comment on: http://stackoverflow.com/q/25021329
score: 0

http://stackoverflow.com/q/24925944
downvote count: 0
has title: java check for particular value for a field
has answer: http://stackoverflow.com/a/24926498
has comment: http://stackoverflow.com/comment/38731197
favorite count: 0
has comment: http://stackoverflow.com/comment/38731430
upvote count: 2
type: UnansweredQuestion
has body: I have requirement to check for a particular field only particular values are allowed, how to do that best in java. For example: For a "Status" field only allowed values are "eq" and "in" For a "Date" field only allowed values are "gt","ge" and "eq" My method will look something like this, boolean checkFieldAndOperatorMatching(String field, String operator); for example, if some one passes checkFieldAndOperatorMatching("status", "eq"); //correct checkFieldAndOperatorMatching("status", "in"); //correct checkFieldAndOperatorMatching("status", "gt"); // not correct checkFieldAndOperatorMatching("date", "gt"); //correct checkFieldAndOperatorMatching("date", "ge"); //correct checkFieldAndOperatorMatching("date", "eq"); //correct checkFieldAndOperatorMatching("date", "in"); // not correct
score: 2
has answer: http://stackoverflow.com/a/24926222
has comment: http://stackoverflow.com/comment/38731069
has comment: http://stackoverflow.com/comment/38731264
tagged with: java
has answer: http://stackoverflow.com/a/24926321
has comment: http://stackoverflow.com/comment/38731157
type: Question
has comment: http://stackoverflow.com/comment/38731084
answer count: 3
has comment: http://stackoverflow.com/comment/38731208

http://stackoverflow.com/comment/38748883
score: 0
comment on: http://stackoverflow.com/q/24935243
type: QuestionComment
type: Comment
has text: @NESPowerGlove: I am aware of code obfuscators, but as a direct result of jumping into the program whilst still learning my code is kind of natuarally unreadable anyway, but thanks anyhow.

http://stackoverflow.com/q/24949964
has body: Not sure what can be causing this error... I have a class named StudentUnit that can contain a list of Units. If I get only StudentUnit objects, the result comes ok, but if I try to get the Units (adding fetchType== eager), then I get java.sql.SQLSyntaxErrorException: ORA-01722: invalid number But note the fields I mapped on the Unit (unitCode, unitNm) are both Strings. I keep wondering if that could be a problem to have the unitCode as @id, or something related to that... @Entity @Table(name = "STUDENT_UNITS") @NamedQuery (name ="StudentUnit.findByCourseAttemptNo", query ="SELECT su FROM StudentUnit su WHERE su.studentNo = :studentNo and su.courseNo = :courseNo and su.courseAttemptNo = :courseAttemptNo") @FetchProfile(name = "studentUnit", fetchOverrides = { @FetchProfile.FetchOverride(entity = StudentUnit.class, association = "units", mode = FetchMode.JOIN) }) public class StudentUnit{ @Id @Column(name = "STUDENT_NO") private Integer studentNo; @Column(name = "COURSE_NO") private Integer courseNo; @Column(name = "UNIT_CODE") private String unitCode; @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER, mappedBy = "unitCode")//this one gives problems,which proves the issue is on Unit //@OneToMany(mappedBy = "unitCode"): this one is ok, once never tries to get the Unit private List&lt;Unit&gt; units; } @Entity @Table(name="UNITS") public class Unit { @Id @Column(name = "UNIT_CODE") private String unitCode; @Column(name = "UNIT_NM") private String unitNm; @Column(name = "GRADE_CODE_NO") private Integer gradeCodeNo; @Column(name = "IMPLEMENTATION_DATE") private Date implementationDate; //getters/setters } Information from database: STUDENT_UNITS ( STUDENT_NO NUMBER(10), COURSE_NO NUMBER(5), COURSE_ATTEMPT_NO NUMBER(5), UNIT_CODE VARCHAR2(16 BYTE), ORIGINATING_DBKEY NUMBER ) UNITS ( UNIT_CODE VARCHAR2(16 BYTE), UNIT_STEM VARCHAR2(15 BYTE), UNIT_ANTA_VERSION_NO VARCHAR2(1 BYTE), UNIT_NM VARCHAR2(100 BYTE), IMPLEMENTATION_DATE DATE ) More of the error log: org.s…
type: Question
has title: Issue hibernate (java.sql.SQLSyntaxErrorException: ORA-01722: invalid number)
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/24950158
has comment: http://stackoverflow.com/comment/38777251
has comment: http://stackoverflow.com/comment/38777032
type: AnsweredQuestion
tagged with: java
tagged with: hibernate
accepted answer: http://stackoverflow.com/a/24950158

http://stackoverflow.com/comment/39232069
type: Comment
comment on: http://stackoverflow.com/a/24921658
has text: When I run your code, either from the IDE, commandline or app bundle, I don't seem to have a problem...(from an UI perspective)
type: AnswerComment
score: 0

http://stackoverflow.com/a/25004391
upvote count: 1
answers question: http://stackoverflow.com/q/25004320
has body: You do not need a regex here: Use int pos = str.indexOf('-') to get the location of the dash Use str.substring(0, pos) to get the initial portion of the string. If dashes in the input strings are optional, you would need to add a check of pos to be non-negative.
type: Answer
downvote count: 0
score: 1

http://stackoverflow.com/comment/38998718
type: Comment
type: AnswerComment
has text: So a+=b will go on until the condition for the loop is met correct?
score: 0
comment on: http://stackoverflow.com/a/25066995

http://stackoverflow.com/comment/38937288
comment on: http://stackoverflow.com/a/25032778
type: Comment
has text: Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/58345/discussion-between-user3660185-and-zalgo).
score: 0
type: AnswerComment

http://stackoverflow.com/comment/38713448
type: Comment
has text: Exactly as you said. If you want to pass updates to the UI partway through the background process, override onProgressUpdate. If you just need to pass back the result at the end, just override onPostExecute. Since your UI is in a different class, you'll probably want to pass a listener into your AsyncTask so that onPostExecute can call it to report back to the UI. Alternatively you can make your AsyncTask an inner class inside of the class where your UI resides so that you can just directly update the UI elements in onPostExecute.
comment on: http://stackoverflow.com/a/24914094
score: 0
type: AnswerComment

http://stackoverflow.com/q/24977783
score: -4
has answer: http://stackoverflow.com/a/46476976
has answer: http://stackoverflow.com/a/24977846
has answer: http://stackoverflow.com/a/24977865
tagged with: char
type: Question
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/43096811
possible better answer: http://stackoverflow.com/a/24977890
has answer: http://stackoverflow.com/a/43097504
favorite count: 0
has answer: http://stackoverflow.com/a/24977787
answer count: 8
has comment: http://stackoverflow.com/comment/38828508
has title: Comparing a char with multiple characters
tagged with: if-statement
upvote count: 5
tagged with: java
has answer: http://stackoverflow.com/a/69415695
accepted answer: http://stackoverflow.com/a/24977787
has body: for(int j=0 ; j&lt;str.length() ; j++) { if(char[j]==(a||e||i||o||u)) count++; } I know the result of (a||e||i||o||u) is a Boolean so can't compare but how can we check for multiple character presence?
tagged with: boolean
downvote count: 9
tagged with: arrays
has answer: http://stackoverflow.com/a/24977890

http://stackoverflow.com/q/25011204
tagged with: url-encoding
tagged with: java
tagged with: post
score: 0
answer count: 1
has body: I am sending a byte stream to the the rest service using the post method as follows : h = httplib2.Http(".cache") h.add_credentials("admin","admin") data = urllib.urlencode({"packet":str(pack)}) resp, content = h.request(url, "POST", data) the post call results to encode the byte stream with the % (data is encoded). Now I want to retrieve back the original byte stream. I tried in following manner at the rest service side (java) but I am not able to retrieve the original byte stream. String pack_decode = java.net.URLDecoder.decode(packet, "UTF-8"); // I am expecting decoded byte stream (free from `%` encoding) but I am getting the same encoded string.
has answer: http://stackoverflow.com/a/25013637
tagged with: rest
has title: How to decode the percentile encoded byte[]
type: UnansweredQuestion
tagged with: python
type: Question

http://stackoverflow.com/q/25013638
possible better answer: http://stackoverflow.com/a/29212126
has answer: http://stackoverflow.com/a/25013822
has answer: http://stackoverflow.com/a/50379131
has answer: http://stackoverflow.com/a/57814067
has answer: http://stackoverflow.com/a/43753716
has answer: http://stackoverflow.com/a/29212126
favorite count: 0
has answer: http://stackoverflow.com/a/59289742
has answer: http://stackoverflow.com/a/59548728
accepted answer: http://stackoverflow.com/a/25013822
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/55801343
tagged with: java
has answer: http://stackoverflow.com/a/58820966
has answer: http://stackoverflow.com/a/64487484
has answer: http://stackoverflow.com/a/46391218
upvote count: 218
type: Question
has body: I am using Android Studio on OS&nbsp;X. I am getting this error message: FAILURE: Build failed with an exception. What went wrong: Execution failed for task ':app:preDexDebug'. com.android.ide.common.internal.LoggedErrorException: Failed to run command: /Applications/Android Studio.app/sdk/build-tools/android-4.4W/dx --dex --output /Users/alex/AndroidStudioProjects/SilentSMS/app/build/intermediates/pre-dexed/debug/android-4.3_r2.1-f22bbff4d1017230e169a4844a9c2195f13060d2.jar /Users/alex/AndroidStudioProjects/SilentSMS/app/libs/android-4.3_r2.1.jar Error Code: 3 Output: UNEXPECTED TOP-LEVEL ERROR: java.lang.OutOfMemoryError: GC overhead limit exceeded at com.android.dx.cf.code.RopperMachine.getSources(RopperMachine.java:665) at com.android.dx.cf.code.RopperMachine.run(RopperMachine.java:288) at com.android.dx.cf.code.Simulator$SimVisitor.visitLocal(Simulator.java:612) at com.android.dx.cf.code.BytecodeArray.parseInstruction(BytecodeArray.java:412) at com.android.dx.cf.code.Simulator.simulate(Simulator.java:94) at com.android.dx.cf.code.Ropper.processBlock(Ropper.java:782) at com.android.dx.cf.code.Ropper.doit(Ropper.java:737) at com.android.dx.cf.code.Ropper.convert(Ropper.java:346) at com.android.dx.dex.cf.CfTranslator.processMethods(CfTranslator.java:282) at com.android.dx.dex.cf.CfTranslator.translate0(CfTranslator.java:139) at com.android.dx.dex.cf.CfTranslator.translate(CfTranslator.java:94) at com.android.dx.command.dexer.Main.processClass(Main.java:682) at com.android.dx.command.dexer.Main.processFileBytes(Main.java:634) at com.android.dx.command.dexer.Main.access$600(Main.java:78) at com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:572) at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:284) at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:166) at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:144) at com.android.dx.command.dexer.Main.processOne(Main.java:596) at com.…
downvote count: 0
score: 218
answer count: 13
has title: Android Studio Google JAR file causing GC overhead limit exceeded error
tagged with: overhead
has answer: http://stackoverflow.com/a/36695880
tagged with: android
has answer: http://stackoverflow.com/a/36637692

http://stackoverflow.com/q/24949807
tagged with: screen
has body: There is a blog by Angela Caicedo named Managing Multiple Screens in JavaFX. which shows how to manage screens of same size and same background. However, if I want to manage screens with different size, how can I achieve that?
type: Question
tagged with: java
has title: Managing screens of different size JavaFx
score: 0
has comment: http://stackoverflow.com/comment/38776602
has comment: http://stackoverflow.com/comment/38786012
type: UnansweredQuestion
tagged with: fxml
answer count: 0
tagged with: javafx

http://stackoverflow.com/comment/38919572
score: 0
type: Comment
type: QuestionComment
has text: @Tom - I've seen `@MappedSuperclass` used before but I wasn't 100% when it's applicable to use. I do want to create entities with the parent class as well as the child class. Edit: I take that back, Tom. After reading the documentation, I read: `A mapped superclass has no separate table defined for it.` That would suggest that it would not be applicable in my case.
comment on: http://stackoverflow.com/q/25025458

http://stackoverflow.com/comment/38925488
has text: File is present in that directory
type: QuestionComment
comment on: http://stackoverflow.com/q/25029007
score: 0
type: Comment

http://stackoverflow.com/comment/38892351
has text: You have to deal with synchronizing yourself rather than considering 'volatile'.
type: Comment
comment on: http://stackoverflow.com/a/24993227
score: 0
type: AnswerComment

http://stackoverflow.com/comment/38839600
type: Comment
score: 1
comment on: http://stackoverflow.com/a/24983695
has text: Of course assuming that those minutes after midnight are in the same timezone and ignoring DST.
type: AnswerComment

http://stackoverflow.com/comment/38865320
type: QuestionComment
comment on: http://stackoverflow.com/q/24996726
has text: What about configuration customizations?
score: 0
type: Comment

http://stackoverflow.com/q/24912664
has comment: http://stackoverflow.com/comment/38710575
has comment: http://stackoverflow.com/comment/38710644
type: Question
has comment: http://stackoverflow.com/comment/38850360
has answer: http://stackoverflow.com/a/24912935
has body: I'm new to Java EE and I have a task to do but no idea how to do it. I need to create a manged bean that will be scoped on the application. Everytime we start the application, the bean needs to load a list of data from database. So, according to my research on the web, I need: Create a managed Bean. Add the bean name to faces-config as an application scoped bean. On the bean, add all the methods to load the datas. So how to set loading at the application start-up ? And then how to get these loaded datas from anywhere in the app?
tagged with: faces-config
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/24912935
linked to: http://stackoverflow.com/q/24725062
tagged with: managed-bean
has comment: http://stackoverflow.com/comment/38706335
type: AnsweredQuestion
has title: Create managed bean application scoped to load on the app start-up
tagged with: jsf
tagged with: java

http://stackoverflow.com/comment/38812182
type: Comment
has text: Thanks for that. Given the non-web side of the application, what be the effort to implement such a jmx-service-interfaces-mechanism to the existing code? Let's say there might be a jmx-pyhton lib around for that. - Anyway I searched the internet and rarely found something, some tutorial or the like, on that...
type: AnswerComment
comment on: http://stackoverflow.com/a/24964284
score: 0

http://stackoverflow.com/comment/38946652
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25040609
has text: It's impossible with regex.
type: Comment

http://stackoverflow.com/comment/38967585
type: Comment
has text: You haven't tried anything. Loop over the longer array, and use the modulo (`%`) operator to generate the leftside index.
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25051585

http://stackoverflow.com/a/24994339
answers question: http://stackoverflow.com/q/24993956
upvote count: 3
has body: You are messing everything. No need to have aws-java-sdk-1.8.5.jar imported. This is aws-sdk java jar. For connecting to the RDS instance having MySql database. All you need is to import mysql-connector-java-5.1.18-bin.jar and have the access and credentials for the database launched in the RDS. Get the permission to connect to the database from your IP(Machine where code will run) And this code will connect to the database and you can execute the queries based on your credentials access. public static void main(String[] args) { try{ String host = "jdbc:mysql://rds-ip:3306/rds-database-name"; String uName = "rds-database-username"; String uPass = "rds-database-pasword"; Connection con = DriverManager.getConnection( host, uName, uPass ); Statement stmt = con.createStatement(); String sql = "SELECT * FROM tablename"; ResultSet rs = stmt.executeQuery(sql); rs.next(); int id_col = rs.getInt("id"); String column1 = rs.getString("column1"); String column2 = rs.getString("column2"); } catch(SQLException err){ System.out.println(err.getMessage()); } }
type: Answer
has comment: http://stackoverflow.com/comment/39080990
downvote count: 0
has comment: http://stackoverflow.com/comment/38923963
score: 3
has comment: http://stackoverflow.com/comment/38860059
has comment: http://stackoverflow.com/comment/38860303
accepted answer of: http://stackoverflow.com/q/24993956
type: AcceptedAnswer

http://stackoverflow.com/a/25028651
has comment: http://stackoverflow.com/comment/38926528
type: Answer
downvote count: 1
score: 1
has body: You could use this. StackTraceElement[] stackTrace = Thread.currentThread().getStackTrace(); for(StackTraceElement st : stackTrace){ // check st for further processing} This will give you the stack trace. Depending upon the depth of your function call. You can check and have your condition accordingly. Note: this has performance issue. I would recommend changing your design or use a boolean parameter in your function which decides the further flow. Hope this solves your query.
answers question: http://stackoverflow.com/q/25028567
upvote count: 2

http://stackoverflow.com/comment/38938736
comment on: http://stackoverflow.com/a/25036481
score: 0
type: AnswerComment
type: Comment
has text: Thanks again @AlexR - so if I wanted one var to be `fizz.buzz`, how would I run my app? Something like this: `java -jar myapp.jar -Dfizz.buzz=true`?

http://stackoverflow.com/q/25059684
accepted answer: http://stackoverflow.com/a/25059875
has body: I'd like to import some metadata from the web, by using the https protocol: @Bean public HTTPMetadataProvider ssoCircleMetadataProvider() throws MetadataProviderException { String metadataURL = "https://idp.ssocircle.com/idp-meta.xml"; final Timer backgroundTaskTimer = new Timer(true); HTTPMetadataProvider provider = new HTTPMetadataProvider( backgroundTaskTimer, httpClient(), metadataURL); provider.setParserPool(parserPool()); return provider; } By reading the documentation, I found this step: By default loading of metadata using the HTTP-based provider over HTTPS performs trust verification configured in your JDK. In case you'd like to use certificates in your keyStore, add the following bean which changes the socketFactory used by the HTTP Client: https Converting in Java Config, it becomes: @Bean public Protocol httpClientProtocol() { org.springframework.security.saml.trust.httpclient.TLSProtocolSocketFactory factory = new org.springframework.security.saml.trust.httpclient.TLSProtocolSocketFactory(); Protocol httpClientProtocol = new Protocol ("https", factory, 443); return httpClientProtocol; } @Bean public MethodInvokingFactoryBean methodInvokingFactoryBean() { MethodInvokingFactoryBean methodInvokingFactoryBean = new MethodInvokingFactoryBean(); methodInvokingFactoryBean.setTargetClass(Protocol.class); methodInvokingFactoryBean.setTargetMethod("registerProtocol"); Object[] args = {"https", httpClientProtocol()}; methodInvokingFactoryBean.setArguments(args); return methodInvokingFactoryBean; } But the org.springframework.security.saml.trust.httpclient.TLSProtocolSocketFactory class results not found. I'm using the version 1.0.0-RC2 of Spring SAML. Am I doing something wrong? How can I fix this error and load metadata as desired? Update By using the SNAPSHOT repository, I'm able to use the TLSProtocolSocketFactory class. I've imported into my keystore the certificate of SSOCircle, but despite that, the application returns an error as follows: [2014-07-31 17:33:…
downvote count: 0
answer count: 1
tagged with: spring-security
has comment: http://stackoverflow.com/comment/39016589
favorite count: 0
has comment: http://stackoverflow.com/comment/39016369
upvote count: 2
has comment: http://stackoverflow.com/comment/39016289
tagged with: spring
score: 2
type: AnsweredQuestion
has title: Load metadata from https with Spring SAML
has comment: http://stackoverflow.com/comment/39016638
tagged with: java
tagged with: spring-saml
has comment: http://stackoverflow.com/comment/39293511
type: Question
has comment: http://stackoverflow.com/comment/39017170
has answer: http://stackoverflow.com/a/25059875
has comment: http://stackoverflow.com/comment/39016322
tagged with: saml

http://stackoverflow.com/q/24931965
has body: I have a JTextPane, when there are too many lines, a vertical scroll bar appears, but when a line is too long, instead of appearing a horizontal scroll bar, the line breaks into two lines, how to make the horizontal bar appear instead of breaking into two lines, my jTextPane is added like this: JScrollPane jScrollPane1 = new JScrollPane(); jScrollPane1.setViewportView(jTextPane1);
has comment: http://stackoverflow.com/comment/38742159
upvote count: 2
tagged with: jtextpane
tagged with: scroll
has comment: http://stackoverflow.com/comment/38742050
tagged with: swing
has comment: http://stackoverflow.com/comment/38742496
score: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24932194
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/38742250
has title: How to make JTextPane scroll horizontally
tagged with: jscrollpane
answer count: 1
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/24932194

http://stackoverflow.com/q/25030576
favorite count: 0
has body: I'm failing to mock ResourceBundle.getString(). This is my code: ResourceBundle schemaBundle = Mockito.mock(ResourceBundle.class); Mockito.when(schemaBundle.getString("testKey_testPropertyName_ect")).thenReturn("testString1"); This gives the following exception on the second line: java.util.MissingResourceException: Can't find resource for bundle $java.util.ResourceBundle$$EnhancerByMockitoWithCGLIB$$9e259f03, key testKey_testPropertyName_ect at java.util.ResourceBundle.getObject(ResourceBundle.java:374) at java.util.ResourceBundle.getString(ResourceBundle.java:334) at com.foo.bar.resource.PropertyResourceTest.testGet(PropertyResourceTest.java:104) 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.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:76) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184) at org.junit.runners.ParentRunner.run(ParentRunner.java:236) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(…
answer count: 5
linked to: http://stackoverflow.com/q/10816737
has comment: http://stackoverflow.com/comment/61685874
has answer: http://stackoverflow.com/a/28751526
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/75506780
has title: How to mock ResourceBundle.getString()?
has answer: http://stackoverflow.com/a/29252590
has comment: http://stackoverflow.com/comment/38928153
type: Question
tagged with: java
score: 18
possible better answer: http://stackoverflow.com/a/26517338
upvote count: 18
has answer: http://stackoverflow.com/a/26517338
has comment: http://stackoverflow.com/comment/38928310
has comment: http://stackoverflow.com/comment/89954848
linked to: http://stackoverflow.com/q/3793791
has answer: http://stackoverflow.com/a/76736657
tagged with: mockito
downvote count: 0
accepted answer: http://stackoverflow.com/a/29252590
linked to: http://stackoverflow.com/q/18377160
has answer: http://stackoverflow.com/a/48248581

http://stackoverflow.com/a/24963792
type: Answer
upvote count: 3
score: 3
answers question: http://stackoverflow.com/q/24963718
downvote count: 0
has body: Using void in the constructor by definition leads it to not longer be the constructor. The constructor specifically has no return type. While void doesn't return a value in the strictest sense of the word, it is still considered a return type. In the second example (where you use the void), you would have to do h.class1() for the method to get called because it is no longer the constructor. Or you could just remove the void.

http://stackoverflow.com/q/25048497
has title: Im trying to get 21 random numbers, between 0 and 21 and non of them can be equals to each other
possible better answer: http://stackoverflow.com/a/25048527
tagged with: counter
has answer: http://stackoverflow.com/a/25048527
score: 0
tagged with: random
answer count: 3
has comment: http://stackoverflow.com/comment/38962595
linked to: http://stackoverflow.com/q/1519736
has answer: http://stackoverflow.com/a/25048920
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25048776
tagged with: java
type: Question
has body: Hello I'm trying to make 21 numbers. they all need to be a number between 0 - 21. Sound easy.. but They need to be in a random order and non off them can be equal I have tried many things but, some of them always will be equal Please help! :) public void getIngrediet(){ board[1][5] += getRandomIngredient(); board[1][4] += getRandomIngredient(); board[1][3] += getRandomIngredient(); board[1][2] += getRandomIngredient(); board[1][1] += getRandomIngredient(); board[2][5] += getRandomIngredient(); board[2][3] += getRandomIngredient(); board[2][1] += getRandomIngredient(); board[3][5] += getRandomIngredient(); board[3][4] += getRandomIngredient(); board[3][3] += getRandomIngredient(); board[3][2] += getRandomIngredient(); board[3][1] += getRandomIngredient(); board[4][5] += getRandomIngredient(); board[4][3] += getRandomIngredient(); board[4][1] += getRandomIngredient(); board[5][5] += getRandomIngredient(); board[5][4] += getRandomIngredient(); board[5][3] += getRandomIngredient(); board[5][2] += getRandomIngredient(); board[5][1] += getRandomIngredient(); } public String getRandomIngredient(){ r = new Random(); int i1 = r.nextInt(21); String randomID = String.valueOf(i1); boolean b[] = new boolean[21]; if(b[0] == false){b[0] = true; return randomID;} if(b[1] == false){b[1] = true; return randomID;} if(b[2] == false){b[2] = true; return randomID;} if(b[3] == false){b[3] = true; return randomID;} if(b[4] == false){b[4] = true; return randomID;} if(b[5] == false){b[5] = true; return randomID;} if(b[6] == false){b[6] = true; return randomID;} if(b[7] == false){b[7] = true; return randomID;} if(b[8] == false){b[8] = true; return randomID;} if(b[9] == false){b[9] = true; return randomID;} if(b[10] == false){b[10] = true; return randomID;} if(b[11] == false){b[11] = true; return randomID;} if(b[12] == false){b[12] = true; return randomID;} if(b[13] == false){b[13] = true; return randomID;} if(b[14] == false){b[14] = true; return randomID;} if(b[15] == false){b[15] = true; ret…
accepted answer: http://stackoverflow.com/a/25048920

http://stackoverflow.com/comment/38761598
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/24941884
type: Comment
has text: Yes, they are different, but my code is using "" and not ''.

amazon-elastic-beanstalk
tag name: amazon-elastic-beanstalk
type: Tag
tags question: http://stackoverflow.com/q/24963587

http://stackoverflow.com/comment/38861831
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24995206
has text: Oops. Okay - removed that link. Thanks!
score: 0

android-listview
tags question: http://stackoverflow.com/q/24993266
tags question: http://stackoverflow.com/q/25064864
tags question: http://stackoverflow.com/q/24913970
tags question: http://stackoverflow.com/q/24909422
tags question: http://stackoverflow.com/q/25013843
tags question: http://stackoverflow.com/q/25025230
tags question: http://stackoverflow.com/q/25042663
tags question: http://stackoverflow.com/q/25000029
tags question: http://stackoverflow.com/q/25026545
tags question: http://stackoverflow.com/q/25053134
tags question: http://stackoverflow.com/q/24970171
tags question: http://stackoverflow.com/q/24973059
tags question: http://stackoverflow.com/q/25069432
tags question: http://stackoverflow.com/q/24914947
tag name: android-listview
type: Tag
tags question: http://stackoverflow.com/q/24948817

http://stackoverflow.com/a/25040349
accepted answer of: http://stackoverflow.com/q/25040222
downvote count: 0
answers question: http://stackoverflow.com/q/25040222
upvote count: 2
type: Answer
score: 2
type: AcceptedAnswer
has body: The first case is clear. 405 means "Method Not Allowed". It is typically thrown by container or framework if specific URL cannot reply to request of current method. But you do use correct method but with empty body that causes NPE in your code. In this case 500 status is expected. Issue 2 is not clear. You should send more details. You either do not send POST or the URL can accept POST. Please double check and send details about your configuration, some code snippets etc. EDIT: after posting some code I can say that GET request cannot consume anything. Remove @Consumes({ MediaType.APPLICATION_JSON }) from findMyEntityById(). Try it. If it helps you can say that it is a kind of bug in Jersey: it actually should either throw exception during deployment that GET cannot consume anything or ignore @Consume if GET method is processed.

http://stackoverflow.com/a/31447529
answers question: http://stackoverflow.com/q/24944972
upvote count: 3
type: Answer
score: 3
downvote count: 0
has body: The reason is that there is no inverse operation because that is simply too computationally expensive if done using Cramer's Rule. I initially thought this weird as it could have been implemented using Gauss Jordon elimination. But it is strange that even I could not find one. If anyone finds it in JBLAS please comment below. One alternative that I can suggest is using pinv(). It uses the least square method and is present in org.jblas.Solve as a static function. import org.jblas.Solve public static SimpleEigenDecomposition SimpleEigenDecomposition(double [][] rates) { // inside the main function replace this for your implementation of inverse DoubleMatrix Vinverse = Solve.pinv(V); } Lease squares pinv gives the same output as actual inverse when the matrix in invertible.

http://stackoverflow.com/q/24985813
has answer: http://stackoverflow.com/a/38151771
tagged with: eclipse-kepler
answer count: 4
has title: Cannot set the glassfish server runtime enviroment in eclipse
tagged with: java
tagged with: eclipse
type: Question
has body: I changed my default jre to jdk 1.7x in eclipse kepler. I was getting a null pointer exception when I started glassfish 4. To fix this issue, I did all the steps to change the jre/jdk of my glassfish. On the final screen, when I click finish, nothing happens. This looks like a bug in the software. Please help me to fix my problem. Note: When I try to clean the server using my server > right click > clean, I get the same null pointer exception again. Edit- I tried one solution which does not help: Apparently when Glassfish is installed it hard-codes its reference to your JDK location, so to fix this problem I ended up having to edit a file named asenv.bat. In short, I edited this file: C:\glassfish\config\asenv.bat. and I commented out the reference to JDK 6 and added a new reference to JDK 5, like this: REM set AS_JAVA=C:\Program Files\Java\jdk1.6.0_04\jre/.. set AS_JAVA=C:\Program Files\Java\jdk1.5.0_16 This solved the problem, and Glassfish started right up after this change. But my asenv.dat file contains no such path. Anyway, I added set AS_JAVA = my jdk path here and it did not help. set AS_IMQ_LIB=..\..\mq\lib set AS_IMQ_BIN=..\..\mq\bin set AS_CONFIG=..\config set AS_INSTALL=.. set AS_DEF_DOMAINS_PATH=..\domains set AS_DEF_NODES_PATH=..\nodes set AS_DERBY_INSTALL=..\..\javadb REM I added my line here Another solution which leaves me with the same problem: Install latest eclipse luna with latest glassfish 4.
tagged with: glassfish
has answer: http://stackoverflow.com/a/24986555
score: 0
has answer: http://stackoverflow.com/a/24987168
has answer: http://stackoverflow.com/a/34186867
type: UnansweredQuestion
tagged with: glassfish-4

http://stackoverflow.com/q/24986776
has answer: http://stackoverflow.com/a/34569142
has answer: http://stackoverflow.com/a/54499911
downvote count: 0
tagged with: javafx
score: 13
type: AnsweredQuestion
tagged with: recursion
tagged with: java
possible better answer: http://stackoverflow.com/a/38717244
answer count: 6
has body: In C# I found a method that was pretty sweet that allowed you to get all the descendants and all of THEIR descendants from a specified control. I'm looking for a similar method for JavaFX. I saw that the Parent class is what I want to work with since it is the class from which all Node classes that bear children are derived. This is what I have so far (and I haven't really found anything on google with searches like "JavaFX get all nodes from a scene"): public static ArrayList&lt;Node&gt; GetAllNodes(Parent root){ ArrayList&lt;Node&gt; Descendents = new ArrayList&lt;&gt;(); root.getChildrenUnmodifiable().stream().forEach(N -&gt; { if (!Descendents.contains(N)) Descendents.add(N); if (N.getClass() == Parent.class) Descendents.addAll( GetAllNodes((Parent)N) ); }); } So how do I tell if N is a parent (or extended from a parent)? Am I doing that right? It doesn't seem to be working... It's grabbing all the nodes from the root (parent) node but not from the nodes with children in them. I feel like this is something that's probably got an answer to it but I'm just asking the question... wrong. How do I go about doing this?
accepted answer: http://stackoverflow.com/a/24986845
type: Question
has comment: http://stackoverflow.com/comment/81017969
has answer: http://stackoverflow.com/a/38717244
upvote count: 13
has answer: http://stackoverflow.com/a/24986845
favorite count: 0
linked to: http://stackoverflow.com/q/17117612
has title: How do I get all nodes in a parent in JavaFX?
has answer: http://stackoverflow.com/a/30013583
tagged with: javafx-8
has answer: http://stackoverflow.com/a/54615581
has comment: http://stackoverflow.com/comment/97886947

http://stackoverflow.com/q/24918810
tagged with: converters
has title: log4j2 configuration will not load custom pattern converter
has body: I am trying to create a custom pattern converter for log4j 2.0, but am having issues getting my log4j configuration to recognize the pattern. Here is the custom converter: package com.test.log4j.plugins; import org.apache.logging.log4j.Marker; import org.apache.logging.log4j.core.LogEvent; import org.apache.logging.log4j.core.config.plugins.Plugin; import org.apache.logging.log4j.core.pattern.ConverterKeys; import org.apache.logging.log4j.core.pattern.LogEventPatternConverter; @Plugin(name="MarkerNamePatternConverter", category="Converter") @ConverterKeys({"markername"}) public class MarkerNamePatternConverter extends LogEventPatternConverter { public static MarkerNamePatternConverter newInstance(final String[] options) { return new MarkerNamePatternConverter("markername", "markername"); } protected MarkerNamePatternConverter(String name, String style) { super(name, style); } @Override public void format(LogEvent event, StringBuilder toAppendTo) { Marker marker = event.getMarker(); if (marker != null) { // MarkerPatternConverter appends Marker.toString() // which includes the parents of the marker. We just // want the marker's name toAppendTo.append(marker.getName()); } } } And here is my log4j configuration file: <?xml version="1.0" encoding="UTF-8"?> <PatternLayout pattern=" %-6level %markername %d{YYYY-MM-dd HH:mm:ss} %msg%n"/> <AppenderRef ref="console"/> Note that I have included the package which contains the custom converter in my configuration, the lack of which seems to be a common cause of issues when using custom plugins. When test code is executed, the configuration status output does not indicate that the plugin is loaded or found, and log4j treats the %markername as if it is the "%marker" conversion pattern followed by "name". For example, Marker marker = MarkerManager.getMarker("TEST"); log.info(marker, "test message"); produces the following output: INFO TESTname 2014-07-23 14:47:57 test message I tried changing the conversion key a value that did no…
tagged with: plugins
possible better answer: http://stackoverflow.com/a/48043545
type: AnsweredQuestion
downvote count: 0
tagged with: java
score: 6
tagged with: log4j2
tagged with: logging
type: Question
has answer: http://stackoverflow.com/a/24931395
accepted answer: http://stackoverflow.com/a/24931395
upvote count: 6
answer count: 2
favorite count: 0
has answer: http://stackoverflow.com/a/48043545

http://stackoverflow.com/comment/49474565
comment on: http://stackoverflow.com/a/30703984
type: Comment
score: 0
has text: My concern was regarding to minor version of compiled class. I agree, we can compile code regarding to a specified major version. Need to test what if 2 different compilers with different minor versions create identical .class files
type: AnswerComment

http://stackoverflow.com/comment/38874559
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25001500
has text: I have a keyGenerator class which works fine.
score: 0

code-generation
tag name: code-generation
tags question: http://stackoverflow.com/q/25007427
type: Tag

http://stackoverflow.com/a/25051113
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38967426
has body: Most likely, you did not make "time" an indexed property. From the documentation: A query can't find property values that aren't indexed, nor can it sort on such properties. See the Datastore Indexes page for a detailed discussion of unindexed properties. UPDATE: You store it as a String. It will sort it as a String, not by time. You should store it as a Long value - it will save you a lot of space and the sorting will be correct.
accepted answer of: http://stackoverflow.com/q/25051094
has comment: http://stackoverflow.com/comment/38967326
type: Answer
answers question: http://stackoverflow.com/q/25051094
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/38967526
has comment: http://stackoverflow.com/comment/38967308
has comment: http://stackoverflow.com/comment/38966878
upvote count: 1

http://stackoverflow.com/a/24969973
has comment: http://stackoverflow.com/comment/38815810
type: Answer
has body: value of @RequestMapping is "/admin/product.file.add", and the action of form is action="product.file.add". I think the should be action="/admin/product.file.add" Or you can try with &lt;form method="POST" enctype="multipart/form-data" action="/product.file.add"&gt;
answers question: http://stackoverflow.com/q/24969759
score: 0

http://stackoverflow.com/comment/38806791
type: AnswerComment
type: Comment
score: 3
comment on: http://stackoverflow.com/a/24966161
has text: `ArrayList<Integer> integerArgs[];` is perfectly fine syntax. It just isn't what the OP wants.

http://stackoverflow.com/comment/38948208
type: Comment
comment on: http://stackoverflow.com/a/25040885
score: 0
type: AnswerComment
has text: I might post another question regarding this, to mark the part problem solved

http://stackoverflow.com/q/25039045
has body: Could anyone just help me understand this? If we have a class: public class Sample{ public synchronized method1(){ //Line1 .... wait(); //Line2 .... } } Now, when 3 new threads try to call the method 'method1' on the same object Sample s = new Sample(); Thread t1 = new Thread(); // t2 and t3 and inside run method of each of these threads, we call s.method1(). So, how does it work here? When t1 accesses method1, it goes in the method and calls wait. What about the rest of the threads when it tries to access method1? Do they get blocked on the method1 since synchronization allows only one thread to access the object instance at a time? Or do they go to wait state?
possible better answer: http://stackoverflow.com/a/25039127
downvote count: 0
accepted answer: http://stackoverflow.com/a/25039128
has answer: http://stackoverflow.com/a/25039127
favorite count: 0
has comment: http://stackoverflow.com/comment/38943660
upvote count: 2
tagged with: multithreading
has title: Call to Synchronization/wait?
score: 2
type: AnsweredQuestion
tagged with: java
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/25039128

http://stackoverflow.com/q/24912819
has answer: http://stackoverflow.com/a/24912895
tagged with: hibernate-mapping
type: AnsweredQuestion
tagged with: java
tagged with: hibernate
type: Question
accepted answer: http://stackoverflow.com/a/24912895
has comment: http://stackoverflow.com/comment/38706359
has body: I am using this simple Hibernate Mapping xml to create an entity &lt;?xml version="1.0" encoding="UTF-8" standalone="no"?&gt; &lt;hibernate-mapping&gt; &lt;class entity-name="FirstTestType"&gt; &lt;property column="createdOn" name="java.sql.Timestamp" type="java.sql.Timestamp"/&gt; &lt;id column="id" name="id" type="java.lang.Long"&gt; &lt;generator class="identity"/&gt; &lt;/id&gt; &lt;property column="modifiedOn" name="java.sql.Timestamp" type="java.sql.Timestamp"/&gt; &lt;property column="testString" length="100" name="java.lang.String" type="java.lang.String"/&gt; &lt;property column="testInt" name="int" type="int"/&gt; &lt;property column="testBoolean" name="boolean" type="boolean"/&gt; &lt;property column="testLong" name="long" type="long"/&gt; &lt;/class&gt; &lt;/hibernate-mapping&gt; Though my schema is effectively created when I use SchemaExport final SchemaExport export = new SchemaExport(getHibernateConfigurationForSchema()); export.create(true, true); When I try to create a sessionfactory I am getting this exception org.hibernate.MappingException: Duplicate property mapping of java.sql.Timestamp found in FirstTestType at org.appops.entityStore.hibernate.session.HibernateSessionFactoryProvider.setupSchemaSessionFactory(HibernateSessionFactoryProvider.java:78) at org.appops.entityStore.hibernate.session.HibernateSessionFactoryProviderTest.testSessionCreation(HibernateSessionFactoryProviderTest.java:110) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.lang.reflect.Method.invoke(Method.java:606) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.lang.reflect.Method.invoke(Method.java:606) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runT…
score: 0
has title: Duplicate Property mapping exception in hibernate
answer count: 1

http://stackoverflow.com/q/24981064
has answer: http://stackoverflow.com/a/24981213
answer count: 1
has title: java load values from database into comboBox
type: UnansweredQuestion
has body: Hi my aim is to load combobox with vaules from a database the code below works fine with one issue i get two of the first item so what must i do to prevent this public void loadCombos() { try { try { String cs = "jdbc:mysql://localhost:3307/booksalvation6"; String user = "root"; String password = "letmein"; jComboBox2.removeAllItems();// make sure old data gone PreparedStatement pstpost; ResultSet rspost; conCombos = DriverManager.getConnection(cs, user, password); for (int i = 1; i &lt; 11; i++) { String querypost = "select * from post " + "WHERE postage_id =" + i; // load postage selections pstpost = conCombos.prepareStatement(querypost); rspost = pstpost.executeQuery(); while (rspost.next()) { String Mypost = rspost.getString(6); jComboBox2.addItem(Mypost); } } } catch (SQLException ex) { Logger.getLogger(BasicFrame.class.getName()).log(Level.SEVERE, null, ex); } conCombos.close(); } catch (SQLException ex) { Logger.getLogger(BasicFrame.class.getName()).log(Level.SEVERE, null, ex); } }
tagged with: java
type: Question
score: 0

http://stackoverflow.com/comment/38890196
type: QuestionComment
comment on: http://stackoverflow.com/q/24987649
has text: Does the app. use layout managers, and always `pack()` the top level container (dialog, frame..)?
score: 0
type: Comment

http://stackoverflow.com/comment/38815725
score: 0
type: QuestionComment
type: Comment
has text: OK, so what's the value of `newInterval` that gives you this problem? And what timezone are you in? Give me something to try out and debug. Because honestly, apart from the daylight savings issue, your code looks OK to me. Incidentally, you'll definitely get this bug occurring when daylight savings begins or ends, so you may want to sort that out.
comment on: http://stackoverflow.com/q/24969331

http://stackoverflow.com/comment/38747470
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24933930
type: Comment
has text: I know that but I want to do that automatically when someone click that link

http://stackoverflow.com/q/24933710
has body: I'm trying to run php on Apache Tomcat/7.0.42 using JavaBridgeTemplate621. But when I go to the localhost:8080/JavaBridgeTemplate621/index.php I saw this: HTTP Status 500 - php.java.bridge.http.FCGIConnectException: Could not connect to server OS is Ubuntu. PHP Version 5.5.3-1ubuntu2.6. PHP is working: phpinfo() function shows my PHP config (localhost/test.php) How can I fix it? P.S. I heard that I must put php-cgi to the /var/lib/tomcat7/webapps/JavaBridgeTemplate621/WEB-INF/cgi/i386-linux. Where can I take it?
score: 0
answer count: 1
tagged with: php-java-bridge
tagged with: tomcat
tagged with: php
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/24951167
type: Question
accepted answer: http://stackoverflow.com/a/24951167
has title: JavaBridge don't open php (Could not connect to server)

http://stackoverflow.com/comment/38994923
score: 0
comment on: http://stackoverflow.com/q/25063177
type: Comment
type: QuestionComment
has text: ASAP is an acronym meaning "As Soon As Possible".

http://stackoverflow.com/comment/38769807
type: Comment
type: QuestionComment
score: 0
has text: its just that, there are two classes and the problem could be comming from the constructor of the other class interfering with the for loop problem I have
comment on: http://stackoverflow.com/q/24945907

http://stackoverflow.com/q/24910541
tagged with: methods
type: Question
accepted answer: http://stackoverflow.com/a/24910596
tagged with: arrays
score: 0
answer count: 7
has title: Printing Methods
has answer: http://stackoverflow.com/a/24910670
possible better answer: http://stackoverflow.com/a/24910591
has answer: http://stackoverflow.com/a/24910602
has answer: http://stackoverflow.com/a/24910591
has answer: http://stackoverflow.com/a/24910640
has answer: http://stackoverflow.com/a/24910596
has body: I am trying to print the contents of a method (purchase(String isbn, double price, int copies)), but am having no luck. As the following code is written, import java.util.Scanner; import java.io.*; public class Store { public static void main(String[] args) throws Exception { Book[] books = readInventory(); for (Book book : books) { System.out.printf("ISBN: %s, Price: %f, Copies: %d%n", book.getISBN(), book.getPrice(), book.getCopies()); } String isbn; double price; int copies; purchase(isbn, price, copies); } public static Book[] readInventory() throws Exception { Book[] books = new Book[10]; java.io.File file = new java.io.File("../instr/prog4.dat"); Scanner fin = new Scanner(file); String isbn; double price; int copies; int i = 0; while (fin.hasNext()) { isbn = fin.next(); if (fin.hasNextDouble()); { price = fin.nextDouble(); } if (fin.hasNextInt()); { copies = fin.nextInt(); } Book book = new Book(isbn, price, copies); books[i] = book; i++; } fin.close(); return books; } public static Book[] purchase(String isbn, double price, int copies, Book[] books) { int itemsSold = 0; double totalMade = 0; Scanner input = new Scanner(System.in); int desiredCopies = 0; System.out.println("Please enter the ISBN number of the book you would like to purchase: "); String desiredIsbn = input.next(); for(int index = 0; index &lt; books.length; index++) { if(!books[index].getISBN().equals(desiredIsbn)) System.out.println("We do not have that book in our inventory."); if(books[index].getISBN().equals(desiredIsbn) &amp;&amp; copies == 0) System.out.println("That book is currently out of stock."); if(books[index].getISBN().equals(desiredIsbn) &amp;&amp; copies &gt; 0) { System.out.println("How many copies of this book would you like to purchase?"); desiredCopies = input.nextInt(); } if(desiredCopies &gt; copies) System.out.println("We only have " + copies + "in stock. Please select another quantity: "); desiredCopies = input.nextInt(); // copies = copies - desiredCopies double total =…
has answer: http://stackoverflow.com/a/24910767
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24910619
tagged with: java

http://stackoverflow.com/q/25038910
answer count: 1
downvote count: 0
tagged with: callback
favorite count: 0
has body: I am creating a library. It creates an activity, starts it, and finishes it after a button is pressed. After the button is pressed, I'd like to execute some client code through an interface. That is, users of this library pass in an implementation, and I simply execute it. The analogous iOS code would be: MyViewController *vc = [[MyViewController alloc] init]; vc.callOnComplete = ... [self presentViewController:vc animated:YES completion:nil]; The desired code is: public interface SaveStuff { void save(); } In my library's Activity: private SaveStuff saveStuff; public void onButtonClicked(View v) { saveStuff.save() // client passes in saveStuff obj finish(); } I've tried serialization. I made a class that implemented the interface and also implemented Serializable, and tried passing that in and extracting it with getSerializableExtra. I end up getting a non serializable exception. So far as I know, this is probably not a viable solution, as it would mean that clients must use only serializable classes in their implementations. Correct me if I am wrong on this. In my trials, the client activity was showing up in the non serializable exception. I've tried using a static reference. Basically global state/singleton. As it turns out, according to a variety of answers such as this one: Java Static Variable becomes null, I cannot rely on any static state, and any solutions that do work with static state are just working coincidently. I haven't tried simply starting the activity with startActivityForResult, because that would require me to cast the context we are accepting as a parameter to an Activity. The activity is started inside the library with this: private void startNewActivity(int newVersion) { Intent i = new Intent(context, MyActivity.class); i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(i); // context variable is passed in by the client } As you can see, context is passed in by the client. I could perhaps cast the context to an Activity in orde…
has comment: http://stackoverflow.com/comment/38944770
tagged with: android
has comment: http://stackoverflow.com/comment/38946688
tagged with: android-activity
type: UnansweredQuestion
has title: Android: How do you pass a callback to an activity?
has answer: http://stackoverflow.com/a/25484929
has comment: http://stackoverflow.com/comment/38943648
upvote count: 5
tagged with: java
linked to: http://stackoverflow.com/q/16736187
type: Question
has comment: http://stackoverflow.com/comment/38943511
has comment: http://stackoverflow.com/comment/38944649
score: 5

http://stackoverflow.com/a/24993921
downvote count: 0
score: 1
type: Answer
has comment: http://stackoverflow.com/comment/38860104
upvote count: 1
has body: Here is the explanation with same problem. http://www.kuligowski.pl/java/rest-style-urls-and-url-mapping-for-static-content-apache-tomcat,5
accepted answer of: http://stackoverflow.com/q/24987961
answers question: http://stackoverflow.com/q/24987961
type: AcceptedAnswer

http://stackoverflow.com/q/25010812
type: Question
has body: In maven project (Intellij Idea) I've got java.lang.ClassNotFoundException because I'm trying to create an object of a class which needs some external libraries. public HelloWorldController() { service = new FileService(); products.add(new Product("hello")); products.add(new Product("world")); } Everything works perfect without service = new FileService();, and here is FileService class: public class FileService { public FileService() { irodsAccount = new IRODSAccount("192.168.6.128",1247,"rods","rods","","tempZone","demoResc"); try { irodsFileSystem = new IRODSFileSystem(); } catch (JargonException ex) { } try { this.dataTransferOps = irodsFileSystem.getIRODSAccessObjectFactory().getDataTransferOperations(irodsAccount); } catch (JargonException ex) { } } private String targetIrodsFileAbsolutePath; private IRODSAccount irodsAccount; private IRODSFileSystem irodsFileSystem; private TransferControlBlock transferControlBlock; private DataTransferOperations dataTransferOps = null; public IRODSFile getIRODSFileForPath(String irodsFilePath) throws Exception { if (irodsFilePath == null || irodsFilePath.isEmpty()) { throw new Exception("null or empty irodsFilePath"); } return irodsFileSystem.getIRODSFileFactory(irodsAccount).instanceIRODSFile(irodsFilePath); } } IRODSAccount, IRODSFileSystem and other similar classes are got from external jars, which I connected to the project (added modules), but after running my project I have something like this: Caused by: java.lang.ClassNotFoundException: org.irods.jargon.core.exception.JargonException at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:50) at org.codehaus.plexus.classworlds.realm.ClassRealm.unsynchronizedLoadClass(ClassRealm.java:259) at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:235) at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:227) at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:…
answer count: 2
tagged with: intellij-idea
has answer: http://stackoverflow.com/a/25011013
has comment: http://stackoverflow.com/comment/38890856
has title: java.lang.ClassNotFoundException maven
score: 0
tagged with: windows
possible better answer: http://stackoverflow.com/a/25011013
has answer: http://stackoverflow.com/a/25011046
has comment: http://stackoverflow.com/comment/38892003
tagged with: maven
has comment: http://stackoverflow.com/comment/38890675
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38890761
accepted answer: http://stackoverflow.com/a/25011046
tagged with: java

http://stackoverflow.com/a/25050402
answers question: http://stackoverflow.com/q/25049698
score: 0
type: Answer
has body: When we say reading with 'MultiResourceItemReader', we should understand that reading multiple files with same structure. Below is the code snippet on how to configure MultiResourceItemReader: &lt;bean id="multiResourceReader" class="org.spr...MultiResourceItemReader"&gt; &lt;property name="resources" value="classpath:data/input/file-*.txt" /&gt; &lt;property name="delegate" ref="flatFileItemReader" /&gt; &lt;/bean&gt; Here we are reading all the .txt files from the same location and we are using a singe item reader thats mentioned as delegate. Please refer to the following link for more detail http://docs.spring.io/spring-batch/trunk/reference/html/readersAndWriters.html In your case, since you have few files with headers and few files without header, you will have to use multiple readers and then process the data.

http://stackoverflow.com/comment/38792715
comment on: http://stackoverflow.com/q/24958900
score: 2
has text: This is why it's a good habit to get into to *always* uses braces with your if-then-else statements.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39075422
type: Comment
comment on: http://stackoverflow.com/a/24971553
type: AnswerComment
has text: One advantage using MDC here is to avoid having one Logger for each ID (simply add `static` on `logger` attribute). Can be interesting if you have many instances of `MyClass`. As for other log levels: yes, you need one method for each log level.
score: 0

http://stackoverflow.com/comment/38889406
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25010164
type: AnswerComment
has text: what doc? why don't you provide a link for OP?

http://stackoverflow.com/a/24967120
has body: Use ^ (matches at the beginning of the string) and $ (matches at the end) anchors: s = s.replaceAll("^[^a-zA-Z0-9\\s]+|[^a-zA-Z0-9\\s]+$", "");
has comment: http://stackoverflow.com/comment/38808787
has comment: http://stackoverflow.com/comment/38808694
answers question: http://stackoverflow.com/q/24967089
has comment: http://stackoverflow.com/comment/38808800
score: 15
has comment: http://stackoverflow.com/comment/38810107
accepted answer of: http://stackoverflow.com/q/24967089
upvote count: 15
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/38808665
has comment: http://stackoverflow.com/comment/38808630
has comment: http://stackoverflow.com/comment/38808705
type: Answer

http://stackoverflow.com/q/24979824
upvote count: 2
has comment: http://stackoverflow.com/comment/38835257
has comment: http://stackoverflow.com/comment/38834991
tagged with: validation
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/24982216
accepted answer: http://stackoverflow.com/a/24982216
has title: How to create alias for action in Struts2
favorite count: 0
has comment: http://stackoverflow.com/comment/38833652
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38837240
type: Question
has body: Both of these files are having same validation rules.How to used same xml for mupltiple Actions? Action1-validation.xml Action2-validation.xml struts.xml: &lt;action name="Action1" class="test.Action1"/&gt; &lt;action name="Action2" class="test.Action2"/&gt; Now how to use the same validation file based on the Action alias name for both Actions? How to create alias name for an Action ? Action1 { String name; Date dob; int age; } Action2 { String name; Date dob; int age; } what is the meaning of ActionAliasName and How to create that ?,which is mentioned from below line. The validation.xml format is either &lt;ActionClassName&gt;-validation.xml or &lt;ActionClassName&gt;-&lt;ActionAliasName&gt;-validation.xml.
has comment: http://stackoverflow.com/comment/38834692
tagged with: configuration
tagged with: java
tagged with: struts2

http://stackoverflow.com/q/24917649
upvote count: 3
tagged with: java
type: Question
tagged with: submenu
has body: I am writing a navigation system using the ExpandableListView widget, and I am able to have expandable lists, that function properly, but what about items in the navigation that have no submenus like Home and just transition straight to the Home Fragment? All of the Group Items appear as dropdown-able even though they don't have any children. Can I take away the dropdown icon from the parents that don't have children? Or can I only either, have Icons or not have icons.
has answer: http://stackoverflow.com/a/24917913
answer count: 1
downvote count: 0
favorite count: 0
has title: How can I make some of the Items in ExpandableListView Not Expandable
tagged with: android
accepted answer: http://stackoverflow.com/a/24917913
tagged with: fragment
tagged with: expandablelistview
type: AnsweredQuestion
score: 3

http://stackoverflow.com/q/25057801
score: 3
tagged with: dependency-injection
upvote count: 3
tagged with: java
has title: Inject @Context values into regular beans
has body: Is it possible to inject @Context values into regular spring beans (not Jax-Rs resources or providers)? JERSEY-469 would suggest it can be done, but when I view it in debugger the fields are null (I'm checking this well after creation, this is not a problem with InitializingBean, I can't get the field injected at all). @Component @Scope("prototype") public final class TaskDO { @Context private ResourceContext resourceContext; @FormParam("xml") private String xml; }
has comment: http://stackoverflow.com/comment/38979247
type: Question
tagged with: jersey
downvote count: 0
tagged with: jax-rs
has comment: http://stackoverflow.com/comment/38979343
favorite count: 0
answer count: 0
has comment: http://stackoverflow.com/comment/38979120
type: UnansweredQuestion
tagged with: spring
has comment: http://stackoverflow.com/comment/38979048

http://stackoverflow.com/q/25027884
type: Question
has comment: http://stackoverflow.com/comment/38923451
has comment: http://stackoverflow.com/comment/38923462
has body: I am trying to write a servlet that will download a .pptx file from a known path on the server. After calling the servlet the AJAX method calling it returns an error. The text status is parseerror and the error thrown is Error {stack: (...), message: "Invalid XML: PK���D[Conten…edia/slide10_image_rId2.pngPK))�U�"} To my knowledge the XML is indeed valid as I have tried various powerpoint files created both programatically and through Microsoft Powerpoint itself. The relevant code: response.reset(); response.resetBuffer(); response.setContentType("application/vnd.openxmlformats-officedocument.presentationml.presentation"); response.setHeader("Content-Disposition", "attachment; filename=\"presentation.pptx\""); File file=new File(root+sessionID+"/myPresentation.pptx"); response.setContentLength((int) file.length()); InputStream in = new FileInputStream(file); OutputStream out = response.getOutputStream(); IOUtils.copy(in, out); out.flush(); out.close(); in.close(); response.flushBuffer(); I have tried changing the content type to application/octet-stream and using other .pptx as well as various other methods of streaming the data without the use of IOUtils and all of which end with the same error. Other things I have determined: the InvalidXML error is always in the last .xml part. Also, regardless of the presence of the response.setContentLength((int) file.length()); the program writes the same number of Am I missing anything or is anything wrong? Thanks!
tagged with: servlets
score: 0
tagged with: file-io
tagged with: xml-parsing
has title: Invalid XML Error When Downloading From Servlet
has comment: http://stackoverflow.com/comment/38923399
has comment: http://stackoverflow.com/comment/38923589
has comment: http://stackoverflow.com/comment/38923266
tagged with: download
type: UnansweredQuestion
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/38923584

http://stackoverflow.com/comment/38973006
type: QuestionComment
has text: What is the value of 'url' after the first line of main has been executed? If it is null, then img/abc.jpg is not being found on the class path.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25054482

http://stackoverflow.com/comment/54050796
score: 0
has text: I did find it in my browser history: http://unix.stackexchange.com/questions/235335/the-linux-kernel-breaking-user-space. Just a passing remark in [this answer](http://unix.stackexchange.com/a/235338/37709) to that question. @MatthewCornell
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24995066

http://stackoverflow.com/q/24949012
has answer: http://stackoverflow.com/a/24949320
tagged with: eclipse
tagged with: listview
score: 0
linked to: http://stackoverflow.com/q/23422072
has body: I am using a custom adapter for a listview in android.The listview has one image and two textviews in each item.But i want to create a search function for the listview.But i need to create a second adapter for the listview to implement the search functionality.Is there a way to add an extra adapter to a listview in android? My current adapter: package com.igloo.adapters; import java.io.InputStream; import java.text.NumberFormat; import java.util.ArrayList; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import org.apache.http.HttpResponse; import org.apache.http.client.HttpClient; import org.apache.http.client.methods.HttpPost; import org.apache.http.impl.client.DefaultHttpClient; import org.apache.http.protocol.BasicHttpContext; import org.apache.http.protocol.HttpContext; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import com.androidquery.AQuery; import com.igloo.adapters.CustomStoreAdapter.StoreHolder; import com.igloo.classes.Store_data; import com.igloo.storelocater.R; import com.igloo.storelocater.StoreFinal; import android.app.Activity; import android.content.Intent; import android.location.Location; import android.location.LocationManager; import android.os.Bundle; import android.provider.DocumentsContract.Document; import android.view.LayoutInflater; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.ImageView; import android.widget.RelativeLayout; import android.widget.TextView; public class CustomDetailsAdapter extends BaseAdapter { private Activity context; private LayoutInflater details_inflate; ArrayList&lt;Store_data&gt; store_list; AQuery androidQuery; String URL_image="http://footballultimate.com/storelocator/resource/uploads/"; double current_latitude,current_longitude; float[] result_arr; public CustomDetailsAdapter(Activity context,ArrayList&lt;Store_data&gt; store_list,double current_latitu…
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/24949057
answer count: 4
has title: Setting an extra adapter for a listview in android
has comment: http://stackoverflow.com/comment/38775126
has answer: http://stackoverflow.com/a/24949197
has comment: http://stackoverflow.com/comment/38775752
has comment: http://stackoverflow.com/comment/38774959
tagged with: java
has comment: http://stackoverflow.com/comment/38774992
type: Question
has comment: http://stackoverflow.com/comment/38775122
has answer: http://stackoverflow.com/a/24949342

http://stackoverflow.com/comment/38744062
type: Comment
has text: do you enter in your class MyBroadcastReceiver ? (put Logcat) You have to know if the problem is the alarm or the notification
comment on: http://stackoverflow.com/a/24926541
score: 0
type: AnswerComment

http://stackoverflow.com/q/24935478
tagged with: sql
has title: How do I update and then select the updated row
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24935765
type: Question
tagged with: java
tagged with: queue
has comment: http://stackoverflow.com/comment/38748828
has body: I have a table that has values ID and STATE. I want to update an individual item that has state 0 and set its state to 1 and then get its ID so that it can be processed. There would be several threads doing this, so I would need to have only one thread update the state and process the ID. Basically, I'm trying to avoid using a message queue. Is this possible to do just using SQL? I basically have a java app that will be inserting and fetching these items. I just want to implement a sort of queueing mechanism without using a queue server.
answer count: 1
has comment: http://stackoverflow.com/comment/38748916
score: 0

http://stackoverflow.com/q/25011779
tagged with: zk
has comment: http://stackoverflow.com/comment/38893133
type: AnsweredQuestion
score: 2
upvote count: 2
tagged with: java
type: Question
has body: I want to open url in new tab, from server side. I'm using this line: Executions.getCurrent().sendRedirect(url, "_blank"); This works perfect for Firefox but tries to open a new window in Chrome/IE. Is it possible to always open the url in new tab?
has answer: http://stackoverflow.com/a/25017252
answer count: 1
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/25017252
has comment: http://stackoverflow.com/comment/38892999
has title: Zkoss - open url in browser's new tab

http://stackoverflow.com/comment/38933545
has text: thanks everytin work out fine im grateful for your time.... the new problem i am having now is i want to be able to move around my jpanel during runtime. thanks once again
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/24968444
type: Comment

http://stackoverflow.com/comment/38741669
has text: groovy one-liner: `items.find{ it.id == id }`
comment on: http://stackoverflow.com/q/24931525
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/38813179
has text: With this I have again Wrong answer with the same paramethers
type: Comment
comment on: http://stackoverflow.com/a/24969682
score: 0
type: AnswerComment

http://stackoverflow.com/comment/51788633
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25048170
has text: When compiling this, I get 'Type mismatch: cannot convert from List<Object> to List<Pair>'. flatMap doesn't seem to be getting the correct type from the lambda. I fixed it with `List<Pair> list = as.stream().flatMap(a -> bs.stream().map (b -> new Pair(a,b)).collect(Collectors.toList()).stream()).collect(Collectors.toList());` but the fix seems kind of adhoc as it converts the stream into a collection then back to a stream again.
score: 0

http://stackoverflow.com/a/24979738
score: 2
downvote count: 0
upvote count: 2
has body: The static declaration is used when a field is associated with a class, rather than with any particular object. Now, let's consider your code: public static void main(String args[]) { color c = new color(); color.buttons(); } Of course, the main method has to be static in order to initially run your code. By extension, everything within your static main method must also be static or in other words must be able to run without being directly associated with any object. Therefore, you cannot call color.buttons() since the method is not a static method. You have two solutions: Make the method static. Of course, it might not actually make sense to make it static in this case but sometimes in other cases it might be appropriate. Call the method in the new, instantiated color object, c, as such: c.buttons(); OR call buttons() inside the constructor color(). For clarity, the second solution, in your code, would look like the following: public color() { prepareGUI(); buttons(); } OR public static void main(String args[]) { color c = new color(); c.buttons(); } Calling c.buttons() inside of the static main method is possible since the buttons() method is a method associated with the instantiated object, c. Finally, some best practices and tips: You should read the Java Naming Conventions and apply it to your code. For example, your class should be capitalized to be Color instead of color. Following naming conventions makes it easier for other people to read your code because naming conventions are a sort of contract that developers agree on. You should not call Java Swing methods outside of the Event Dispatch Thread (EDT) as most Swing methods are not thread-safe. Calling Swing methods outside the EDT may result in hard-to-find problems later on.
type: Answer
answers question: http://stackoverflow.com/q/24979566

http://stackoverflow.com/a/24929509
has comment: http://stackoverflow.com/comment/38737585
has comment: http://stackoverflow.com/comment/38737929
has body: Try to do it like that: int[] myNumbers = new int[tempList.length]; for(int i = 0; i &lt; tempList.length; i++){ try{ myNumbers[i] = Integer.parseInt(tempList[i]); }catch(Exception E){ myNumbers[i] = -1; } } Thats the method to avoid the try{}- Blocks :)
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/24929416
has comment: http://stackoverflow.com/comment/38737799
score: 2
answers question: http://stackoverflow.com/q/24929416
upvote count: 2

http://stackoverflow.com/q/24978179
has comment: http://stackoverflow.com/comment/38832715
upvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/38830171
tagged with: iteration
favorite count: 0
has answer: http://stackoverflow.com/a/24978873
downvote count: 3
has title: Return list of query in Java 1 dimensional e.g., 1 row is returned
has body: I am having a lot of trouble iterating through all my records. Perhaps, by reading my code someone could help. private String saveData(Handle handle, String username, String name, String prof, String table) { String sqlCommand; Map&lt;String, Object&gt; userResults; for (Integer tableNum = 1; tableNum &lt; 5; tableNum++) { //query all tables sqlCommand = String.format("SELECT varname FROM s" + tableNum.toString()); userResults = handle.createQuery(sqlCommand) .bind("username", username) .first(); //attempt to ierate all records for (Map.Entry&lt;String, Object&gt; entry : userResults.entrySet()) { Object obj = entry.getValue(); // doesnt have .get(string) as below } //get the desired field logger.debug("Results: " + userResults.toString()); String varname = (String) userResults.get("varname"); if ((varname.toLowerCase()).matches(name.toLowerCase())) return ""; } //save data return name; } How do I iterate through each record of the table?
type: UnansweredQuestion
type: Question
has comment: http://stackoverflow.com/comment/38831593
score: -2
tagged with: java
tagged with: mysql

http://stackoverflow.com/q/25024894
tagged with: sql
accepted answer: http://stackoverflow.com/a/25024968
tagged with: jdbc
answer count: 4
favorite count: 0
has title: SQL injection vulnerability thru preparedStatement
has answer: http://stackoverflow.com/a/25024960
has body: An Statement like this String query = "SELECT * FROM users WHERE userid ='"+ userid + "'" + " AND password='" + password + "'"; Statement stmt = connection.createStatement(); ResultSet rs = stmt.executeQuery(query); is eligible for SQL injection. But how does PreparedStatement helps in preventing SQL injection? Consider the following scenario: PreparedStatement stmt = connection.prepareStatement("SELECT * FROM users WHERE userid=? AND password=?"); stmt.setString(1, userid); stmt.setString(2, password); ResultSet rs = stmt.executeQuery(); what if someone enters the userId = "abc" and password = "1=1", as this will also be considered as valid String...
upvote count: 1
has answer: http://stackoverflow.com/a/25024940
has comment: http://stackoverflow.com/comment/38917772
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/25025960
score: 1
has answer: http://stackoverflow.com/a/25025960
tagged with: java
has answer: http://stackoverflow.com/a/25024968
type: Question
downvote count: 0
has comment: http://stackoverflow.com/comment/38917971

http://stackoverflow.com/q/24918673
has body: currently im working with Neo4j + Neo4j Spatial and i would like to ask you if there is a way to import shapefiles into the database in batches, the same way they do with OSM files, the reason for this is because im dealing with a huge dataset (100GB+) and the layer+index is definitly slowing me down when inserting hundreds of thousands of geometries, while using the standard ShapeFileImporter class My question is: Is there a way to import shapefiles in batches and after the insertion, we do the database.reIndex() the same way we do with .osm files?? Im using neo4j 2.1.2 and neo4j-spatial 0.13 ps.: I also tried setting my GraphDatabaseService with the following: .setConfig(GraphDatabaseSettings.node_auto_indexing, "false") .setConfig(GraphDatabaseSettings.relationship_auto_indexing,"false") but it seems that the ShapeFileImporter creates and uses them anyway.
type: Question
accepted answer: http://stackoverflow.com/a/24958614
has comment: http://stackoverflow.com/comment/38728399
upvote count: 1
answer count: 1
has answer: http://stackoverflow.com/a/24958614
tagged with: neo4j
tagged with: neo4j-spatial
favorite count: 0
type: AnsweredQuestion
has title: Batch insertion of shapefiles in Neo4J
downvote count: 0
score: 1
tagged with: java

http://stackoverflow.com/comment/38959432
type: Comment
comment on: http://stackoverflow.com/q/25047038
has text: `I need to make a pyramid` At first I read that as you had to make one of [these](http://en.wikipedia.org/wiki/Pyramid), and was surprised. Then I read `[t]he pyramid has to be made out of asterisks`, and thought ["ahh, a challenge!"](http://en.wikipedia.org/wiki/Asterisk_(PBX)). Constructing a pyramid using only copies of PBX software- I like the way your teacher thinks.
score: 0
type: QuestionComment

http://stackoverflow.com/comment/38701143
comment on: http://stackoverflow.com/q/24910276
has text: Why can't you just average each of the three components separately?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38804741
comment on: http://stackoverflow.com/a/24964284
type: Comment
has text: oh ok. Just from grepping through the energy2d applet source, it appears it will execute any script supplied with the 'script' parameter to the applet. It retrieves this parameter using http://docs.oracle.com/javase/7/docs/api/java/applet/Applet.html#getParameter%28java.lang.String%29
score: 0
type: AnswerComment

junit
type: Tag
tags question: http://stackoverflow.com/q/25041546
tags question: http://stackoverflow.com/q/24940704
tags question: http://stackoverflow.com/q/25063447
tags question: http://stackoverflow.com/q/24935888
tags question: http://stackoverflow.com/q/24915142
tags question: http://stackoverflow.com/q/24932763
tags question: http://stackoverflow.com/q/24948052
tags question: http://stackoverflow.com/q/24941575
tags question: http://stackoverflow.com/q/25042364
tags question: http://stackoverflow.com/q/25001020
tags question: http://stackoverflow.com/q/24971026
tags question: http://stackoverflow.com/q/24922153
tags question: http://stackoverflow.com/q/25031950
tags question: http://stackoverflow.com/q/24942020
tags question: http://stackoverflow.com/q/25018330
tags question: http://stackoverflow.com/q/24961747
tags question: http://stackoverflow.com/q/25064385
tags question: http://stackoverflow.com/q/25025892
tags question: http://stackoverflow.com/q/24925295
tags question: http://stackoverflow.com/q/24932384
tags question: http://stackoverflow.com/q/24938727
tags question: http://stackoverflow.com/q/24990996
tags question: http://stackoverflow.com/q/25050976
tags question: http://stackoverflow.com/q/24960051
tag name: junit
tags question: http://stackoverflow.com/q/24960408
tags question: http://stackoverflow.com/q/24993086
tags question: http://stackoverflow.com/q/25020918
tags question: http://stackoverflow.com/q/24954266
tags question: http://stackoverflow.com/q/24909523
tags question: http://stackoverflow.com/q/25016350
tags question: http://stackoverflow.com/q/24977896
tags question: http://stackoverflow.com/q/25024694
tags question: http://stackoverflow.com/q/25002834
tags question: http://stackoverflow.com/q/25018558
tags question: http://stackoverflow.com/q/25034005
tags question: http://stackoverflow.com/q/24926320
tags question: http://stackoverflow.com/q/24975366
tags question: http://stackoverflow.com/q/25053255
tags question: http://stackoverflow.com/q/24994815
tags question: http://stackoverflow.com/q/25046077
tags question: http://stackoverflow.com/q/25066950
tags question: http://stackoverflow.com/q/24943839
tags question: http://stackoverflow.com/q/25063674
tags question: http://stackoverflow.com/q/24946972
tags question: http://stackoverflow.com/q/25050975
tags question: http://stackoverflow.com/q/25062389
tags question: http://stackoverflow.com/q/24921046
tags question: http://stackoverflow.com/q/24972054
tags question: http://stackoverflow.com/q/24955999
tags question: http://stackoverflow.com/q/25069564

http://stackoverflow.com/q/25022182
upvote count: 2
type: UnansweredQuestion
tagged with: android
score: 2
answer count: 0
has comment: http://stackoverflow.com/comment/38913941
tagged with: java
tagged with: error-handling
type: Question
tagged with: android-layout
has comment: http://stackoverflow.com/comment/38912973
has title: Android ANR keyDispatchingTimedOut
downvote count: 0
tagged with: android-activity
has body: I'm struggeling with this error that I can't understand. Could anyone help me out here? 07-29 20:05:26.113: E/ActivityManager(339): ANR in com.coderogden.pongtennis (com.coderogden.pongtennis/.activities.StartLvlActivity) 07-29 20:05:26.113: E/ActivityManager(339): Reason: keyDispatchingTimedOut
favorite count: 0

http://stackoverflow.com/comment/38903274
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25016155
has text: @dimo414 Whilst I am a big fan of Joda (and Guava as mentioned by another poster), the question is more related to class/interface design as opposed to the underlying implementation of date calculations.
score: 0

http://stackoverflow.com/a/25042539
type: Answer
score: 0
has body: add this dependency it will work according to me: com.emc.cto XProcRESTFrameworkMVC 0.0.4-SNAPSHOT
answers question: http://stackoverflow.com/q/25041070

http://stackoverflow.com/comment/38709698
has text: Yep, it worked. Thank you very much. I've changed 'getter' and 'setter' methods names in order to match fields declaration names. However, can you recommend me any lecture, which will describe the problem of the mismatch between PropertyValueFactory and 'getter' and 'setters' names in much more specific manner?
comment on: http://stackoverflow.com/a/24914360
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/24963745
type: Question
has answer: http://stackoverflow.com/a/24964248
tagged with: android-launcher
tagged with: java
downvote count: 0
answer count: 1
favorite count: 0
tagged with: themes
type: UnansweredQuestion
tagged with: android
has title: How to add custom icon theme support to android launcher
score: 1
upvote count: 1
has body: I am working on an android launcher, I want to add icon theme support to the launcher. The launcher uses launcher-2 source code. How to add theme support for Icons?

http://stackoverflow.com/a/24967889
has comment: http://stackoverflow.com/comment/38810049
has comment: http://stackoverflow.com/comment/38809998
has comment: http://stackoverflow.com/comment/38810082
downvote count: 0
answers question: http://stackoverflow.com/q/24967783
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/38810672
score: 2
has body: My recommendation is to abstract the commands into a class with name and execute methods, then keep a Map&lt;String, Command&gt; that lets you look up the object by name. This promotes modularity (each class does one thing) and extensibility (just add more classes).

http://stackoverflow.com/comment/38802247
type: QuestionComment
score: 0
has text: Yep, definitely sounds like something is wrong. You should probably check that out and give us a detailed overview of what happens under what conditions.
comment on: http://stackoverflow.com/q/24963674
type: Comment

http://stackoverflow.com/comment/38901913
comment on: http://stackoverflow.com/q/25002819
type: QuestionComment
score: 0
has text: The "unable to get issuer certificate" error indicates a server certificate validation error. The "correct" way to fix this is to specify the trusted CA for the server cert using the "-CAfile" or "-CApath" tags for s_client, but you could also try adding "-verify 2" to your s_client command. This tells s_client to verify the server certificate chain to depth 2, but the part that is more interesting is that according to the -verify tag portion of the man page for s_client: "As a side effect the connection will never fail due to a server certificate verify failure."
type: Comment

http://stackoverflow.com/q/24981750
favorite count: 0
linked to: http://stackoverflow.com/q/7259906
has body: I need to provide a ThreadLocal to all the threads which end up running specific CompletableFuture.supplyAsync Suppliers. From the javadoc I see that CompletableFuture uses "ForkJoinPool commonPool()" which very much fits my performance use case. How do I transfer a ThreadLocal (and afterwards delete) to all pool threads running a specific CompletableFuture Supplier? Remark: I see that all CompletableFuture async completion methods accept an Executor. I would love to use the default ForkJoinPool commonPool() but if this is not possible I guess I have to override ThreadPoolExecutor and implement beforeExecute?
upvote count: 6
accepted answer: http://stackoverflow.com/a/24984491
has title: How-to provide a ThreadLocal to CompletableFutures?
has comment: http://stackoverflow.com/comment/90706473
score: 6
has comment: http://stackoverflow.com/comment/38840543
tagged with: java-8
has comment: http://stackoverflow.com/comment/38840982
type: AnsweredQuestion
tagged with: java
tagged with: java.util.concurrent
type: Question
has answer: http://stackoverflow.com/a/24984491
answer count: 1
downvote count: 0

http://stackoverflow.com/comment/38873635
comment on: http://stackoverflow.com/a/25001735
type: AnswerComment
score: 0
type: Comment
has text: Thanks!! i i just implemented you own answer it works too.tnanks again

http://stackoverflow.com/comment/38837569
has text: @Pete Changing `Map<String,String>` into `Map<String,Object>` does not solve the problem?
comment on: http://stackoverflow.com/q/24982487
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25025113
has answer: http://stackoverflow.com/a/25035879
has title: In Java / Android, why am I able to get an integer file descriptor from ParcelFileDescriptor?
possible better answer: http://stackoverflow.com/a/25035879
tagged with: java
has body: I have solved a problem I had while coding on the NDK, but I'm not sure the solution is canonical, or if there is a canonical way to do this. First a description of what I did: It appears that I cannot access an integer file descriptor value using Java's File or FileDescriptor objects: http://developer.android.com/reference/java/io/File.html http://developer.android.com/reference/java/io/FileDescriptor.html But I can using Android's ParcelFileDescriptor object: http://developer.android.com/reference/android/os/ParcelFileDescriptor.html So I can get the integer fd to my native code in this way: pfd = ParcelFileDescriptor.open(new File("blah"), MODE_WRITE_ONLY); myNativeFunction(pfd.getFd()); Why does this work? Wouldn't the file descriptor integer field be private in the File object, since I can't access it even when I own the object? So how does the ParcelFileDescriptor get to access this presumably private field just by being passed the object in one of its public methods? Do I even want to know?
tagged with: android-ndk
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25047756
type: Question
tagged with: android
accepted answer: http://stackoverflow.com/a/25047756
score: 0
answer count: 2

http://stackoverflow.com/q/25058288
has answer: http://stackoverflow.com/a/25058361
has answer: http://stackoverflow.com/a/25058368
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/38979932
has comment: http://stackoverflow.com/comment/38980012
has comment: http://stackoverflow.com/comment/38980015
answer count: 4
type: AnsweredQuestion
score: 2
has comment: http://stackoverflow.com/comment/38979929
has answer: http://stackoverflow.com/a/25058474
possible better answer: http://stackoverflow.com/a/25058361
tagged with: java
has comment: http://stackoverflow.com/comment/38979943
accepted answer: http://stackoverflow.com/a/25058336
type: Question
has body: I have a text file with about 3 million lines and I need to replace the first two characters of every line with "". My current code is String[] lines = content.split("\n"); content = ""; for(int i = 0;i&lt;lines.length;i++){ System.out.println(i); lines[i].substring(2); content = content + lines[i]; } It takes it about 3-4 days to finish. Is there a faster way of doing this? My entire code: try { String content = readFile("text.txt", StandardCharsets.ISO_8859_1); content = content.replaceAll("\\d",""); content = content.replaceAll("\\.",""); String[] lines = content.split("\n"); content = ""; for(int i = 0;i&lt;lines.length;i++){ System.out.println(i); lines[i].substring(2); content = content + lines[i]; } PrintWriter out = new PrintWriter("texty text.txt"); out.println(content); } catch (IOException e) { e.printStackTrace(); }
has comment: http://stackoverflow.com/comment/38979918
has answer: http://stackoverflow.com/a/25058336
tagged with: substring
upvote count: 2
has title: Best way to replace two first characters of String from every line JAVA

http://stackoverflow.com/a/24952132
score: 1
has comment: http://stackoverflow.com/comment/38780587
answers question: http://stackoverflow.com/q/24952049
downvote count: 0
has body: Why don't you add a single line like this in your catch block ..which will show you the error message irrespective of How you run your app. javax.swing.JOptionPane.showMessageDialog(null,"Something is really wrong..Hence notifying you..");
type: Answer
has comment: http://stackoverflow.com/comment/38780752
upvote count: 1

http://stackoverflow.com/comment/38777782
comment on: http://stackoverflow.com/q/24950391
score: 0
has text: Also try doing the Maven build from the command line.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38977108
score: 0
comment on: http://stackoverflow.com/q/25055338
type: Comment
type: QuestionComment
has text: And that's the only exception? There is nothing further up the stack trace?

http://stackoverflow.com/comment/38947520
type: Comment
comment on: http://stackoverflow.com/a/25026489
score: 0
type: AnswerComment
has text: I have added a snippet to achieve the same.

http://stackoverflow.com/a/25063042
answers question: http://stackoverflow.com/q/25062727
has body: What about something like this? input = ""; try { input = new String(Files.readAllBytes(Paths.get(INPUT_PATH))); } catch (IOException ex) { System.out.println("File: " + INPUT_PATH + " not found!"); } This will make input be a string containing all the text in your file. Then just extract the components of it that you want. You can separate your string into an array of strings by using the new line character as a separator so that each string component will be a single line in your file. Something like String[] lines = input.split("\r?\n"); Then if you want the fourth through the tenth lines, just return lines[3] through lines[9]. I'm not sure what you mean by referencing character 3 in your examples. From what I can tell, you want to get back the entire line. I don't see where, when saying line 4 character 3, the character 3 comes into play at all.
downvote count: 0
upvote count: 2
type: Answer
score: 2

http://stackoverflow.com/comment/38963444
type: QuestionComment
type: Comment
has text: Generally (a part from poor resource management), the code works. You will need to verify the input and ensure that the file does actually exists. You can use `File#exists` to determine if the file does actually exist before you read it, but you need to do more debugging of the files are you trying to use...
score: 0
comment on: http://stackoverflow.com/q/25049171

http://stackoverflow.com/comment/38726886
comment on: http://stackoverflow.com/q/24923561
score: 0
has text: I will check. But how can I check?
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24914841
downvote count: 0
type: Answer
has body: Error looks like it's in this line: radiusToSelect[p*(p-1)/2+q]=distanceBetweenParticles[p][q]; radiusToSelect has a length of (score[1].length-1)*(score[1].length)/2 which is 6 (3*4/2). p can be as large as 39, and q as large as 38, so it will easily exceed the size of the array.
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/24914581

http://stackoverflow.com/comment/38808361
type: Comment
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/24966990
has text: and also you might meant there `equals()`

ubuntu-12.04
tags question: http://stackoverflow.com/q/24932341
type: Tag
tag name: ubuntu-12.04

http://stackoverflow.com/comment/38883847
comment on: http://stackoverflow.com/q/25002472
type: Comment
has text: Do you have clear network access to the jcenter.bintray.com DNS? It seems that you're not reaching it. Could you include your build.gradle DSL? Is there any particular reason or constraint for that special configuration? Why not to use the main Google repositories for Android Gradle plugin?
type: QuestionComment
score: 0

http://stackoverflow.com/a/25036654
has comment: http://stackoverflow.com/comment/38939289
has body: You're not using the proper LayoutParams for the views that you programmatically add to the TableLayout. The created TableRows will be added to the TableLayout so their LayoutParams should be of type TableLayout.LayoutParams: row.setLayoutParams(new TableLayout.LayoutParams(TableLayout.LayoutParams.MATCH_PARENT, TableLayout.LayoutParams.WRAP_CONTENT)); The same goes for the row TextViews, which should use TableRow.LayoutParams: tv.setLayoutParams(new TableRow.LayoutParams(TableRow.LayoutParams.WRAP_CONTENT, TableRow.LayoutParams.WRAP_CONTENT));
has comment: http://stackoverflow.com/comment/38939555
has comment: http://stackoverflow.com/comment/38939143
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/38942592
has comment: http://stackoverflow.com/comment/38938971
has comment: http://stackoverflow.com/comment/38945228
has comment: http://stackoverflow.com/comment/38943574
type: Answer
has comment: http://stackoverflow.com/comment/38944591
answers question: http://stackoverflow.com/q/25031889
has comment: http://stackoverflow.com/comment/38944129
has comment: http://stackoverflow.com/comment/38943289
has comment: http://stackoverflow.com/comment/38940463
has comment: http://stackoverflow.com/comment/38943002
accepted answer of: http://stackoverflow.com/q/25031889
score: 5
upvote count: 5

http://stackoverflow.com/a/25036200
has comment: http://stackoverflow.com/comment/38939263
has comment: http://stackoverflow.com/comment/38938452
has comment: http://stackoverflow.com/comment/38939112
score: 0
answers question: http://stackoverflow.com/q/25036045
has comment: http://stackoverflow.com/comment/38939172
has comment: http://stackoverflow.com/comment/38938718
has comment: http://stackoverflow.com/comment/38938602
has comment: http://stackoverflow.com/comment/38939220
has body: It will never end because in the top level loop, the condition to get out is that the character's health drops below 0. However, you are never decreasing his HP. You are only decreasing the vampire's HP, but not the character. If you want the game to end, make the vampire attack the character too. That way, in some point his HP will drop below 0 and the game will end. However, to make it more realistic, you should make the game end when the HP of the vampire OR the character are 0, and not when both of them are below 0. To achieve that, instead of using 3 loops, use 2, but changing the condition so that when either one of them has no HP, it will end: do { do { ... } while (turn == 1); } while (charHp &gt; 0 &amp;&amp; enemyHp &gt; 0);
type: Answer

http://stackoverflow.com/comment/38920247
comment on: http://stackoverflow.com/q/25026313
score: 4
has text: maybe Servlets are not the best place to start learning Java programming, I suggest you trying simpler stuff
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38834718
comment on: http://stackoverflow.com/q/24978636
has text: @JoshuaTaylor is it possible to write xml:DateTime in local time on owl file?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24983618
tagged with: java
has answer: http://stackoverflow.com/a/24983703
type: Question
answer count: 2
tagged with: arrays
score: 0
has answer: http://stackoverflow.com/a/24983654
has body: I've got a pixel array, containing multiple colors. int w = 32; int h = 32; int[] pixels = new int[w*h]; As You can see, the image in this example has the dimensions 32x32. All pixels are stored in the one dimensional array. Now for example I would like to have the pixel from the coordinates (5/0), that means the fifth element in the first row of the image. Now the problem is that I've got an one dimensional pixel array. Otherwise I just could've called int target = pixels[5][0]; How can I achieve getting this specific pixel from the one dimensional array?
type: UnansweredQuestion
has title: Get specific pixel from 1D pixel array
tagged with: pixel

http://stackoverflow.com/comment/39145704
type: AnswerComment
comment on: http://stackoverflow.com/a/25113632
type: Comment
has text: Then just decrease its size.
score: 0

methods
tags question: http://stackoverflow.com/q/25048025
tags question: http://stackoverflow.com/q/24986875
tags question: http://stackoverflow.com/q/25029272
tags question: http://stackoverflow.com/q/24957006
tags question: http://stackoverflow.com/q/25029681
tags question: http://stackoverflow.com/q/24910541
tags question: http://stackoverflow.com/q/25059688
tag name: methods
tags question: http://stackoverflow.com/q/25045561
type: Tag
tags question: http://stackoverflow.com/q/24971453
tags question: http://stackoverflow.com/q/25032659
tags question: http://stackoverflow.com/q/25008310
tags question: http://stackoverflow.com/q/25027184
tags question: http://stackoverflow.com/q/25012197
tags question: http://stackoverflow.com/q/25045250
tags question: http://stackoverflow.com/q/24922854
tags question: http://stackoverflow.com/q/25048769
tags question: http://stackoverflow.com/q/24935753
tags question: http://stackoverflow.com/q/25036505
tags question: http://stackoverflow.com/q/25029966
tags question: http://stackoverflow.com/q/25060962
tags question: http://stackoverflow.com/q/25009930

http://stackoverflow.com/q/24913510
tagged with: rest
type: UnansweredQuestion
has title: What's the best way to get credentials in a JAX-RS Application?
tagged with: java
type: Question
tagged with: jakarta-ee
tagged with: restlet
tagged with: security
score: 0
answer count: 1
has body: I'm working on a small piece of middleware based on RESTlet that's providing a REST API to several back-end systems. There for, my JAX-RS Application requires credentials for some of its methods to authenticate calls to back-end systems using (clear text) user name and password. So far, I found a lot of documentation on Authorization/Authentication, but all of it only goes as far as validating access to methods and providing user groups. None of it seems to give me the possibility to pass the users' credentials to the actual methods. Is there a nice way to inject them without being REST framework dependent?
has answer: http://stackoverflow.com/a/24914259
has comment: http://stackoverflow.com/comment/38708340

http://stackoverflow.com/q/24946748
has comment: http://stackoverflow.com/comment/38770958
has comment: http://stackoverflow.com/comment/38770791
possible better answer: http://stackoverflow.com/a/24946813
has comment: http://stackoverflow.com/comment/38770589
has comment: http://stackoverflow.com/comment/38770768
has comment: http://stackoverflow.com/comment/38770602
has answer: http://stackoverflow.com/a/24946813
upvote count: 1
has comment: http://stackoverflow.com/comment/38770864
type: AnsweredQuestion
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/38770587
has title: String can not recognize with whitespaces or as empty
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/38770927
has comment: http://stackoverflow.com/comment/38770580
has answer: http://stackoverflow.com/a/24949691
downvote count: 0
has body: Before I begin to discuss my issue, I REALLY (and I do mean REALLY) researched for hours on my solution but I couldn't find it or understand it clearly; after my second career question was down-voted, a lot, I was skeptical of posting my current code of a free lance project for a portfolio. If I look like a beginner, that's because I am; I'm also embarrassed of my current progress. But enough: I'm creating a project of a potential distributing company and I want to add restriction to the strings. How do I prevent the code to continue before finding the spaces/empty string? public class AddOrder { static Scanner input = new Scanner (System.in); //Blocking special character input private static CharSequence s1 = "!"; private static CharSequence s2 = "@"; private static CharSequence s3 = "#"; private static CharSequence s4 = "$"; private static CharSequence s5 = "%"; private static CharSequence s6 = "^"; private static CharSequence s7 = "&amp;"; private static CharSequence s8 = "*"; private static CharSequence s9 = "("; private static CharSequence s10 = ")"; private static CharSequence s11 = "_"; private static CharSequence s12 = "="; private static CharSequence s13 = "+"; private static CharSequence s14 = "["; private static CharSequence s15 = "]"; private static CharSequence s16 = "{"; private static CharSequence s17 = "}"; private static CharSequence s18 = ";"; private static CharSequence s19 = ":"; private static CharSequence s20 = "'"; private static CharSequence s21 = "?"; private static CharSequence s22 = "&lt;"; private static CharSequence s23 = "&gt;"; private static CharSequence s24 = "/"; private static CharSequence s25 = "`"; private static CharSequence s26 = "~"; private static CharSequence s27 = " "; private static CharSequence s28 = "."; //Blocking special character input public static void informationPrompt(){ System.out.println("Please insert following information:"); System.out.println("Last Name, First Name, Middle Initial"); System.out.println("Stre…
favorite count: 0
has comment: http://stackoverflow.com/comment/38770622
has comment: http://stackoverflow.com/comment/38771015
has comment: http://stackoverflow.com/comment/38770670
accepted answer: http://stackoverflow.com/a/24949691

http://stackoverflow.com/q/25030412
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38929402
tagged with: annotations
has comment: http://stackoverflow.com/comment/38929549
has comment: http://stackoverflow.com/comment/38929488
has comment: http://stackoverflow.com/comment/38929997
has comment: http://stackoverflow.com/comment/38927846
answer count: 0
has comment: http://stackoverflow.com/comment/38929799
has title: How to update values in annotation during runtime dynamically?
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/38929702
has body: The following is a sample code: @interface MyAnnotation { String stringValue1(); String stringValue2(); } public class Ann{ private String requireString = "str"; @MyAnnotation(stringValue1 = "abc" , stringValue2 = "") public String getstringValue1() { return (this.requireString); } } Here , I want to update the value of stringValue2 element of MyAnnotation atached to getStringValue() method by the value returned by "this.requireString". Can you tell me how can this be done?
score: 0
has comment: http://stackoverflow.com/comment/38929944

http://stackoverflow.com/a/25002926
type: Answer
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/38875876
upvote count: 2
has body: problem: return userinput.nextInt(); By the time you input a sequence of string it will not consume your new line character, and when you go again inside your method and call userinput.nextInt() it will consume that new line and skip it thus not letting you get input again. solution: add nextLine(); before you call the checkAge method again to consume the new line from the string sample: System.out.println("Age should be an integer"); userinput.nextLine(); age = checkAge();
answers question: http://stackoverflow.com/q/25002802

http://stackoverflow.com/comment/38769498
has text: @Katie: yes, that was my point. It happens automatically, no need to do anything at all. Hence "automatically" in my comment above.
score: 0
comment on: http://stackoverflow.com/q/24945356
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24935593
upvote count: 2
has comment: http://stackoverflow.com/comment/38749904
has comment: http://stackoverflow.com/comment/38749540
type: Answer
has body: What you need is a computer on the internet that can run a process (your Java server application), that your Java client applications can connect to. So you would upload the file(s) (maybe it's a jar, or some class files), and tell the server through whatever interface you have to run the process. This server application can then hold everyone's scores and save them to disk and whatever else you need. I have also read many times in my research that alot of webhosts dont allow the uploading of java files with open ports. Is this correct? This is correct. You'll need to rent a server (if you don't have one yourself that you can put on your own internet connection), a simple web hosting companies will not allow you to host your own running process. Instead I have decided to make my game code so damn unreadable and messy that it may just be easier to cheat/crack someone elses program. (wishful thinking). I'm not sure if this a joke but there's source code obfuscators out there like ProGuard which do exactly this. If you really want to protect against people simply writing scores out to the server with their own modified client then you'll have to have some of the logic of the game be handled by the server process itself. Of course someone could still go further and create a bot or whatever else they need to cheat and get their bogus score listed.
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/38749688
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24935243
answers question: http://stackoverflow.com/q/24935243

http://stackoverflow.com/comment/38835945
type: AnswerComment
comment on: http://stackoverflow.com/a/24977528
score: 0
type: Comment
has text: Ok but you would have to tell that in your question first. Without seeing your complete code (better a [MCVE](http://stackoverflow.com/help/mcve)) we can only guess. 1) Why BoxLayout in your JFrame? I'd use the default BoderLayout. 2) Why BoxLayout in a JPanel? If you have a more powerful layout manager such as MigLayout, why bothering to work with a very limited one, such as BoxLayout? @BenBeri

http://stackoverflow.com/a/24998389
has body: Here's a quick "by-hand" parser for you. public static List&lt;CustomClass&gt; parseString(String str) { String [] elements = str.split("\\["); List &lt;CustomClass&gt; result = new ArrayList&lt;CustomClass&gt;(); for (String elem : elements) { if (elem.contains("]")) { String seq = elem.substring(0, elem.indexOf(']')); String [] tokens = seq.split(","); result.add(new CustomClass(tokens[0].substring(1,tokens[0].length()-1), Integer.parseInt(tokens[1]), Integer.parseInt(tokens[2]), Integer.parseInt(tokens[3]))); } } return result; } Beware that I relied on guaranteed correct input. You might want to tweak this one for what you need.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/24998055

ksoap2
type: Tag
tags question: http://stackoverflow.com/q/25017968
tags question: http://stackoverflow.com/q/24990801
tag name: ksoap2

http://stackoverflow.com/comment/38806380
type: Comment
type: QuestionComment
has text: You don't seem to understand locations detection works. Location finding features like GPS work by figuring out where they are from satellites. They do not broadcast their location. There's no way to use it to find out other devices. You can use it to find your own location and then send that out to a server, or you can use peer to peer like wifi direct to send it to another device nearby. But you can't use GPS to find a different piece of hardware.
comment on: http://stackoverflow.com/q/24965901
score: 0

clip
tags question: http://stackoverflow.com/q/24938461
type: Tag
tag name: clip

http://stackoverflow.com/q/25053014
score: 0
has answer: http://stackoverflow.com/a/25053079
answer count: 1
has body: I'm trying to understand how multi-touch events work, but my code is not acting as I anticipated. Multiple touches are only recognized if I rapidly subsequently place three or more fingers on the screen: @Override public boolean onTouchEvent(MotionEvent event) { int x = (int) event.getX(); int y = (int) event.getY(); switch(event.getAction()){ case MotionEvent.ACTION_DOWN: doSomeUnimportantStuff(); return true; case MotionEvent.ACTION_POINTER_DOWN: for (int i = 0;i &lt; event.getPointerCount()-1;i++) { Log.d("Multi-Touch", Float.toString(event.getX(i))); return true; } } return true; } Why isn't the second finger I place on the screen recognized, and why does the speed at which I place my fingers on the screen affect whether the multiple touches are recognized?
has title: Trouble with multi-touch events
tagged with: java
tagged with: touch
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25053079
tagged with: event-handling
tagged with: multi-touch
type: Question
tagged with: android

getmethod
tag name: getmethod
type: Tag
tags question: http://stackoverflow.com/q/25025892

http://stackoverflow.com/q/24964545
has answer: http://stackoverflow.com/a/24966389
tagged with: jenkins
type: UnansweredQuestion
has body: I've installed Jenkins on an old Mac Mini (2006), and when I launch it via: sudo launchctl load /Library/LaunchDaemons/org.jenkins-ci.plist It starts up and runs, but after some time it stops working (meaning that the browser will just give me a blank white screen) But when I try to run it via this command (from /Applications/Jenkins): java -jar jenkins.war Then I get this error in terminal: webroot: $user.home/.jenkins Jul 25, 2014 2:23:44 PM winstone.Logger logInternal INFO: Beginning extraction from war file Jul 25, 2014 2:23:48 PM org.eclipse.jetty.util.log.JavaUtilLog info INFO: jetty-8.y.z-SNAPSHOT Jul 25, 2014 2:23:52 PM org.eclipse.jetty.util.log.JavaUtilLog info INFO: NO JSP Support for , did not find org.apache.jasper.servlet.JspServlet Jenkins home directory: /Users/echoqa/.jenkins found at: $user.home/.jenkins Jul 25, 2014 2:23:53 PM org.eclipse.jetty.util.log.JavaUtilLog warn WARNING: FAILED SelectChannelConnector@0.0.0.0:8080: java.net.BindException: Address already in use java.net.BindException: Address already in use at sun.nio.ch.Net.bind(Native Method) at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:124) at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:59) at org.eclipse.jetty.server.nio.SelectChannelConnector.open(SelectChannelConnector.java:187) at org.eclipse.jetty.server.AbstractConnector.doStart(AbstractConnector.java:316) at org.eclipse.jetty.server.nio.SelectChannelConnector.doStart(SelectChannelConnector.java:265) at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64) at org.eclipse.jetty.server.Server.doStart(Server.java:293) at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64) at winstone.Launcher.&lt;init&gt;(Launcher.java:154) at winstone.Launcher.main(Launcher.java:354) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.Delega…
tagged with: java
has comment: http://stackoverflow.com/comment/38848074
type: Question
has comment: http://stackoverflow.com/comment/38804852
score: 0
has title: Jenkins on Mac OS X is slow and crashes
answer count: 1
tagged with: macos

http://stackoverflow.com/a/25061788
score: 0
has comment: http://stackoverflow.com/comment/38987697
type: Answer
has body: First read this article. Then you should know that usually asymmetric algorithms using for exchanging passwords and electronic signs. So the best way in client-server encryption is to generate common encryption key (with RSA or Diffie–Hellman key exchange), and then use any of symmetric algo (AES for example) to encode data between server and client.
has comment: http://stackoverflow.com/comment/38987152
answers question: http://stackoverflow.com/q/25061297

http://stackoverflow.com/q/24930216
has comment: http://stackoverflow.com/comment/38739338
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
tagged with: apache-camel
has answer: http://stackoverflow.com/a/24932575
type: Question
accepted answer: http://stackoverflow.com/a/24932575
upvote count: 1
has body: How to use multicast to upload one file twice to the same sftp location but two different folders using a single login? Say i have locationA as my pick-up location, b &amp; c are my file destination locations in the sftp. I have something like: from(locationA) .multicast() .to(locationb, locationc) I guess this will need loging-in twice but i need to do that once. Please help.
has title: Using apache-camel multicast to upload one file to diffeerent locations
has comment: http://stackoverflow.com/comment/38741991
answer count: 1
favorite count: 0

xuggler
tags question: http://stackoverflow.com/q/24993855
tag name: xuggler
type: Tag
tags question: http://stackoverflow.com/q/25009276

http://stackoverflow.com/comment/38989586
comment on: http://stackoverflow.com/q/25051294
score: 0
has text: You need to update your Oracle driver to the latest version. I have found a similar post : http://stackoverflow.com/questions/3163636/resource-datasource-rolled-back-in-cleanup-of-localtransactioncontainment
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25047895
tagged with: eclipse
has answer: http://stackoverflow.com/a/25047955
answer count: 2
upvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/38961004
tagged with: android
has body: I have two questions concerning my code: My ArrayList is now generating random numbers between 0 and 5. How can I make this between 1 and 5? If one of the button is clicked, and if its number is for example 4 (which isn't always the case, obviously), I want something to happen; however, I have no idea how to write this in code. Thus, how would you go about doing that? EDIT More specific question 2, so I can try out some things How to get the current number that is generated on the button? My implementation is; package com.example.buttontester; import java.util.ArrayList; import java.util.Collections; import java.util.List; import android.app.Activity; import android.os.Bundle; import android.widget.Button; public class GameOneActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.gameone_layout); List&lt;Integer&gt; numbers = new ArrayList&lt;&gt;(); for(int i = 0; i &lt; 5; i++){ numbers.add(i); } Collections.shuffle(numbers); for(int i = 0; i &lt; 5; i++) { System.out.println(numbers.get(i)); } Button btn1 = (Button) findViewById(R.id.button1); btn1.setText(String.valueOf(numbers.get(0))); Button btn2 = (Button) findViewById(R.id.button2); btn2.setText(String.valueOf(numbers.get(1))); Button btn3 = (Button) findViewById(R.id.button3); btn3.setText(String.valueOf(numbers.get(2))); Button btn4 = (Button) findViewById(R.id.button4); btn4.setText(String.valueOf(numbers.get(3))); Button btn5 = (Button) findViewById(R.id.button5); btn5.setText(String.valueOf(numbers.get(4))); } @Override public void onPause() { super.onPause(); } @Override public void onResume() { super.onResume(); } }
has answer: http://stackoverflow.com/a/25047982
has comment: http://stackoverflow.com/comment/38960947
has title: If statement with random number generated in arraylist
type: AnsweredQuestion
tagged with: java
downvote count: 2
type: Question
accepted answer: http://stackoverflow.com/a/25047955
score: -2
possible better answer: http://stackoverflow.com/a/25047982

http://stackoverflow.com/comment/38798797
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24961747
has text: @gtgaxiola ahh thank you, I must have overlooked that because they sound extremely similar.
score: 0

http://stackoverflow.com/comment/38925255
has text: Oh sorry about that.How would serializing the values of certain primitives(ints, doubles) work then?
type: Comment
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25022555

http://stackoverflow.com/a/79303392
type: Answer
answers question: http://stackoverflow.com/q/24919663
has body: Be careful in a unit test context, using the isLoaded method to check whether an EntityGraph has loaded another Entity or not. It will return "true" if the Entity is null. I was facing this issue and only found this question talking about this method, so it can help someone else later. By the way, MorganP highlighted our main usage of this method, when testing if our EntityGraphes are well written in the @NamedEntityGraph annotations
score: 0

http://stackoverflow.com/q/25063653
has comment: http://stackoverflow.com/comment/38990764
favorite count: 0
linked to: http://stackoverflow.com/q/1323408
tagged with: jakarta-mail
has comment: http://stackoverflow.com/comment/38990481
has title: Wait for mail sending in another thread to complete
has comment: http://stackoverflow.com/comment/38993493
has comment: http://stackoverflow.com/comment/38990191
accepted answer: http://stackoverflow.com/a/25069430
tagged with: multithreading
has comment: http://stackoverflow.com/comment/38990330
has answer: http://stackoverflow.com/a/25065829
score: 4
type: AnsweredQuestion
has body: I've got a problem I can't really figure out. I have my main thread, and in it I want to Send an email with an attachment Delete the files that were attached in that order. My problem is that I am using an email helper that I don't have control over, and it generates another thread that does the sending. Because of this, my files are being deleted before they are done being attached, and I am getting a FNF error in the mailer. I am looking to find a way to make my main thread wait until the files are done being attached. I don't know how long that will take. I don't have control over the other thread creation, so I can't use join(). Is there something I can use with Transport maybe, or a way to wait for all threads made in a method/class to stop? The layout of my program is //do stuff MailHelper.sendMail(...); //thread is created somewhere in this method deleteFiles(); //this happens before sendMail is finished! I need to use Java 6. Worst-case I can have my main thread sleep for a few seconds, but that's unideal. Any help is appreciated
has comment: http://stackoverflow.com/comment/38990317
tagged with: java
has comment: http://stackoverflow.com/comment/38990359
has comment: http://stackoverflow.com/comment/38990223
possible better answer: http://stackoverflow.com/a/25065829
has comment: http://stackoverflow.com/comment/38990545
type: Question
upvote count: 4
has comment: http://stackoverflow.com/comment/38992234
answer count: 2
has comment: http://stackoverflow.com/comment/38992975
has comment: http://stackoverflow.com/comment/38990158
has comment: http://stackoverflow.com/comment/38992884
downvote count: 0
has answer: http://stackoverflow.com/a/25069430

http://stackoverflow.com/a/25008620
type: Answer
score: 0
has comment: http://stackoverflow.com/comment/38886712
has comment: http://stackoverflow.com/comment/38886708
has comment: http://stackoverflow.com/comment/38886650
has body: Serialization is used for short-term persistence in Java. It's ok to persist a few objects using serialization, however for a large number of objects and primitives, using a database is preferred because it ensures its ACID compliant. Where as if you choose to serialize- once your code base grows, class changes make your serialized data unreadable, and having non-java based code use that information via I/O is impossible.
answers question: http://stackoverflow.com/q/25008518
has comment: http://stackoverflow.com/comment/38886525

http://stackoverflow.com/q/24943241
tagged with: event-dispatch-thread
type: Question
tagged with: sockets
tagged with: swing
has body: I am newbie to java. I tried to make chat app but some error occur when i run even single client .Why the Text Area and Text Field does not show. What i get is this occurs due to accept function .When compiler reaches to accept function the app become busy. i.e the screen of app show nothing. Code Of Client One: import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.swing.event.*; import java.io.*; import java.net.*; public class ChatAppOne{ JFrame jframe; JTextArea jtextarea; JTextField jtextfield; JButton jbutton; ServerSocket server; Socket sSocket,cSocket; InputStream inStream; ObjectInputStream objInStream; OutputStream outStream; ObjectOutputStream objOutStream; ChatAppOne(){ jframe=new JFrame(); jframe.setLayout(new FlowLayout(FlowLayout.LEFT)); jtextarea=new JTextArea("",28,49); jtextarea.setEditable(false); jframe.add(new JScrollPane(jtextarea)); jtextfield=new JTextField(); jtextfield.setPreferredSize(new Dimension(440,30)); jframe.add(jtextfield); jbutton=new JButton("Send"); jbutton.setPreferredSize(new Dimension(100,35)); jframe.add(jbutton); jbutton.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent ae){ try{ cSocket=new Socket("localhost",1340); outStream=cSocket.getOutputStream(); objOutStream=new ObjectOutputStream(outStream); objOutStream.writeObject(jtextfield.getText()); jtextarea.setText(jtextarea.getText() +" \n " +"Me: " +jtextfield.getText()); jtextfield.setText(""); cSocket.close(); outStream.close(); objOutStream.close(); }catch(Exception e){ JOptionPane.showMessageDialog(null, e, "Error", JOptionPane.PLAIN_MESSAGE); } } }); jframe.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); jframe.setSize(600,600); jframe.setTitle("Chat Application"); jframe.setVisible(true); startServer(); } void startServer(){ try{ server=new ServerSocket(1550); }catch(Exception e){ JOptionPane.showMessageDialog(null, e, "Error", JOptionPane.PLAIN_MESSAGE); } while(true){ try{ sSocket=server.accept(); inStream=sSoc…
tagged with: java
answer count: 1
downvote count: 1
has title: Error In Chat App
tagged with: network-programming
type: UnansweredQuestion
upvote count: 0
has answer: http://stackoverflow.com/a/24943399
favorite count: 0
score: -1

http://stackoverflow.com/comment/38848003
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24987832
score: 1
has text: Oh thanks @AndrewThompson, there are some people I see in here on SO like you, MadProgrammer, Kleopatra, thrashgod and a couple of more people that I would love to become as good as you, I always see answers from all of you and make me show more effort on each Q & A I write.

http://stackoverflow.com/q/24917583
tagged with: spring-mvc
tagged with: java
has answer: http://stackoverflow.com/a/24922154
has body: I'm building a REST Application using Spring Security OAuth. Until now I can make a requets to get an access token curl http://localhost:8080/oauth/token -d "username=user&amp;password=pass&amp;client_id=client&amp;client_secret=secret&amp;grant_type=password" And getting a successful response {"access_token":"b9590e0c-dc2c-4578-9246-ab46ab626b2c","token_type":"bearer","refresh_token":"56b73a2c-9993-4bbe-90db-58d207aeb3f1","expires_in":3599,"scope":"read"} But when use the access token to request a secured resource I'm getting redirected to login page bacause of Spring Security Configuration. @EnableWebSecurity @Configuration public class SecurityConfig extends WebSecurityConfigurerAdapter { @Override @Bean public AuthenticationManager authenticationManagerBean() throws Exception { return super.authenticationManagerBean(); } @Override protected void configure(AuthenticationManagerBuilder auth) throws Exception { auth.inMemoryAuthentication().withUser("user").password("pass").roles("USER"); } @Override protected void configure(HttpSecurity http) throws Exception { super.configure(http); } } Spring Security OAuth2 Configuration @Configuration public class OAuth2ServerConfig { protected static final String RESOURCE_ID = "oauthdemo"; @Configuration @EnableResourceServer protected static class ResourceServer extends ResourceServerConfigurerAdapter { @Override public void configure(HttpSecurity http) throws Exception { http .requestMatchers().antMatchers("/resources/**").and() .authorizeRequests() .anyRequest().access("#oauth2.hasScope('read')"); } @Override public void configure(ResourceServerSecurityConfigurer resources) throws Exception { resources.resourceId(RESOURCE_ID); } } @Configuration @EnableAuthorizationServer protected static class OAuth2Config extends AuthorizationServerConfigurerAdapter { @Autowired @Qualifier("authenticationManagerBean") private AuthenticationManager authenticationManager; @Override public void configure(AuthorizationServerSecurityConfigure…
upvote count: 4
type: AnsweredQuestion
answer count: 1
downvote count: 0
tagged with: spring-security
favorite count: 0
type: Question
accepted answer: http://stackoverflow.com/a/24922154
has title: How to configure Spring Security to use OAuth instead of Basic Authorization?
score: 4
tagged with: oauth
tagged with: spring

http://stackoverflow.com/comment/38720982
has text: It's impossible using this library. It bases on creating a proxy around your instance object - thus an instance must exist.
score: 0
comment on: http://stackoverflow.com/q/24919704
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38810971
comment on: http://stackoverflow.com/q/24968438
type: QuestionComment
type: Comment
has text: referenced using an english name?? what do you mean?
score: 0

http://stackoverflow.com/comment/38856171
type: QuestionComment
has text: You should show the code that is reading the data.
score: 1
comment on: http://stackoverflow.com/q/24992501
type: Comment

http://stackoverflow.com/q/24977781
tagged with: javascript
score: 4
possible better answer: http://stackoverflow.com/a/48375486
has answer: http://stackoverflow.com/a/56488401
downvote count: 0
linked to: http://stackoverflow.com/q/25602117
has answer: http://stackoverflow.com/a/39320709
favorite count: 0
has title: fill form programmatically in Android Webview - JavaScript
has answer: http://stackoverflow.com/a/24977839
accepted answer: http://stackoverflow.com/a/24977839
tagged with: android
upvote count: 4
answer count: 4
has answer: http://stackoverflow.com/a/48375486
type: AnsweredQuestion
tagged with: java
tagged with: webview
type: Question
has body: I'm trying to automatically fill a form from the website of my school. I've seen some ways to do with javascrip. Here is my code: @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.navegador_siiau_layout); navegador_siiau = (WebView) findViewById(R.id.wv_navegador_siiau); navegador_siiau.getSettings().setJavaScriptEnabled(true); navegador_siiau.loadUrl("http://siiauescolar.siiau.udg.mx/wus/gupprincipal.inicio"); navegador_siiau.setWebViewClient(new WebViewClient() { public void onPageFinished(WebView view, String url) { String user="207512134"; String pwd="FENMAA"; view.loadUrl("javascript:document.getElementsByName('p_codigo_c').value = '"+user+"';document.getElementsByName('p_clave_c').value='"+pwd+"';"); } }); } The result is a blank page with the last string I try to put in the form... What can I do to fill and submit the form correctly?

http://stackoverflow.com/a/24969785
score: 2
answers question: http://stackoverflow.com/q/24969599
downvote count: 0
has body: For the left and right nodes, just call preorderTraversal recursively, and it will add the values to res. Calling add/addAll on res with the results of these recursive calls is wrong. public class Solution { List&lt;Integer&gt; res = new ArrayList&lt;Integer&gt;(); public List&lt;Integer&gt; preorderTraversal(TreeNode root) { if(root == null){ return new ArrayList&lt;Integer&gt;(); } res.add(root.val); if(root.left != null){ preorderTraversal(root.left); } if(root.right != null){ preorderTraversal(root.right); } return res; } } There's a little problem with this solution -- res retains the values from previous calls, so calling preorderTraversal more than once on the same instance may return incorrect results. Here's a solution that does not have this drawback: public class Solution { public List&lt;Integer&gt; preorderTraversal(TreeNode root) { List&lt;Integer&gt; res = new ArrayList&lt;Integer&gt;(); preorderTraversal(root, res); return res; } private void preorderTraversal(TreeNode node, List&lt;Integer&gt; res) { if (node != null) { res.add(node.val); preorderTraversal(node.left, res); preorderTraversal(node.right, res); } } }
upvote count: 2
type: Answer

http://stackoverflow.com/a/24975922
has body: Yes. Although "get" and "set" are merely a convention - they're absolutely necessary for Java beans to work correctly with reflection. You can find out more be reading about BeanINfo or about class Introspector
type: Answer
has comment: http://stackoverflow.com/comment/38825815
upvote count: 3
answers question: http://stackoverflow.com/q/24975882
score: 3
downvote count: 0

http://stackoverflow.com/a/25038821
accepted answer of: http://stackoverflow.com/q/25038666
type: AcceptedAnswer
downvote count: 0
upvote count: 2
has body: There are two errors: The first is that where you wrote BufferedReader br = new BufferedReader("D:\\Files"); that doesn't specify a single file; you probably mean new BufferedReader(new InputStreamReader(new FileInputStream(file))); The second error is that it might not the case that every file in the folder is a file, is accessible for reading, etc. In a well-designed application you should check for those things.
type: Answer
score: 2
answers question: http://stackoverflow.com/q/25038666

http://stackoverflow.com/q/24955470
has comment: http://stackoverflow.com/comment/38795811
tagged with: swing
has comment: http://stackoverflow.com/comment/38788060
linked to: http://stackoverflow.com/q/3066590
tagged with: java
linked to: http://stackoverflow.com/q/8885860
tagged with: jtextfield
type: Question
has comment: http://stackoverflow.com/comment/38788691
has body: I'm currently working on a Eclipse to build a java swing app. I'm having problems displaying my database data into an observing text field. The observing text field is used with a date picker for the user to select the date they want, which will then be saved into the database as a string, e.g. 2014/07/03. After adding this date record to the database, I want to be able to display it before the user can update changes to the date. I tried using the .setText() method but my data is not displaying. final ObservingTextField txtDutyDate = new ObservingTextField(); txtDutyDate.setColumns(10); txtDutyDate.setBounds(283, 427, 108, 22); add(txtDutyDate); txtDutyDate.setText(d.getDutyDate()); P.S ObservingTextField is a self-declared class so I can put the date in the textbox after selecting it from the calendar public class ObservingTextField extends JTextField implements Observer { /** * */ private static final long serialVersionUID = 1L; public void update(Observable o, Object arg) { Calendar calendar = (Calendar) arg; DatePicker dp = (DatePicker) o; // System.out.println("picked=" + dp.formatDate(calendar)); setText(dp.formatDate(calendar)); } }
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/24957089
has comment: http://stackoverflow.com/comment/38788317
has title: .setText() method in observing text field
has comment: http://stackoverflow.com/comment/38788934
type: UnansweredQuestion

http://stackoverflow.com/comment/38815596
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24968444
type: Comment
has text: Are sure adminID column on second column in JTable ?

http://stackoverflow.com/a/28477733
has comment: http://stackoverflow.com/comment/45282079
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24927283
has body: To edit the value, you need to first create a byte[] array that will store the Bitmap.compress(). Here is a part of my code where I do just that(input being the source Bitmap). ByteArrayOutputStream uploadImageByteArray = new ByteArrayOutputStream(); input.compress(Bitmap.CompressFormat.JPEG, 100, uploadImageByteArray); byte[] uploadImageData = uploadImageByteArray.toByteArray(); Based on the JFIF structure, you need to edit the 13th, 14th, 15th, 16th, and 17th indexes in the byte array. 13th specifying the density type, 14th and 15th the X resolution, and 16th and 17th holding the Y resolution. I got the dpi using the following method: private long getDPIinFloat(int width, int height) { return (long) Math.sqrt(width * width + height * height) / 4; } After I got the DPI, I had to do some bit manipulation like so: long firstPart = dpiInFloat &gt;&gt; 8; if (GlobalState.debugModeOn) { Log.d(TAG, "First Part: " + firstPart); } long lastPart = dpiInFloat &amp; 0xff; if (GlobalState.debugModeOn) { Log.d(TAG, "Last Part: " + lastPart); } And then, manipulate the byte information like so: uploadImageData[13] = 1; uploadImageData[14] = (byte) firstPart; uploadImageData[15] = (byte) lastPart; uploadImageData[16] = (byte) firstPart; uploadImageData[17] = (byte) lastPart; //Upload Image data to the server This way, I was able to set the dpi information on the metadata.
type: Answer
upvote count: 5
answers question: http://stackoverflow.com/q/24927283
has comment: http://stackoverflow.com/comment/45282340
score: 5

http://stackoverflow.com/q/24959247
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/38794068
has comment: http://stackoverflow.com/comment/38793894
has comment: http://stackoverflow.com/comment/38794302
has comment: http://stackoverflow.com/comment/38793487
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38796134
has comment: http://stackoverflow.com/comment/38794313
has comment: http://stackoverflow.com/comment/38793844
has comment: http://stackoverflow.com/comment/38793720
has comment: http://stackoverflow.com/comment/38793422
tagged with: java
has body: I'm trying to create a text file with random numbers on each line. I have managed to do this but for some reason the largest file I can seem to generate is 768MBs and I need files up to 15Gbs. Ay ideas why this is happening? My guess is some sort of size limitation or memory issue? This is the code I have written: public static void main(String[] args) throws FileNotFoundException, UnsupportedEncodingException { //Size in Gbs of my file that I want double wantedSize = Double.parseDouble("1.5"); Random random = new Random(); PrintWriter writer = new PrintWriter("AvgNumbers.txt", "UTF-8"); boolean keepGoing = true; int counter = 0; while(keepGoing){ counter++; StringBuilder stringValue = new StringBuilder(); for (int i = 0; i &lt; 100; i++) { double value = 0.1 + (100.0 - 0.1) * random.nextDouble(); stringValue.append(value); stringValue.append(" "); } writer.println(stringValue.toString()); //Check to see if the current size is what we want it to be if (counter == 10000) { File file = new File("AvgNumbers.txt"); double currentSize = file.length(); double gbs = (currentSize/1000000000.00); if(gbs &gt; wantedSize){ keepGoing=false; writer.close(); }else{ writer.flush(); counter = 0; } } } }
has comment: http://stackoverflow.com/comment/38793394
has answer: http://stackoverflow.com/a/24959321
has comment: http://stackoverflow.com/comment/38794338
has comment: http://stackoverflow.com/comment/38793570
has title: Java: Create large text file with random numbers?
has comment: http://stackoverflow.com/comment/38793597
has comment: http://stackoverflow.com/comment/38793994
type: Question
has answer: http://stackoverflow.com/a/24960824
has comment: http://stackoverflow.com/comment/38793461

http://stackoverflow.com/q/24939125
type: Question
tagged with: c#
has comment: http://stackoverflow.com/comment/38756474
has comment: http://stackoverflow.com/comment/38757495
score: -2
has comment: http://stackoverflow.com/comment/38756694
downvote count: 5
has comment: http://stackoverflow.com/comment/38756627
upvote count: 3
has comment: http://stackoverflow.com/comment/38763830
has body: I am new to Java and do not have a lot of experience with multi-threading. Here is some multi-threading code I have in C#.net: public class MultiThread { Thread t1,t2,t3; public MultiThread() { t1=new Thread(m1); t2=new Thread(m2); t1.start(); t2.start(); } public void m1() { for(int i=0;i&lt;100;i++) Console.Write Line(i); } public void m2() { for (int i=0;i&lt;100;i++) Console.Write Line(i); } public static void main() { MultiThread mm=new MultiThread(); } } As per the multi Threading definition(executing sub processes concurrently) m1() and m2() are two different sub processes ...so in this program they(m1 and m2) execute simultaneously If we look at this Java mult-threading code: public class MultiThread extends Thread { public void run(){ for (int i=0;i&lt;100;i++){ System.out.println(i); } } public static void main(String[] args) { MultiThread t1=new MultiThread(); MultiThread t2=new MultiThread(); t1.start(); t2.start(); } } This code contains only one method (a sub process or only one thread). How can I achieve multi-threading in Java? Thank you for the help.
answer count: 1
has comment: http://stackoverflow.com/comment/38757467
has comment: http://stackoverflow.com/comment/38756658
favorite count: 0
has comment: http://stackoverflow.com/comment/38757608
type: UnansweredQuestion
tagged with: multithreading
has comment: http://stackoverflow.com/comment/38761716
has comment: http://stackoverflow.com/comment/38756263
has comment: http://stackoverflow.com/comment/38755900
has title: Coming from C#, How do I code simple multi-threading in Java?
has comment: http://stackoverflow.com/comment/38758299
tagged with: java
has comment: http://stackoverflow.com/comment/38755869
has answer: http://stackoverflow.com/a/24940049

http://stackoverflow.com/q/24967080
score: 0
has comment: http://stackoverflow.com/comment/38815952
tagged with: java
has comment: http://stackoverflow.com/comment/38822921
has comment: http://stackoverflow.com/comment/38821741
accepted answer: http://stackoverflow.com/a/24975139
linked to: http://stackoverflow.com/q/16154361
has title: SFTP Integration JSCH - Failed to execute on session
type: AnsweredQuestion
answer count: 1
tagged with: jsch
has answer: http://stackoverflow.com/a/24975139
has body: I have my Spring Integration sample program working with my Mac setup as local SFTP server (just as here) everything is working fine. I tried to replace my test credentials with the actual (our client/provider's) SFTP credentials and Spring Integration gives me the below exception, in the JSCH module. I am actually able to connect to this server and browse the directory using Filezilla. Any pointers would be of great help. The session creation is pretty much the common way: &lt;bean id="sftpSessionFactory" class="org.springframework.integration.sftp.session.DefaultSftpSessionFactory"&gt; &lt;property name="host" value="${host}"/&gt; &lt;property name="port" value="${port}"/&gt; &lt;property name="user" value="${user}"/&gt; &lt;property name="password" value="${password}"/&gt; &lt;/bean&gt; Here's the log: 19:48:08.511 [tomcat-http--13] DEBUG o.s.web.servlet.DispatcherServlet - DispatcherServlet with name 'chofac-tory' processing POST request for [/chofactory/launchAJob/fetchResponseFile] 19:48:08.511 [tomcat-http--13] DEBUG o.s.w.s.m.m.a.RequestMappingHandlerMapping - Looking up handler method for path /launchAJob/fetchResponseFile 19:48:08.511 [tomcat-http--13] DEBUG o.s.w.s.m.m.a.RequestMappingHandlerMapping - Returning handler method [public org.springframework.http.ResponseEntity&lt;java.lang.String&gt; com.chofac.mint.jobLaunchController.fetchResponseFile(java.lang.String,org.springframework.ui.Model) throws java.lang.Exception] 19:48:08.511 [tomcat-http--13] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Returning cached instance of singleton bean 'jobLaunchController' 19:48:08.512 [tomcat-http--13] DEBUG o.s.w.s.m.m.a.RequestResponseBodyMethodProcessor - Reading [java.lang.String] as "application/json;charset=UTF-8" using [org.springframework.http.converter.StringHttpMessageConverter@73f8dfc4] 19:48:14.233 [tomcat-http--13] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Returning cached instance of singleton bean 'integrationEvaluationContext' 19:48:14.243 [tomca…
type: Question
tagged with: spring
has comment: http://stackoverflow.com/comment/38822908
tagged with: spring-integration

http://stackoverflow.com/comment/38722635
type: AnswerComment
has text: Yeah, I'm kind of in a rush here, and I'm required to use an array. The example was just an oversimplification of course.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24920619

http://stackoverflow.com/q/24977548
has comment: http://stackoverflow.com/comment/38836098
has comment: http://stackoverflow.com/comment/38845233
has comment: http://stackoverflow.com/comment/38828368
has body: I'm currently using a Canvas with an associated BufferStrategy. How can I copy the contents (image) of the Canvas and save it to a BufferedImage. So far I've only tried BufferedImage image = ... g = image.createGraphics(); canvas.printAll(g); //or paintAll However, it appears that only a 'blank' (filled with the background color) screen is being drawn; I it's assume because that's the default behavior of Canvas.paint(). Is there as way for me to retrieve the image currently on screen (the last one shown with BufferStrategy.show()), or do I need to draw to a BufferedImage and copy the image to the BufferStrategy's graphics. It seems like that would/could be a big slow down; would it? Why (because I know someone wants to ask): I already have a set of classes set up as a framework, using Canvas, for building games that can benefit from rapidly refreshing screens, and I'm looking to make an addon framework to have one of these canvases tied into a remote server, sending it's displayed image to other connected clients. (Along the lines of remotely hosting a game.) I'm sure there are better ways to do this in given particular cases (e.g. why does the server need to display the game at all?) But I've already put in a lot of work and am wondering if this method is salvageable without modifying (to much of) the underlying Game framework code I already have.
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38828732
has comment: http://stackoverflow.com/comment/38828404
has comment: http://stackoverflow.com/comment/38831840
has comment: http://stackoverflow.com/comment/38845866
has comment: http://stackoverflow.com/comment/38832083
tagged with: network-programming
tagged with: java
has comment: http://stackoverflow.com/comment/38828527
has title: Copying a snapshot of a Canvas to a BufferedImage
type: Question
has comment: http://stackoverflow.com/comment/38828826
tagged with: awt
has comment: http://stackoverflow.com/comment/38843640
score: 0

http://stackoverflow.com/q/25000514
tagged with: pentaho
tagged with: kettle
downvote count: 0
answer count: 1
favorite count: 0
type: UnansweredQuestion
score: 1
tagged with: java
has body: I am executing My Jobs/ Transformation using Java API and I am able to do it correctly in my host. Now I am looking for a way to execute the transformation in remote host(where carte in running). Please help me or redirect me to the proper documentation where I find the classes to use to accomplish this. PDI Version - 5.0.1 Currently I am executing my Job as below try { if(jobDetails.getGraphlocation()!=null) { KettleEnvironment.init(); JobMeta jobMeta = new JobMeta(jobDetails.getGraphlocation(), null); for( String s : jobDetails.getArguments() ) { String[] splitString = s.split("\\="); if(splitString.length==2) { jobMeta.setParameterValue(splitString[0], splitString[1]); } else System.err.println("Parameter should be of the form - name=value"); } Job job = new Job(null, jobMeta); job.setLogLevel(LogLevel.valueOf(jobDetails.getLoglevel().toString())); job.start(); job.waitUntilFinished(); if (job.getErrors()!=0) { System.out.println("Error encountered!"); } } The above code is able to execute the Job where ever I am running it. But I want to execute it in slave server by just passing the carte username,password ans server IP address.
upvote count: 1
has answer: http://stackoverflow.com/a/25009646
type: Question
has title: Pentaho - Execute a Kettle Transformation remotely using Java

http://stackoverflow.com/comment/40280033
type: Comment
has text: I'll look into this, but I'd still rather not have to write to an actual database just to log what I wrote...
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25038601

http://stackoverflow.com/q/25013342
has comment: http://stackoverflow.com/comment/38895966
score: -2
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/38895696
answer count: 1
has comment: http://stackoverflow.com/comment/38895681
favorite count: 0
has answer: http://stackoverflow.com/a/25013574
accepted answer: http://stackoverflow.com/a/25013574
downvote count: 3
tagged with: regex
has title: Regular expression in java for parsing classname from fully qualified name
has comment: http://stackoverflow.com/comment/38895610
has comment: http://stackoverflow.com/comment/38895607
has body: Can anybody help me in parsing classname from fully qulaified name using regular expression in java. String to parse like this : "com.xxx.xxx.ClassName 0.0.2 i have to get className using Pattern and Matcher in java Please help
type: Question
type: AnsweredQuestion

onclicklistener
tag name: onclicklistener
tags question: http://stackoverflow.com/q/24920214
tags question: http://stackoverflow.com/q/24955446
tags question: http://stackoverflow.com/q/25001716
tags question: http://stackoverflow.com/q/24973752
type: Tag

http://stackoverflow.com/q/24984274
has comment: http://stackoverflow.com/comment/38873318
tagged with: java
has answer: http://stackoverflow.com/a/24984395
upvote count: 1
tagged with: eclipse
has comment: http://stackoverflow.com/comment/38840953
type: Question
tagged with: debugging
has comment: http://stackoverflow.com/comment/38873233
accepted answer: http://stackoverflow.com/a/24984395
has body: Can anyone tell me a good approach to remote debugging Java on linux targets? What I'm after is some method to build my Java project, deploy to target and then debug on the target. I know java can debug on target by starting the running JAR with debug flags e.g. java -Xdebug -Xrunjdwp:transport=dt_socket,address=8001,server=y suspend=y -jar stockTradingGUI.jar But I don't know how to trigger the deployment of built JAR to the target and running in debug mode through Eclipse. Does anyone have any ideas? Thanks
answer count: 1
downvote count: 0
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/38840772
tagged with: linux
has title: Java remote debugging on linux target using Eclipse or otherwise
tagged with: remote-debugging
type: AnsweredQuestion

http://stackoverflow.com/a/24921586
answers question: http://stackoverflow.com/q/24921450
has body: It looks ok for me. I don't see any big optimizations that can be done here. It is also quite clean. However, you might like to see alternative implementations of the same algorithm.
type: Answer
score: 0

http://stackoverflow.com/comment/38863131
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24994747
has text: public static ArrayList<String> testPingIpAddr(String string) throws IOException{ String s = new String(); ArrayList<String> List = new ArrayList<String>(); List.add("it happens \n"); BufferedReader stdInput = new BufferedReader(new InputStreamReader(new ProcessBuilder("ping -c 5 " + string ).start().getInputStream()));

http://stackoverflow.com/q/25051050
tagged with: android
tagged with: shared-libraries
has comment: http://stackoverflow.com/comment/38966665
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38966801
has title: Calling a library function by offset or index
type: Question
has body: I am writing an android and need to call a function from a 3rd party shared library (.so) file, but receive an error stating that the named method isn't found. The library is being loaded by the app, but for whatever reason, using the name of the function refuses to work. Is there any way for me to call the function by via an index number or the relative offset using the android SDK or C? Or maybe, is there some way that I can use the android sdk to find the memory location of the library, add the offset, and then call the function based on the resulting address?
has comment: http://stackoverflow.com/comment/38966602
tagged with: java
tagged with: http://stackoverflow.com/tag/c
score: 0
has comment: http://stackoverflow.com/comment/38967248

http://stackoverflow.com/comment/38755333
has text: `Presumably because null has a type associated with it when assigned to b and that type cannot be assigned to f even if the value of the reference is null` Not exactly. The reason behind it is that you are trying to assign `b` to `f`, but `b` is not the same type of `f`. It's like saying `banana = potato`, but they are two completely different kinds of fruit.
comment on: http://stackoverflow.com/q/24938794
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/comment/38970152
score: 0
has text: thank you, colors are applied but when i open a program, it shouldn`t open correctly, missing the some characters, adding the unnecessary code. please help me, how to open the program correctly with colors.
type: AnswerComment
comment on: http://stackoverflow.com/a/25034293
type: Comment

http://stackoverflow.com/a/24973385
has comment: http://stackoverflow.com/comment/38822297
type: AcceptedAnswer
downvote count: 0
has body: I am not sure the cause of the TransientObjectException, but below is a simple example for how to set default value to form:select. Hope this helps. JSP: <%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %> example <form:form modelAttribute="myForm" method="post"> <form:select path="valueOfSelectElement"> <form:option value="default-value" label="--Please Select" /> <form:options items="${options}" itemValue="id" itemLabel="name" /> </form:select> </form:form> Controller: package org.myorg.myapp; import java.util.Arrays; import java.util.List; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.servlet.ModelAndView; @Controller public class MyController { @RequestMapping(value = "/form", method = RequestMethod.GET) public ModelAndView showForm() { ModelAndView mav = new ModelAndView("form"); List<IdAndName> options = Arrays.asList( new IdAndName("id1", "name1"), new IdAndName("id2", "name2"), new IdAndName("id3", "name3") ); mav.addObject("options", options); MyForm myForm = new MyForm(); myForm.setValueOfSelectElement("default-value"); mav.addObject("myForm", myForm); return mav; } @RequestMapping(value = "/form", method = RequestMethod.POST) @ResponseBody public String processForm(MyForm myForm) { return myForm.getValueOfSelectElement(); } static class MyForm { private String valueOfSelectElement; public String getValueOfSelectElement() { return valueOfSelectElement; } public void setValueOfSelectElement(String valueOfSelectElement) { this.valueOfSelectElement = valueOfSelectElement; } } static class IdAndName { private String id; private String name; public IdAndName(String id, String name) { this.id = id; this.name = name; } public String getId() { return id; } public void setId(String id) { this.id = id; } public String getName(…
type: Answer
score: 2
upvote count: 2
accepted answer of: http://stackoverflow.com/q/24970969
answers question: http://stackoverflow.com/q/24970969

http://stackoverflow.com/a/25007460
score: 3
type: AcceptedAnswer
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/25006232
accepted answer of: http://stackoverflow.com/q/25006232
has body: Take a look at here: https://bitbucket.org/yoavartzi/spf This is a very comprehensive package for parsing text, to logical form, mostly based on CCG grammar.
upvote count: 3
has comment: http://stackoverflow.com/comment/38934022

http://stackoverflow.com/q/25020144
tagged with: swing
tagged with: jbutton
has answer: http://stackoverflow.com/a/25020232
has answer: http://stackoverflow.com/a/25020214
has comment: http://stackoverflow.com/comment/38915941
has comment: http://stackoverflow.com/comment/38908671
tagged with: java
has body: It says that I'm receiving the error at line 506 which is the one saying firstTxt.setText(newPerson.getFirstname()); Here is the first two lines of error code: Exception in thread AWT-EventQueue-0" java.lang.NullPointerException at dataawaredatajava.JFrame.addButtonActionPerformed(JFrame.java:506) This only happens whenever I click on the "Add?" button or addButton. I use a similar method of casting my object with my update button, but that seems to work perfectly fine! private void addButtonActionPerformed(java.awt.event.ActionEvent evt) { switch (addButton.getText()) { case "Add New Person": lstPerson.clearSelection(); blockForAddOrUpdate(true); addButton.setEnabled(true); addButton.setText("Add?"); break; case "Add?": Person newPerson = (Person)lstPerson.getSelectedValue(); firstTxt.setText(newPerson.getFirstname()); lastTxt.setText(newPerson.getLastname()); dobTxt.setText(newPerson.getDob()); occupationTxt.setText(newPerson.getOccupation()); marriedChB.setSelected(newPerson.getMarried()); noOfKidsJSp.setValue(newPerson.getNumberofkids()); dataAwareDataJavaPUEntityManager.getTransaction().begin(); dataAwareDataJavaPUEntityManager.persist(newPerson); dataAwareDataJavaPUEntityManager.getTransaction().commit(); addButton.setText("Add New Person"); blockForAddOrUpdate(false); personList.add(newPerson); lstPerson.setSelectedValue(newPerson, true); break;
type: Question
linked to: http://stackoverflow.com/q/218384
answer count: 2
upvote count: 0
has comment: http://stackoverflow.com/comment/38908636
duplicate of: http://stackoverflow.com/q/218384
tagged with: nullpointerexception
tagged with: jlist
has title: Why am I getting an Null Pointer Exception from trying to add a record?
score: -2
favorite count: 0
has comment: http://stackoverflow.com/comment/38908632
type: UnansweredQuestion
downvote count: 2

http://stackoverflow.com/comment/38753498
has text: So a litlle more detail. i having a working version in different machine working, using the same mail server and code. That's how i could see what would be the next message. So i'm more inclined to a configuration issue of this machine, or something like this.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24937734
score: 0

http://stackoverflow.com/comment/38865790
has text: @user3767481 My bad; that's the correct signature (obviously).
comment on: http://stackoverflow.com/a/24996955
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/38935724
comment on: http://stackoverflow.com/a/25032899
type: AnswerComment
has text: Yes I suggest you try that route instead of trying to force layouts and views to do it for you. I suppose you have a background (big ImageView) and an actor (small ImageView on top, initially in the middle) and you want to move the actor around based on user input/sensor.
score: 0
type: Comment

http://stackoverflow.com/comment/38864236
comment on: http://stackoverflow.com/q/24996664
score: 0
has text: but I want my service will get automatically restarted when it get stopped.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38906834
score: 0
has text: Yep, I probably should have mentioned that earlier.
type: QuestionComment
comment on: http://stackoverflow.com/q/25019254
type: Comment

http://stackoverflow.com/comment/38847020
type: Comment
comment on: http://stackoverflow.com/a/24986694
has text: I have a negative number in my list so ur delimiter ain't work for it?
score: 0
type: AnswerComment

http://stackoverflow.com/comment/38941197
type: AnswerComment
has text: @user3380255 You're welcome. Let me comment on the Pattern - just a sec.
comment on: http://stackoverflow.com/a/25037529
score: 0
type: Comment

http://stackoverflow.com/q/24999306
linked to: http://stackoverflow.com/q/24982744
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38868865
upvote count: 0
tagged with: java
tagged with: file
has answer: http://stackoverflow.com/a/24999400
duplicate of: http://stackoverflow.com/q/24982744
type: Question
has title: java FileWriter append
has comment: http://stackoverflow.com/comment/38868799
score: -2
has body: If you are using a FileWriter in append mode (i.e append set to true in the constructor) is there any easy way of determining if you are appending to an existing file or writing to a new file? Clearly you could try reading the file first but I wonder if there a one liner to know whether you are creating the file or not? Thanks
downvote count: 2
answer count: 1
favorite count: 0

http://stackoverflow.com/a/25047528
upvote count: 5
score: 5
has body: You always store the same list in the list of lists. Then you swap its elements and store it again. So you end up with N references to the same list. You need to make a copy of the list before storing it in the list of lists: myArray.add(new ArrayList&lt;&gt;(a));
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/25047454
has comment: http://stackoverflow.com/comment/38960704

http://stackoverflow.com/comment/38764311
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24930928
has text: I added the logcat for you.

http://stackoverflow.com/comment/38793641
has text: I will delete my answer, didn't think it through
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24944106

http://stackoverflow.com/comment/38955192
comment on: http://stackoverflow.com/q/25044828
type: Comment
type: QuestionComment
has text: Can you clarify the location of your OJDBC JAR? Is it located within your WAR, or within the web server's lib directory?
score: 0

http://stackoverflow.com/a/24938014
accepted answer of: http://stackoverflow.com/q/24937613
has comment: http://stackoverflow.com/comment/38756070
type: Answer
has comment: http://stackoverflow.com/comment/38760125
answers question: http://stackoverflow.com/q/24937613
has body: If you get a ClassPath Exception and an NPE (NullPointerException). The basic cause of this exception are either the JAR file is missing or there were multiple JAR file in the library path. Lets do a basic troubleshooting: 1st: Check if your MYSQL-CONNECTOR JAR file was included in the library of WAR &lt;WEB-INF/lib&gt;. 2nd: Remove other MYSQL library from tomcat lib. 3rd: While your tomcat is running, remove the WAR project from the tomcat webapps folder and wait for a few seconds until everything is clear 4th: Restart your tomcat 5th: Copy your WAR file into the tomcat/webapps folder. The other scenario if you have only the NPE. That means you have some variable being accessed and it's null or not initialized. This happens also when you're accessing a property file and the name was misspelled.
has comment: http://stackoverflow.com/comment/38759431
downvote count: 0
has comment: http://stackoverflow.com/comment/38757594
score: 1
has comment: http://stackoverflow.com/comment/38758145
has comment: http://stackoverflow.com/comment/38759653
has comment: http://stackoverflow.com/comment/38759024
has comment: http://stackoverflow.com/comment/38757867
has comment: http://stackoverflow.com/comment/38754103
has comment: http://stackoverflow.com/comment/38758491
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38758725
has comment: http://stackoverflow.com/comment/38753829
has comment: http://stackoverflow.com/comment/38757364

http://stackoverflow.com/a/24960454
accepted answer of: http://stackoverflow.com/q/24959878
answers question: http://stackoverflow.com/q/24959878
has body: You never need to call updateComponentTreeUI if you only set the look and feel before creating components. If you change the look and feel after having already created components then you need to call the updateUI() method on every existing component. This is what updateComponentTreeUI assists with: it calls updateUI() on the component, as well as all the components it contains (and all the components that they contain; this is what it means by "tree"). If I have a subJFrame where I set the look and feel, and then I call SwingUtilities.updateComponentTreeUI() passing to it a reference to the mainJFrame: is this going to update all its sub-components/subJFrames (and hence updates the subJFrame where I set the LAF)? If by subJFrame you mean a window that is directly contained within the other (a JInternalFrame) then yes. If you mean a frame which was merely opened from the other frame, but is a separate top-level window, then no, it won't update it, because it is not contained within the component that is being updated. This is the loop I use for updating all top-level windows after changing the look and feel: for (Window w : Window.getWindows()) { SwingUtilities.updateComponentTreeUI(w); if (w.isDisplayable() &amp;&amp; (w instanceof Frame ? !((Frame)w).isResizable() : w instanceof Dialog ? !((Dialog)w).isResizable() : true)) w.pack(); } That loop won't catch any components that are not currently attached to windows. For example, this can include JFileChoosers, if you keep instances of those in variables when they're not actively being displayed, in which case you will need to call updateComponentTreeUI separately on those.
upvote count: 5
has comment: http://stackoverflow.com/comment/38796824
has comment: http://stackoverflow.com/comment/38796523
has comment: http://stackoverflow.com/comment/38796581
has comment: http://stackoverflow.com/comment/38796318
type: AcceptedAnswer
downvote count: 0
score: 5
type: Answer

http://stackoverflow.com/comment/38875082
comment on: http://stackoverflow.com/q/25002513
has text: hey jason can you please help me out in this.. ?
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/a/25039341
upvote count: 3
answers question: http://stackoverflow.com/q/25039080
has comment: http://stackoverflow.com/comment/38945401
downvote count: 0
has comment: http://stackoverflow.com/comment/38945276
has comment: http://stackoverflow.com/comment/38944910
type: Answer
has body: The java.util.Class type has the proper methods: Class&lt;?&gt; type = ... boolean primitive = type.isPrimitive(); boolean string_ = type == String.class; boolean array = type.isArray(); boolean enum_ = type.isEnum(); boolean interf_ = type.isInterface();
has comment: http://stackoverflow.com/comment/38944821
score: 3

http://stackoverflow.com/a/24942120
type: Answer
upvote count: 1
downvote count: 1
score: 0
has body: You'll want to look into either the built-in HttpURLConnection class in Java or the Apache HttpComponents library which has a nicer API. HttpURLConnection is very verbose. Your example with Apache HttpComponents: String json = Request.Get("http://10.20.1.116:8080/afa/report?session=fd58603c6673") .connectTimeout(1000) .socketTimeout(1000) .execute() .returnContent() .asString(); Look here for a great answer of how to use HttpURLConnection. Here is an example of the HttpClient API in Apache HttpComponents.
answers question: http://stackoverflow.com/q/24942042

http://stackoverflow.com/comment/38921396
has text: "You should strictly avoid using enums on Android." Wow, that is outrageously bad advice.
type: Comment
score: 4
type: AnswerComment
comment on: http://stackoverflow.com/a/25003455

http://stackoverflow.com/comment/38929143
comment on: http://stackoverflow.com/a/25030786
type: AnswerComment
has text: Yes @Scary Wombat have already tried the above code but as date is having milliseconds we are unable to update the column
score: 0
type: Comment

http://stackoverflow.com/comment/38763638
comment on: http://stackoverflow.com/q/24939497
score: 1
type: Comment
type: QuestionComment
has text: Ok I see it! :P I did not specified a directory, so the file was created in the Apache folder how silly!

http://stackoverflow.com/q/25036297
answer count: 6
has title: Get first letter of a String (more than one word)
has answer: http://stackoverflow.com/a/25036444
tagged with: char
upvote count: 0
score: -2
tagged with: string
favorite count: 0
has answer: http://stackoverflow.com/a/25036651
has comment: http://stackoverflow.com/comment/38938310
accepted answer: http://stackoverflow.com/a/25036444
has answer: http://stackoverflow.com/a/25036957
has answer: http://stackoverflow.com/a/25036452
has answer: http://stackoverflow.com/a/25036472
downvote count: 2
possible better answer: http://stackoverflow.com/a/25036434
type: Question
tagged with: tostring
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25036434
has body: I am trying to get the first letter of every word in a String: String recInf = recursos.getString(nombre); char[] tipoAbreviado = recInf.toCharArray(); tipoAbreviado[0] = Character.toUpperCase(tipoAbreviado[0]); for (int i = 0; i &lt; recInf.length() - 2; i++) { // Es 'palabra' if (tipoAbreviado[i] == ' ' || tipoAbreviado[i] == '.' || tipoAbreviado[i] == ',') { // Reemplazamos tipoAbreviado[i + 1] = Character.toUpperCase(tipoAbreviado[i + 1]); } nombre = tipoAbreviado.toString(); } Finally the value of nombre is [C@3b1938ea, not the first letter of every word in recInf
tagged with: java

http://stackoverflow.com/q/25012055
tagged with: serializable
has title: How to make anonymous class serializable and pass it to IntentService
has body: I am trying to make an android application run in background. So I create an IntentService and I have to pass one object to it. So I make that Object implements Parcelable. The Probelm is that this object contains another object containing handler. So I thought of making the inner object serializable in order to pass it will parcel. But I got this error. 07-29 10:16:08.660: E/AndroidRuntime(29387): FATAL EXCEPTION: main 07-29 10:16:08.660: E/AndroidRuntime(29387): java.lang.RuntimeException: Unable to start activity ComponentInfo{tinygsn.gui.android/tinygsn.gui.android.ActivityListVSNew}: java.lang.RuntimeException: Parcelable encountered IOException writing serializable object (name = tinygsn.controller.AndroidControllerListVSNew) 07-29 10:16:08.660: E/AndroidRuntime(29387): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2110) 07-29 10:16:08.660: E/AndroidRuntime(29387): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2135) 07-29 10:16:08.660: E/AndroidRuntime(29387): at android.app.ActivityThread.access$700(ActivityThread.java:140) 07-29 10:16:08.660: E/AndroidRuntime(29387): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1237) 07-29 10:16:08.660: E/AndroidRuntime(29387): at android.os.Handler.dispatchMessage(Handler.java:99) 07-29 10:16:08.660: E/AndroidRuntime(29387): at android.os.Looper.loop(Looper.java:137) 07-29 10:16:08.660: E/AndroidRuntime(29387): at android.app.ActivityThread.main(ActivityThread.java:4921) 07-29 10:16:08.660: E/AndroidRuntime(29387): at java.lang.reflect.Method.invokeNative(Native Method) 07-29 10:16:08.660: E/AndroidRuntime(29387): at java.lang.reflect.Method.invoke(Method.java:511) ?07-29 10:16:08.660: E/AndroidRuntime(29387): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1027) 07-29 10:16:08.660: E/AndroidRuntime(29387): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:794) 07-29 10:16:08.660: E/AndroidRuntime(29387): at dalvik…
upvote count: 1
tagged with: android
tagged with: anonymous
favorite count: 0
answer count: 0
has comment: http://stackoverflow.com/comment/38898620
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38894044
downvote count: 0
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/38893719
type: Question
has comment: http://stackoverflow.com/comment/38893538
has comment: http://stackoverflow.com/comment/38894239
has comment: http://stackoverflow.com/comment/38893840

http://stackoverflow.com/comment/38701107
has text: Seems to me that you want trim() function of String
comment on: http://stackoverflow.com/q/24910262
type: Comment
type: QuestionComment
score: 2

http://stackoverflow.com/q/25055032
type: Question
downvote count: 0
has answer: http://stackoverflow.com/a/25055094
favorite count: 0
has answer: http://stackoverflow.com/a/25055242
answer count: 3
has body: I have seen some code like this and unable to understand its significance: public class ClassA{ public &lt;T&gt; void getContactName(ContactList&lt;T&gt; contactList){ //do something } } Basically I didn't understand this. The class compiles without any error. I thought ClassA should also be made generic with parameter 'T' . Thanks
tagged with: generics
upvote count: 2
type: UnansweredQuestion
score: 2
has answer: http://stackoverflow.com/a/25055108
tagged with: java
has title: Java generic at return type

http://stackoverflow.com/a/78660737
has body: Alternative: boolean isBooleanObjectTrue = booleanObject.booleanValue(); See usage: public static void main(String[] args) { Boolean booleanObject = Boolean.TRUE; boolean isBooleanObjectTrue = booleanObject.booleanValue(); System.out.println(isBooleanObjectTrue); // prints: 'true' booleanObject = Boolean.FALSE; isBooleanObjectTrue = booleanObject.booleanValue(); System.out.println(isBooleanObjectTrue); // prints: 'false' }
score: 0
type: Answer
answers question: http://stackoverflow.com/q/24950435

http://stackoverflow.com/q/24909794
has answer: http://stackoverflow.com/a/24910020
type: UnansweredQuestion
answer count: 4
score: 2
downvote count: 0
tagged with: java
type: Question
has body: I'm doing a code that calculate Euler number, but i haven't a good precision. If my i(variable to factorial) is 40, the code returns infinity, but, 20 or 30 the code return the number correctly my code double e = 1; for (int i = 1; i &lt; 18; i++) { double j = (double)(E.factorial(i)); double k = 1 / j; e = e + k; }
has comment: http://stackoverflow.com/comment/38700220
has answer: http://stackoverflow.com/a/24909866
has answer: http://stackoverflow.com/a/24909973
has title: Precision in Euler number java
upvote count: 2
has comment: http://stackoverflow.com/comment/38700054
favorite count: 0
has answer: http://stackoverflow.com/a/24909963

http://stackoverflow.com/a/77744359
has body: As of Java 21, List has the reversed method, so one solution would be to stream to a List (as in your example), and then call reversed() on it. objList.stream().map(i -&gt; i).reversed().forEach(i -&gt; System.out.print(&quot; &quot; + i));
score: 0
answers question: http://stackoverflow.com/q/24946514
type: Answer

http://stackoverflow.com/comment/38946347
type: QuestionComment
comment on: http://stackoverflow.com/q/25040459
has text: Because code review deals with real code, that works, and this code, does not.
score: 0
type: Comment

http://stackoverflow.com/comment/38892320
comment on: http://stackoverflow.com/q/25011589
score: 0
type: Comment
type: QuestionComment
has text: can you explain why you expecting 0 as first condition in your if statement is `true`?

http://stackoverflow.com/q/24988304
has comment: http://stackoverflow.com/comment/38848588
has comment: http://stackoverflow.com/comment/38848723
tagged with: constants
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38848753
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/38848558
has body: im using interface to accesses the project constant this is my interface public interface ConstantValues { interface PaymentType { public static final String CREDIT_CUSTOMER = "credit"; public static final String CASH_CUSTOMER = "cash"; } interface PaymentMethode { public static final String CREDIT_CARD = "creditcard"; public static final String VISA_CARD = "visacard"; public static final String MASTER_CARD = "mastercard"; } } im accessing this values form the java class like in the below ConstantValues.PaymentType.CREDIT_CUSTOMER or ConstantValues.PaymentType.VISA_CARD but i want to know how to do this using enum, because using a interfaces to define constant is bad practice can please anybody tell me how to do that using enum and how to access it from java class?
upvote count: 1
type: Question
tagged with: jakarta-ee
tagged with: enums
accepted answer: http://stackoverflow.com/a/24988339
possible better answer: http://stackoverflow.com/a/24988334
has comment: http://stackoverflow.com/comment/38848549
answer count: 2
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/24988334
has answer: http://stackoverflow.com/a/24988339
has title: How to use enums to define constant value groups
tagged with: interface

http://stackoverflow.com/comment/39093406
has text: I have added some more code snippets now. Hope it helps.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24955173

http://stackoverflow.com/comment/39028477
comment on: http://stackoverflow.com/a/25042999
type: AnswerComment
score: 0
type: Comment
has text: It would be great if you could accept my answer, for both me and you.

http://stackoverflow.com/a/24959851
downvote count: 0
type: Answer
has body: Such reliable hash methods are not fast. They're probably fast enough, though. You're looking for a cryptographic message digest method (like the ones used to identify files in P2P networks or commits in Git). Look for the MessageDigest class, and pick your algorithm (SHA1, MD5, SHA256, etc.). Such a hash function will take bytes as argument, and produce bytes as a result, so make sure to convert your strings using a constant encoding (UTF8, for example), and to transform the produced byte array (typically of 16 or 20 bytes) to a readable String using hexadecimal or Base64 encoding.
accepted answer of: http://stackoverflow.com/q/24959804
answers question: http://stackoverflow.com/q/24959804
score: 4
upvote count: 4
type: AcceptedAnswer

http://stackoverflow.com/comment/38807986
type: Comment
has text: is there something i could search for that might lead me to fimd the missing close?
comment on: http://stackoverflow.com/a/24965362
type: AnswerComment
score: 0

http://stackoverflow.com/comment/38966549
has text: I am encountering error on rs.getBlob. It says "the constructor paragraph(blob) is undefined." How do I retrieve file from the database and generate pdf using itext?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25050376
score: 0

http://stackoverflow.com/a/25041958
downvote count: 0
score: 1
has body: You can use a second array to preserve the order of keys. var order = []; //add something to map map['a'] = 1; order.push('a'); map['b'] = 2; order.push('b'); //iterate in order for (var i=0; i&lt; order.length;++i) { alert(map[order[i]); } Preserving consistency of the order array might be tricky since you always need to update the order array when you modify the original map.
answers question: http://stackoverflow.com/q/25041814
upvote count: 1
type: Answer

http://stackoverflow.com/comment/38783852
comment on: http://stackoverflow.com/q/24954152
has text: Use `System.out.print`
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24940621
tagged with: clone
has comment: http://stackoverflow.com/comment/38759316
tagged with: java
has body: so I have the following in my book: Calendar calendar = new GregorianCalendar(2013,2,1); Calendar calendar1 = (Calendar)calendar.clone(); Why is there the need for the casting (Calendar) ? isn't the calendar.clone() returning a GregorianCalendar copy of calendar ? if I delete the casting it's a compile error but if I write System.out.println(calendar.clone().getClass()); it prints GregorianCalendar. Isn't calendar1 pointing to a GregorianCalendar after calendar.clone() (without casting)?
has comment: http://stackoverflow.com/comment/38761340
accepted answer: http://stackoverflow.com/a/24940643
type: Question
downvote count: 0
has comment: http://stackoverflow.com/comment/38759684
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/24940643
has comment: http://stackoverflow.com/comment/38759199
upvote count: 2
has title: casting clone() in java
tagged with: calendar
type: AnsweredQuestion
score: 2

http://stackoverflow.com/comment/38979909
type: Comment
score: 2
comment on: http://stackoverflow.com/a/25058336
has text: Why read the whole thing into memory? Why build the whole result in memory? Just write each line out?
type: AnswerComment

http://stackoverflow.com/comment/38952467
score: 0
type: AnswerComment
has text: ok i managed to have some jstl code printed but strangely only inside the tag 'BODY'... If i try a c:out outside body tag (inside 'head' for example), it doesn't print it...
type: Comment
comment on: http://stackoverflow.com/a/25040806

http://stackoverflow.com/comment/39336049
score: 0
type: Comment
has text: Yes, that was the case. The answer from @PeterNiederwieser was exactly right.
type: QuestionComment
comment on: http://stackoverflow.com/q/25021284

http://stackoverflow.com/comment/38800285
type: AnswerComment
has text: @HotLicks Sometimes there is a very good reason for something more complicated, but without more information, the aim should be to as simple as you can make it and come back later and make it simpler again.
type: Comment
score: 2
comment on: http://stackoverflow.com/a/24962532

http://stackoverflow.com/q/25007433
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/65758623
tagged with: locale
has title: Gradle - change Java compiler output locale or encoding
downvote count: 0
favorite count: 0
linked to: http://stackoverflow.com/q/64038
has comment: http://stackoverflow.com/comment/56464326
has answer: http://stackoverflow.com/a/25010506
type: UnansweredQuestion
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/56732081
tagged with: java
tagged with: gradle
has body: Can one configure Gradle to change java compiler output locale or encoding? The problem: gradle in run on Windows with non English default Local (in particular it is Chinese) There is possibility to do that configuring Java, e.g. Setting java locale settings . Can Gradle do (that is just for this build, CI job) ? UPDATE: As Vadim referenced, for source encoding, this snippet is used. tasks.withType(Compile) { options.encoding = 'UTF-8' } Details: Gradle calls Java compile, that defaults to system Locale (in my case it is Chinese). So when error appears, it is shown in Chinese. Java documentation says to configure via environment variable. But I want to do it only for this build.gradle ... Possibly I need to change that environment variable before and after compilation automatically, it Gradle does not provide such costomization.

http://stackoverflow.com/comment/38896510
comment on: http://stackoverflow.com/q/25013843
score: 0
type: QuestionComment
has text: What are you trying to here, such a messy code. Can see you are creating ListAdapter with fixed array? ListAdapter eventiAdapter = new SimpleAdapter(OlivetoEventi.this, oslist, R.layout.row, new String[] { "titolo", "data" }, new int[] { R.id.rowTextView, R.id.rowEventiData })
type: Comment

http://stackoverflow.com/a/25007998
type: AcceptedAnswer
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/25007946
upvote count: 3
has body: Start by making sure you have read through and understand the JavaDocs for Component#repaint. When using these methods, the clipping rectangle is modified so only the area you specify is available to be within in the Graphics context, this means you are still free to paint outside this area, but it will have no effect. Also, make sure that you "clear" the previous area first, otherwise you will end up with ghosting artifacts. What this means is, unless you painting process is optimised to take advantage of this, it may have little to no effect on the time it takes to actually paint the area. So, in short, yes, calling repaint(int, int, int, int), if done correctly will allow you to repaint only a portion of the UI, but you need to make considerations to allow for the fact that what you are trying to paint now might have been painted somewhere else and will need to also be repainted... Quoting from Painting in AWT and Swing A program must assume that a call to paint() implies that the area defined by the graphic's clip rectangle is "damaged" and must be completely repainted And "Smart" Painting While the AWT attempts to make the process of rendering components as efficient as possible, a component's paint() implementation itself can have a significant impact on overall performance. Two key areas that can affect this process are: Using the clip region to narrow the scope of what is rendered. Using internal knowledge of the layout to narrow the scope of what children are painted (lightweights only). If your component is simple -- for example, if it's a pushbutton -- then it's not worth the effort to factor the rendering in order to only paint the portion that intersects the clip rectangle; it's preferable to just paint the entire component and let the graphics clip appropriately. However, if you've created a component that renders complex output, like a text component, then it's critical that your code use the clip information to narrow the amount of rendering. Further…
accepted answer of: http://stackoverflow.com/q/25007946
score: 3

http://stackoverflow.com/q/25019680
downvote count: 0
answer count: 1
has title: Android Studio detects import, but gives "Symbol cannot be resolved"
accepted answer: http://stackoverflow.com/a/25064713
favorite count: 0
has body: I have added a library to my project in Android Studio with various classes, one of which is PublicKey.java. If I start to type PublicKey in a class in my project, java detects the file and shows me the full file name in the popup that I can click to auto-complete. Ie, I start typing PublicKey, and I can click org.abstractj.kalium.keys.PublicKey. However, as soon as I do this, android studio then tells me it cannot resolve the symbol abstractj, despite the fact it must recognize it given that it just prompted me to use it. Any ideas on how to fix this? (Note: this happens with any file in the library. I just use PublicKey as an example)
tagged with: importerror
tagged with: android
type: AnsweredQuestion
score: 1
upvote count: 1
has answer: http://stackoverflow.com/a/25064713
type: Question
has comment: http://stackoverflow.com/comment/38908051
tagged with: java
has comment: http://stackoverflow.com/comment/38907679

http://stackoverflow.com/a/25018225
has comment: http://stackoverflow.com/comment/38906816
has comment: http://stackoverflow.com/comment/38907127
upvote count: 2
has comment: http://stackoverflow.com/comment/38905301
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38905176
has comment: http://stackoverflow.com/comment/38905828
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/38905940
downvote count: 0
answers question: http://stackoverflow.com/q/25018084
has body: For the scroll pane, change constraints.fill = constraints.HORIZONTAL; to constraints.fill = constraints.BOTH; The second issue mentioned in the comment is fixed by adding constraints.weighty = 0; to the buttons. Complete fixed example: package com.zetcode; import java.awt.BorderLayout; import java.awt.Color; import java.awt.EventQueue; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import javax.swing.BorderFactory; import javax.swing.JButton; import javax.swing.JFrame; import static javax.swing.JFrame.EXIT_ON_CLOSE; import javax.swing.JMenu; import javax.swing.JMenuBar; import javax.swing.JMenuItem; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTable; public class MainWindow extends JFrame { private JPanel EmployeePanel; private JButton add, remove, edit; private JTable EmployeeTable; private JScrollPane EmployeeTableScrollPane; private JMenuBar menu; private JMenu file; private JMenuItem exit; private final String[] columns = {"First Name", "Last Name", "Initials"}; private String[][] data = { {"First Name", "Last Name", "Initials"}, {"First Name", "Last Name", "Initials"}, {"First Name", "Last Name", "Initials"}, {"First Name", "Last Name", "Initials"}, {"First Name", "Last Name", "Initials"}, {"First Name", "Last Name", "Initials"}, {"First Name", "Last Name", "Initials"}, {"First Name", "Last Name", "Initials"}, {"First Name", "Last Name", "Initials"}, {"First Name", "Last Name", "Initials"}, {"First Name", "Last Name", "Initials"}, {"First Name", "Last Name", "Initials"}, {"First Name", "Last Name", "Initials"}, {"First Name", "Last Name", "Initials"}, {"First Name", "Last Name", "Initials"}, {"First Name", "Last Name", "Initials"}, {"First Name", "Last Name", "Initials"}, {"First Name", "Last Name", "Initials"}, {"First Name", "Last Name", "Initials"}, {"First Name", "Last Name", "Initials"}, {"First Name", "Last Name", "Initials"}, {"First Name", "Last Name", "Initials"}, {"First Name", "Last Name", "Initi…
accepted answer of: http://stackoverflow.com/q/25018084

http://stackoverflow.com/a/25058368
has body: sed will be much faster in this case: sed 's/^..//' file &gt; output The reason why your code is so slow is that you concatenate strings with +. That creates a new object, copies the content of the two old strings and then forgets about the two old strings. That puts a lot of stress on the VM. Try it with StringBuilder instead.
answers question: http://stackoverflow.com/q/25058288
has comment: http://stackoverflow.com/comment/38980255
has comment: http://stackoverflow.com/comment/38980507
upvote count: 4
downvote count: 0
score: 4
has comment: http://stackoverflow.com/comment/38980405
type: Answer
has comment: http://stackoverflow.com/comment/38980149

http://stackoverflow.com/comment/38998631
has text: that is still called before the view is visible
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25067934
type: Comment

http://stackoverflow.com/comment/38814478
type: AnswerComment
has text: You don't, you let someone else catch them (i.e. the caller of the method). That someone else could be you again though, you've just moved the problem of catching the `Exception` to another place.
type: Comment
score: 0
comment on: http://stackoverflow.com/a/24970395

http://stackoverflow.com/comment/38766458
type: Comment
comment on: http://stackoverflow.com/a/24944210
has text: +1, this is also interesting approach since these outer parenthesis shouldn't have any meaning here.
type: AnswerComment
score: 0

http://stackoverflow.com/a/25039170
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/38944547
answers question: http://stackoverflow.com/q/25038716
has body: You'll need to create a service, because activities don't run when screen is off

restful-architecture
type: Tag
tags question: http://stackoverflow.com/q/24938798
tag name: restful-architecture

http://stackoverflow.com/comment/46510733
comment on: http://stackoverflow.com/a/25011031
score: 1
type: AnswerComment
type: Comment
has text: @gjain, varargs are just syntactic sugar on top of arrays, so String[] would work well. See http://stackoverflow.com/questions/2925153/can-i-pass-an-array-as-arguments-to-a-method-with-variable-arguments-in-java for more details.

http://stackoverflow.com/q/25049291
tagged with: android
tagged with: mapsforge
has answer: http://stackoverflow.com/a/25050140
type: AnsweredQuestion
score: 1
has title: NoClassDefFoundError with Mapsforge 0.4.0 and Eclipse, cannot build
tagged with: java
upvote count: 1
has body: I am trying to setup a new Android project with Mapsforge. I know that people have been getting this issue because the library requires Java 7 to build. However, I am using Build-Tools verson 20, which uses Java 7. I also have the latest updated version of the Eclipse tools. In fact, I am on a clean install of the Android Developer Kit. So far, I have imported mapsforge-core, mapsforge-map, mapsforge-map-android, mapsforge-map-awt, and mapsforge-map-reader. I then tried to initialize a MapView using the following code: AndroidGraphicFactory.createInstance(thisApp); This results in the following error. java.lang.NoClassDefFoundError: org.mapsforge.map.android.graphics.AndroidGraphicFactory I looked in the referenced libraries, and the AndroidGraphicFactory class is defined within org.mapsforge.map.android.graphics and shows up. When looking at the jar file within /bin/dexedLibs\, the classes.dex file exists, but there is next to nothing else. I followed the steps suggested by this answer, but the error persists. Any ideas as to why this might be?
type: Question
tagged with: eclipse
downvote count: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/25050140
favorite count: 0

http://stackoverflow.com/q/25036976
has comment: http://stackoverflow.com/comment/38939897
type: Question
has answer: http://stackoverflow.com/a/25037370
has answer: http://stackoverflow.com/a/25037616
score: 0
answer count: 2
has title: generated accessors to private fields of outer classes in java
type: UnansweredQuestion
has body: So I have a question about the accessors generated by javac (version 1.7.0_65) to allow inner classes to access private fields of the outer class. First, here is a short code snippet: public class A { private int f = 0; class AA { public int m() { return f; } } } The compiler generates an accessor method in class A in order for method m to be able to read and return the value of f. This accessor looks like this: static int access$0(A); flags: ACC_STATIC, ACC_SYNTHETIC Code: stack=1, locals=1, args_size=1 0: aload_0 1: getfield #12 // Field f:I 4: ireturn And my question is: why is this accessor generated as a static method? Are there cases in which a non-static method wouldn't work?
tagged with: accessor
tagged with: inner-classes
tagged with: java

http://stackoverflow.com/a/25005558
has body: IE does not support IP addresses values in Subject Alternative Name (SAN), only DNS entries. This is a known limitation that won't be fixed, according to Microsoft: We do not support using the IP choice in the Subject Alternative name to match the server name. You can work around this by adding the IP address as a string for a DNS name choice. At this time we do not plan on fixing this issue. So the correct way to handle it is to add a DNS entry containing the IP address: "dns:127.0.0.1" Unfortunately, this is not possible using keytool or programmatically with sun.security.x509 classes because of Java bug 8016345. It is however possible to fix this bug by yourself, just by copying the latest version of DNSName.java and remove this check: //DNSName components must begin with a letter A-Z or a-z if (alpha.indexOf(name.charAt(startIndex)) &lt; 0) throw new IOException("DNSName components must begin with a letter");
upvote count: 6
score: 6
has comment: http://stackoverflow.com/comment/39076702
has comment: http://stackoverflow.com/comment/38896259
accepted answer of: http://stackoverflow.com/q/24971552
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/24971552
has comment: http://stackoverflow.com/comment/39037790
type: Answer

http://stackoverflow.com/comment/38984615
type: AnswerComment
comment on: http://stackoverflow.com/a/25060322
type: Comment
score: 0
has text: But what will happen if not, I am not getting any compile errors or warnings.

http://stackoverflow.com/a/25301811
type: Answer
has body: I'll give you a pretty complete example that shows you how to use AnalyzingInfixSuggester. In this example we'll pretend that we're Amazon, and we want to autocomplete a product search field. We'll take advantage of features of the Lucene suggestion system to implement the following: Ranked results: We will suggest the most popular matching products first. Region-restricted results: We will only suggest products that we sell in the customer's country. Product photos: We will store product photo URLs in the suggestion index so we can display them in the search results, without having to do an additional database lookup. First I'll define a simple class to hold information about a product in Product.java: import java.util.Set; class Product implements java.io.Serializable { String name; String image; String[] regions; int numberSold; public Product(String name, String image, String[] regions, int numberSold) { this.name = name; this.image = image; this.regions = regions; this.numberSold = numberSold; } } To index records in with the AnalyzingInfixSuggester's build method you need to pass it an object that implements the org.apache.lucene.search.suggest.InputIterator interface. An InputIterator gives access to the key, contexts, payload and weight for each record. The key is the text you actually want to search on and autocomplete against. In our example, it will be the name of the product. The contexts are a set of additional, arbitrary data that you can use to filter records against. In our example, the contexts are the set of ISO codes for the countries we will ship a particular product to. The payload is additional arbitrary data you want to store in the index for the record. In this example, we will actually serialize each Product instance and store the resulting bytes as the payload. Then when we later do lookups, we can deserialize the payload and access information in the product instance like the image URL. The weight is used to order suggestion results; resul…
score: 57
answers question: http://stackoverflow.com/q/24968697
has comment: http://stackoverflow.com/comment/129840499
has comment: http://stackoverflow.com/comment/46271855
downvote count: 0
upvote count: 57

http://stackoverflow.com/comment/38867614
type: QuestionComment
comment on: http://stackoverflow.com/q/24998592
has text: where is newAssignment declared? In the `activity_newassignment` ?
score: 0
type: Comment

http://stackoverflow.com/comment/38926113
comment on: http://stackoverflow.com/a/25029340
type: AnswerComment
score: 0
has text: Syntatically no, it doesn't. *Semantically*, it better have, or you've got an infinite loop on your hands. Syntax isn't the same as semantics, and once again, I stress that I'm only talking about syntax.
type: Comment

http://stackoverflow.com/comment/38711385
has text: You can check here http://docs.oracle.com/cd/B10501_01/java.920/a96654/oraperf.htm#1057359
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24915387

http://stackoverflow.com/comment/38771851
type: Comment
type: QuestionComment
has text: What does the log statement `response: ` print? also, the second condition in the `if` statement should be modified. `String` checks for equality should be made with the `equals()` method.
comment on: http://stackoverflow.com/q/24947261
score: 0

http://stackoverflow.com/q/24924414
accepted answer: http://stackoverflow.com/a/24924619
tagged with: java
tagged with: javafx
has body: I only just started learning about JavaFX today and I was trying to learn more about it by making a Snake clone, but I am having trouble with threading. I wanted to create a thread that updated the snake's position on the screen, but couldn't use one in a normal Runnable thread way, because I was using JavaFX from within that thread to update positions of rectangles drawn to the screen (Which I learned you cannot do, and must instead use Tasks, Services, Platform.runLater, etc?) My class that I was creating the thread from extends JavaFX.scene.layout.Pane, and I am trying to use a task to update the snake position. My problem is: The task only seems to run once or twice and quits, without me giving any interrupts. Constructor for the class that extends Pane (The Snake class extends Group): public GameFrame(){ this.setPrefSize(800, 600); Snake snake = new Snake(); this.getChildren().add(snake); taskThread = new Thread(new Task&lt;Void&gt;() { protected Void call() throws Exception { while(!Thread.currentThread().isInterrupted()){ snake.updatePosition(); try{ Thread.sleep(1000); } catch(InterruptedException e){ break; } } return null; } }); taskThread.start(); } I feel like I don't actually grasp what the best thing to do here is, and what I am trying to do may be hackish. Are there any suggestions on what I should do, or how I could fix this?
type: Question
downvote count: 0
answer count: 1
favorite count: 0
score: 1
has title: JavaFX Task ending and JavaFX threading
tagged with: multithreading
has answer: http://stackoverflow.com/a/24924619
upvote count: 1
type: AnsweredQuestion

http://stackoverflow.com/comment/38923152
type: AnswerComment
type: Comment
has text: I have added some delays like "Timer timer = new Timer(); timer.schedule(new MyTask(), 1000, 2000);" after the "channel.connect()". But the result still is "can't startup clish"
comment on: http://stackoverflow.com/a/25018033
score: 0

http://stackoverflow.com/comment/38718783
comment on: http://stackoverflow.com/q/24913970
type: Comment
has text: so how can I renew its reference? please write as an answer and I'll vote you
type: QuestionComment
score: 0

http://stackoverflow.com/comment/38871741
type: AnswerComment
has text: OK, change the first parameter `this` to the `Context` of your `Activity`.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25000591

http://stackoverflow.com/a/24988488
type: Answer
has comment: http://stackoverflow.com/comment/38965840
has comment: http://stackoverflow.com/comment/38887070
answers question: http://stackoverflow.com/q/24986850
has body: First there are two entities present here department and employee. Second, we have to understand what ManyToOne means here, as you said, many employees could be there in a single department. Mapping would be like, please note that this a snippet only: @Entity @Table(name="EMPLOYEE") public class Employee { @Id @GeneratedValue @Column(name="employee_id") private Long employeeId; @Column(name="firstname") private String firstname; @Column(name="lastname") private String lastname; @ManyToOne @JoinColumn(name="department_id") private Department department; // Getter and Setter methods } @Entity @Table(name="DEPARTMENT") public class Department { @Id @GeneratedValue @Column(name="department_id") private Long departmentId; @Column(name="department_name") private String departmentName; @OneToMany(mappedBy="department") private Set&lt;Employee&gt; employees; // Getter and Setter methods } Since there is a bi-directional relationship here one side would be a owner of the relationship here. The annotation @JoinColumn indicates that this entity is the owner of the relationship. That is, the corresponding table has a column with a foreign key to the referenced table, whereas the attribute mappedBy indicates that the entity in this side is the inverse of the relationship, and the owner resides in the "other" entity. More on what does mapppedby do can be found here.
score: 5
upvote count: 5
has comment: http://stackoverflow.com/comment/38862415
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24986850

http://stackoverflow.com/a/34716113
has body: Here is the change log which will helps you to choose firefox version (for Java) https://github.com/SeleniumHQ/selenium/blob/master/java/CHANGELOG I hope for latest standalone jar , firefox 39 does not have any issues. In my work space i am using FF 31 with latest jar as per requirement. I dont have any connection issues like these.. Thank You
answers question: http://stackoverflow.com/q/24948688
type: Answer
score: 0

http://stackoverflow.com/a/24923562
score: 0
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/24919748
has body: There is no official concept of nested http header. In this case the header is "Authorization" and it contains a string representing oauth parameters. You have to parse it yourself or using a third party library. You can find some examples at oauth.googlecode.com. More specifically, look at the decodeAuthorization() method in this class. It uses regular expressions to parse the oauth parameters.
answers question: http://stackoverflow.com/q/24919748
has comment: http://stackoverflow.com/comment/38763052

http://stackoverflow.com/comment/38777823
score: 1
type: Comment
type: QuestionComment
has text: I think this is a solution. http://stackoverflow.com/questions/12203003/boolean-expression-parser-in-java
comment on: http://stackoverflow.com/q/24950586

http://stackoverflow.com/a/24947020
has comment: http://stackoverflow.com/comment/38771253
has comment: http://stackoverflow.com/comment/38771500
has comment: http://stackoverflow.com/comment/38771196
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/38771776
has comment: http://stackoverflow.com/comment/38771657
has comment: http://stackoverflow.com/comment/38771173
answers question: http://stackoverflow.com/q/24946987
has comment: http://stackoverflow.com/comment/38771352
has comment: http://stackoverflow.com/comment/38771270
has comment: http://stackoverflow.com/comment/38805013
has comment: http://stackoverflow.com/comment/38771556
has comment: http://stackoverflow.com/comment/38771102
has comment: http://stackoverflow.com/comment/38771763
has body: It will only print the prompt for year after you enter the last name and the prompt for license number after you input the year. Scanner.nextLine() scans all the user input till he hits enter. So only when you hit enter will it stop reading for input and move on to the next line of code. And since you have put in validation checks for each input, it will not accept your input till the entered value is valid. Once you enter a valid input and hit enter it will move on to the next method. EDIT: else if (!Character.isLetter(lastname.charAt(i))) { lastname = getLastName(sc); } The above part in your code checks if the character is a letter or not and prints the prompt again if it is not a letter/alphabet. So, every time it encounters a space in your last name, it fails the check and prompts you to enter the last name again.
has comment: http://stackoverflow.com/comment/38790998

http://stackoverflow.com/comment/38756913
score: 0
type: Comment
has text: That is certainly a very nice looking option, but it appears that the knowledge to use this code may be a bit beyond me. I'll read the documents and see if that helps though. Also, is this included within the JDK, or does it require the downloading of external classes?
type: AnswerComment
comment on: http://stackoverflow.com/a/24939500

http://stackoverflow.com/comment/38849737
comment on: http://stackoverflow.com/q/24988797
has text: also you should call `revalidate()` instead of `validate()` and I'm not sure about this but maybe you should call that `revalidate()` at the very last, and not between the `remove(...)` and `add(...)` methods, if someone could correct me if wrong or tell me if right, would appreciate it too though
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/a/25004531
upvote count: 1
answers question: http://stackoverflow.com/q/25004449
type: Answer
downvote count: 0
score: 1
has body: The approach would vary but here comes one that I heard not much time ago. I would create a token that identifies the user. This token could be stored on the database for future scalability (distributed databases or servers). I would create some CursorLoaders and a local SQLite database. This way the first time the user starts the app, all the content should get downloaded and stored with the last-modified header value. The next time you could just make an HTTP call of HEAD and if the last-modified data changed you should sync again your content, and the CursorLoaders will keep the data on the UI up to date.

http://stackoverflow.com/comment/38936845
type: QuestionComment
has text: yes, maybe a duplicate... but in that posts you get the pointer image via native code using win32api... i was looking for a way without that...
comment on: http://stackoverflow.com/q/25035080
score: 1
type: Comment

http://stackoverflow.com/comment/38958802
type: AnswerComment
has text: I did come up with this idea but I have to write IO operations for a set of domain classes that have already been developed. Reflective code probably serves my purpose better.
type: Comment
comment on: http://stackoverflow.com/a/25046215
score: 0

http://stackoverflow.com/comment/38699296
type: QuestionComment
comment on: http://stackoverflow.com/q/24909275
score: 0
has text: getTimestape() returns a String formatted as explained above, that is: "YYYY-MM-DD hh:mm:ss". An example is shown below the code box above.
type: Comment

http://stackoverflow.com/a/24933196
has body: only comment, longer see number of table1.setModel(new DefaultTableModel( created in loop for(int i = 0; i &lt;empArray.size(); i++) new Object[][] {{empArray.get(i).getFName(), empArray.get(i).getLName(),empArray.get(i).getMobile()}}, is converted to DataVector, you lost, haven't access to this array (if is there reason to hold two the same arrays in your program then) use array based on util.List in AbstractTableModel
answers question: http://stackoverflow.com/q/24932977
downvote count: 0
type: Answer
score: 2
upvote count: 2

http://stackoverflow.com/comment/38792115
has text: Yes it should be, but ConversionService formatter converts it to string as I mentioned in the question. So the question is how to avoid this transformation.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24958443

http://stackoverflow.com/comment/38841655
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24984718
has text: Also, Java implements do support UTF-8. What made you believe that they are not recognized by Java? Any errors, bad characters?
score: 0

http://stackoverflow.com/comment/39002448
type: Comment
comment on: http://stackoverflow.com/a/25068215
has text: Sure. The thing is I have a form which has fields associated with multiple tables. I have created the bean corresponding to that form including the columns from multiple tables(I don't know if that's the way to do it). That's why there is problems with mappings. I am posting the actual beans as an Edit to the original question. Thanks for the answers. Truly appreciated!
score: 0
type: AnswerComment

http://stackoverflow.com/a/25008379
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38886169
has comment: http://stackoverflow.com/comment/38886490
type: Answer
has comment: http://stackoverflow.com/comment/38886262
has comment: http://stackoverflow.com/comment/38887234
accepted answer of: http://stackoverflow.com/q/25008310
answers question: http://stackoverflow.com/q/25008310
has body: The javadoc says - Static methods, which have the static modifier in their declarations, should be invoked with the class name, without the need for creating an instance of the class, as in ClassName.methodName(args) So you have to change String s1 = getInput("Enter a numeric value: "); String s2 = getInput("Enter a numeric value: "); to String s1 = Menu.getInput("Enter a numeric value: "); String s2 = Menu.getInput("Enter a numeric value: "); Moreover you can also refer to static methods with an object reference like instanceName.methodName(args) Edit: Menu class class Menu { public static String getInput(String prompt) { String user; Scanner scan = new Scanner(System.in); System.out.println(prompt); return user = scan.nextLine(); } } Driver class public class Driver { public static void main(String[] args) { String user = Menu.getInput("Enter: 1=Add 2=Subtract 3=Multiply 4=Divide"); String s1 = Menu.getInput("Enter a numeric value: "); String s2 = Menu.getInput("Enter a numeric value: "); //rest of the codes same } }
has comment: http://stackoverflow.com/comment/38886959
score: 0

http://stackoverflow.com/comment/38817663
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24957617
has text: @mark: Eventually when the action occurs it disappears within no time.. Also if i am trying multiple testcases(mentioned in testNG.xml) one or the other two gets failed..
score: 0

http://stackoverflow.com/comment/38751159
has text: `new Object()` gives you an Object at runtime without reflection...
type: AnswerComment
comment on: http://stackoverflow.com/a/24936691
score: 0
type: Comment

http://stackoverflow.com/comment/38925973
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25019324
has text: I've been searching a lot for a framework to implement the Gossip/Discovery approach. Do you have a recommendation? P2P would be quite beneficial for the requirements :)
score: 0

http://stackoverflow.com/a/25023677
accepted answer of: http://stackoverflow.com/q/25023558
has comment: http://stackoverflow.com/comment/38916244
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38917025
has body: Your method variable Altitude is local to the method. This means its recreated and reassigned value every time you call the method. In java all parameters to a method are passed by value, which means the change in the parameter inside the the method is not visible outside it, basically it creates a copy of the parameter when invoked. You need to make it an instance variable by defining in the class not inside any method. same goes for the other variables that you want to be changed every time you call the method. import java.util.Scanner; public class Pilot { public static void main(String args[]) { Scanner kb = new Scanner(System.in); double Altitude = 10.0; String Name = "Eagle"; double fuelLeft = 1000.0; int shipWeight = 400; int maxThrust = 10000; int verticalSpeed = 0; double efficiency = 0; int maxFuel = 400; //max fuel flow LunarLander lander = new LunarLander(Altitude, verticalSpeed, fuelLeft); // create a LunarLander object System.out.println("Initial data: "); System.out.println("Altitude = " + Altitude); System.out.println("Speed = " + verticalSpeed); System.out.println("Fuel = " + fuelLeft); while (lander.crashed() != true &amp;&amp; Altitude &gt; 0) { System.out.println("Please enter a time in seconds: "); int time = kb.nextInt(); System.out.println("Please enter a fuel rate between 0 and 1"); double inputFuelRate = kb.nextDouble(); System.out.println("Input time increment: " + time); System.out.println("Input fuel rate: " + inputFuelRate); lander.move(efficiency, maxFuel, time, inputFuelRate); System.out.println(lander.toString()); } } } And the LunarLander class public class LunarLander { double Altitude; double verticalSpeed; double fuelLeft; public LunarLander(double Altitude, double verticalSpeed, double fuelLeft){ this.Altitude = Altitude; this.verticalSpeed = verticalSpeed; this.fuelLeft = fuelLeft; } public void move(double efficiency, int maxFuel, int time, double inputFuelRate) { // formulas to change outputs double velocity = time * (efficien…
has comment: http://stackoverflow.com/comment/38915606
answers question: http://stackoverflow.com/q/25023558
type: Answer
has comment: http://stackoverflow.com/comment/38915719

http://stackoverflow.com/comment/38756759
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24939360
type: Comment
has text: Did you mistype or are you placing "package BmClasses;" (B and C capitalized) at the top of your two other classes? It needs to be "package bmclasses;" (lowercase)

http://stackoverflow.com/comment/38902556
comment on: http://stackoverflow.com/q/25016172
has text: If you write the number using `outputStream.writeObject(profiles.size())` you are writing an object and have to read it with a corresponding `int size=(Integer)inputStream.readObject();`. Otherwise you have to use `writeInt` and `readInt` for storing it as a primitive `int` value. But simply writing the `List` is the better choice. You can also write an array of objects to get rid of the unchecked cast warning in the read code.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38817481
comment on: http://stackoverflow.com/a/24970437
type: AnswerComment
score: 0
type: Comment
has text: I know about autoplay disabled. On manual click video just disappears - white rectangle and no internet activity. Webpage works with Dolphin browser, which is using WebKit too, and in desktop browser as well.

http://stackoverflow.com/comment/38824789
score: 0
type: Comment
type: QuestionComment
has text: post the fragment class
comment on: http://stackoverflow.com/q/24975832

http://stackoverflow.com/q/24949028
has comment: http://stackoverflow.com/comment/38775127
has title: How to run my Java Selenium program automatically every hour
has comment: http://stackoverflow.com/comment/38775085
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38775198
tagged with: java
tagged with: selenium
tagged with: eclipse
downvote count: 1
type: Question
tagged with: testing
tagged with: automation
has comment: http://stackoverflow.com/comment/38775165
score: -1
has comment: http://stackoverflow.com/comment/38775036
has answer: http://stackoverflow.com/a/24951788
upvote count: 0
answer count: 1
has body: I have developed a test case in Java and Selenium webdriver. I have developed it in Eclipse IDE. Can you please tell me if i want to execute this code every hour how should i do it. I dont use maven or anything else. And i have no idea how they work. All i do is click on the execute button in eclipse IDE. But i want to do this automatically instead of click on execute button in eclipse. Please suggest. This is wat i want to execute every hour: wd.get("http://www.google.com"); Thread.sleep(100); WebElement logo = wd.findElement(By.id("abc")); logo.click(); try { getscreenshot(); } catch (Exception e) { // TODO Auto-generated catch block System.out.println("Found an exception"); } } static SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMdd hh mm ss a"); public static void getscreenshot() throws Exception { Calendar now = Calendar.getInstance(); Robot robot = new Robot(); BufferedImage screenShot = robot.createScreenCapture(new Rectangle(Toolkit.getDefaultToolkit().getScreenSize())); ImageIO.write(screenShot, "JPG", new File("G:\\Screen Output"+formatter.format(now.getTime())+".jpg")); System.out.println(formatter.format(now.getTime())); } }
favorite count: 0
accepted answer: http://stackoverflow.com/a/24951788

http://stackoverflow.com/a/25044547
upvote count: 1
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/24955899
has body: There's a way to do this by modifying the 'Example' class used to create query criteria. Suppose you have a Mybatis domain object called Label. This will have an associated LabelExample. Notice I've added the 'binary' qualifier to the generated criteria method. This appears to do the job for me, and results in a case sensitive query. public class LabelExample { ... /** * This class was generated by MyBatis Generator. This class corresponds to the database table Label * @mbggenerated */ protected abstract static class GeneratedCriteria { public Criteria andLabelNameEqualTo(String value) { addCriterion("binary Label_Name =", value, "labelName"); return (Criteria) this; } ... }
downvote count: 0
answers question: http://stackoverflow.com/q/24955899
score: 1

http://stackoverflow.com/comment/38760721
score: 0
comment on: http://stackoverflow.com/q/24916866
type: QuestionComment
type: Comment
has text: @CodeChimp Console dump results from upper code block with argument string filename being "SimpleEmployeeReport": `f.canRead(): true ---f.exists(): true --- f.isFile(): true --- getJavaIoTmpDir: C:\Users\<MyUsername>\AppData\Local\Temp --- filename + .jasper: SimpleEmployeeReport.jasper --- f.getAbsolutePath(): C:\Users\<MyUsername>\AppData\Local\Temp\SimpleEmployeeReport.jasper --- f.getCanonicalPath(): C:\Users\<MyUsername>\AppData\Local\Temp\SimpleEmployeeReport.jasper` I stepped through the lower code block, and resourcePath evaluates to `C:\Users\<MyUsername>\AppData\Local\Temp`

http://stackoverflow.com/q/24974099
tagged with: swing
has comment: http://stackoverflow.com/comment/38821930
has answer: http://stackoverflow.com/a/24974504
has title: Panel that will display pictures when jlable is moused over
tagged with: java
tagged with: jpanel
type: Question
upvote count: 2
answer count: 1
has body: I would like to have jpanel1 invisible until one of the jlabels is moused over. JPanel1 must then become visible and a JLable(called jLabel1) must set it's image to the one of the JLabel that is being moused over. public GUI() { initComponents(); jPanel1.setVisible(false); for(int i =4; i&lt;12;i++) { JLabel l = new JLabel(); l.setIcon(new ImageIcon(i+".jpg")); p1.add(l); } for(int i =12; i&lt;20;i++) { JLabel l = new JLabel(); l.setIcon(new ImageIcon(i+".jpg")); p2.add(l); } } below are links to 2 pictures of my program, one in the design view showing the side panel and the other of the actual program when it is running. I would like for the JPanel on the left to become visible when the user mouses over one of the jlabels in the picture grid(see screenshot of running program). The jLabel at the top of the panel on the left must set its image to the image which the user mousing over in the image grid.
score: 0
downvote count: 2
tagged with: user-interface
favorite count: 0
has comment: http://stackoverflow.com/comment/38821725
has comment: http://stackoverflow.com/comment/38822355
tagged with: jlabel
type: UnansweredQuestion

http://stackoverflow.com/q/25031563
tagged with: android-spinner
has body: I was trying to populate the spinner data by calling loadSpinnerData() but it gave NullPointerException error. This is the code for MyLayoutOperation class:- public class MyLayoutOperation extends Activity{ static Spinner products; public static void display(final Activity activity, Button btn) { btn.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { LinearLayout scrollViewlinerLayout = (LinearLayout) activity.findViewById(R.id.linearLayoutForm); java.util.ArrayList&lt;String&gt; msg = new ArrayList&lt;String&gt;(); for (int i = 0; i &lt; scrollViewlinerLayout.getChildCount(); i++) { LinearLayout innerLayout = (LinearLayout) scrollViewlinerLayout.getChildAt(i); products = (Spinner) innerLayout.findViewById(R.id.spinner1); EditText edit = (EditText) innerLayout.findViewById(R.id.editDescricao); msg.add(products.getSelectedItem().toString()); msg.add(edit.getText().toString()); } Toast t = Toast.makeText(activity.getApplicationContext(), msg.toString(), Toast.LENGTH_SHORT); t.show(); } }); } public static void add(final Activity activity, ImageButton btn) { final LinearLayout linearLayoutForm = (LinearLayout) activity.findViewById(R.id.linearLayoutForm); btn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { final LinearLayout newView = (LinearLayout)activity.getLayoutInflater().inflate(R.layout.rowdetail, null); newView.setLayoutParams(new LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT)); try { MyLayoutOperation mlo = new MyLayoutOperation(); loadSpinnerData(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } ImageButton btnRemove = (ImageButton) newView.findViewById(R.id.btnRemove); btnRemove.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { linearLayoutForm.removeView(newView); } }); linearLayoutForm.addView(newView); } }); } private void loadSpinnerData() throws IOException { // databas…
has comment: http://stackoverflow.com/comment/38930598
tagged with: nullpointerexception
has comment: http://stackoverflow.com/comment/38929579
type: Question
tagged with: android
has answer: http://stackoverflow.com/a/25031649
has comment: http://stackoverflow.com/comment/38930458
accepted answer: http://stackoverflow.com/a/25199157
possible better answer: http://stackoverflow.com/a/25031649
tagged with: dynamic
has comment: http://stackoverflow.com/comment/38929695
score: 0
has comment: http://stackoverflow.com/comment/38929607
answer count: 2
has title: NullPointerException when creating new instance for DBHelper class
tagged with: java
has comment: http://stackoverflow.com/comment/38929615
has answer: http://stackoverflow.com/a/25199157
type: AnsweredQuestion

http://stackoverflow.com/a/63853242
type: Answer
answers question: http://stackoverflow.com/q/24974725
upvote count: 4
score: 4
downvote count: 0
has body: /usr/lib/jvm/java-8-openjdk-amd64/ This is what worked in my case.

http://stackoverflow.com/q/24923880
has body: I want to access linux shell and put command into it from my CMD(command prompt) windows. Below is my code to open linux shell from cmd. Runtime.getRuntime().exec(new String[] {"cmd", "/c", "start", "accessLinux.bat"}); I have try putting command after accessLinux.bat, but the compiler will join my accesLinux.bat and argument1 as one statement instead of treat it seperately eventhough i have put double quote. Runtime.getRuntime().exec(new String[] {"cmd", "/c", "start", "\""accessLinux.bat argument1 + "\""}); below is my accesslinux.bat @echo off set PATH=C:\;%PATH% set CYGWIN=binmode tty set TERM=ansi set USERNAME=user set HOME=C:\ set RSYNC_RSH=ssh.exe ssh -o StrictHostKeyChecking=no user@address %1
has comment: http://stackoverflow.com/comment/38727465
score: 0
has comment: http://stackoverflow.com/comment/38727501
answer count: 1
has comment: http://stackoverflow.com/comment/38727362
has answer: http://stackoverflow.com/a/24927144
type: AnsweredQuestion
tagged with: java
has title: How to add command to Linux shell after we open it from window command prompt?
type: Question
accepted answer: http://stackoverflow.com/a/24927144

http://stackoverflow.com/comment/38709921
type: QuestionComment
has text: How is `something.config` accessed in the application?
score: 0
type: Comment
comment on: http://stackoverflow.com/q/24914555

http://stackoverflow.com/q/24969514
score: 1
favorite count: 0
tagged with: selenium-webdriver
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24976058
tagged with: java
tagged with: selenium
upvote count: 1
accepted answer: http://stackoverflow.com/a/24976058
tagged with: webdriver
type: Question
has title: Designing page object structure for selenium tests. Inheriting from WebElement causing problems
has body: I'm trying to design some page objects and have some issues with the overall design. I know a common problem in tests is figuring out whether an element exists, and the solution is to use a try/catch or to use findElements(...) and assert if the size of the resulting list is 0. I'd like to avoid these try/catches in all my tests. Is it possible to use inheritance to have the try/catch in a super class, making the tests cleaner? I'd like the method to return null if the element doesn't exist, then I can just assertNotNull(...) in the test. Here's a method from a page object in my current solution: public WebElement getRegisterLink(){ List&lt;WebElement&gt; list = driver.findElements(By.linktext("Register")); if(list.size() == 0){ return null; } return list.get(0); } The problem with this is that there is a lot of similar repeated code. My getLoginButton(), getSomePageLink(), etc. look the same. Here is one idea I've had... public abstract class MyCompanyElement implements WebElement{ WebElement element; public MyCompanyElement(WebElement element){ this.element = element; } @Override public void clear() { element.clear(); } @Override public void click() { element.click(); } @Override public MyCompanyElement findElement(By arg0) { try{ MyCompanyElement e = (MyCompanyElement) element.findElement(arg0); return e; } catch (NoSuchElementException ex){ return null; } } @Override public List&lt;MyCompanyElement&gt; findElements(By arg0) { List&lt;MyCompanyElement&gt; list = new ArrayList&lt;MyCompanyElement&gt;(); for(WebElement e : element.findElements(arg0)){ list.add((MyCompanyElement) e); } return list; } //Rest of the methods here which just call the methods of element } I then have a BasePage class which all page objects will extend. public abstract class BasePage { MyCompanyElement element; public BasePage(WebDriver driver){ element = (MyCompanyElement) driver.findElement(By.tagName("html")); } //More methods here } The page objects then have methods like getLoginButt…
downvote count: 0
answer count: 1

http://stackoverflow.com/comment/38751501
comment on: http://stackoverflow.com/q/24936572
has text: \n is here a real string from a connector. but the gui does afterwords use it as newline. but you can ignore that. is just an example
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38754090
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24936873
has text: Yes. Actually I am very new to AJAX and Javascript. I am not sure how to get 10 articles in a single call and then set them in HTML. Any help would be appreciated.
score: 0

http://stackoverflow.com/a/24971207
accepted answer of: http://stackoverflow.com/q/24959111
answers question: http://stackoverflow.com/q/24959111
has comment: http://stackoverflow.com/comment/56990469
type: Answer
score: 4
has comment: http://stackoverflow.com/comment/38979337
has body: This exception usually happens when there is a dependency conflict in the build. Try disabling the apt execution and see if there are other issues in the build.
upvote count: 4
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/38796073
type: Comment
type: QuestionComment
has text: my bad, input shouldnt be final, and no, I'm not getting any errors in Logcat
comment on: http://stackoverflow.com/q/24960455
score: 0

http://stackoverflow.com/comment/39008257
type: QuestionComment
comment on: http://stackoverflow.com/q/25053506
score: 0
has text: any one having idea regarding this issue?
type: Comment

http://stackoverflow.com/comment/38865222
has text: I can't cite it as a duplicate, but see: [Java sign doesn't equal openssl dgst](http://stackoverflow.com/questions/21968490/java-sign-doesnt-equal-openssl-dgst).
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24994885
score: 0

http://stackoverflow.com/comment/38764396
type: AnswerComment
comment on: http://stackoverflow.com/a/24943340
has text: I'm just following his example. :)
type: Comment
score: 0

http://stackoverflow.com/q/24964856
answer count: 1
has answer: http://stackoverflow.com/a/24964961
has comment: http://stackoverflow.com/comment/38807973
type: UnansweredQuestion
has title: Jtable not populated for the one record
tagged with: java
tagged with: mysql
tagged with: swing
type: Question
tagged with: jtable
score: 0
tagged with: sql
has body: I am working on the problem where i need to get data from the database and then populate in the jtable. I am using the Query with like statement. The problem is when query match with one record, i am not able to see any record in the table . Here is my code. ResultSet rs=null; String customer_name = null; System.out.println("In the verfiy login"); try { Connect_MYSQL object = new Connect_MYSQL(); conn = object.getConnection(); } catch (Exception e) { System.out.println("Error while getting connection"); } try { Statement statement = (Statement) conn.createStatement(); String Query = "Select * from login where username like'%"+ name+"%' or usertype like'%"+name+"%'"; System.out.println(Query); rs = statement.executeQuery(Query); if (rs.next()) { System.out.println("INsie Rs"); return rs; } } catch (Exception e) { System.out.println(e.getMessage()); } return rs; and how i am using in JTABLE DataBase_Work object=new DataBase_Work(); ResultSet rs2=object.Search_User(name); String namee=rs2.getString("username"); System.out.println(namee+"User name"); if(rs2==null) { JOptionPane.showMessageDialog(null, "No Record Found Against the value", " Not Record Found", JOptionPane.ERROR_MESSAGE); } else { Show_all_User.setModel(DbUtils.resultSetToTableModel(rs2)); }

http://stackoverflow.com/a/25025100
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38921628
type: Answer
accepted answer of: http://stackoverflow.com/q/25024663
has body: It depends what kinds of changes you make to schema. If you make changes to schema.xml that apply to existing documents, you would need to reindex for those changes to be applied to your Solr index. You can change schema.xml and not reindex, but then at that point your index can become inconsistent, because new documents that you add to index will have updates. In your example above, if you removed charFilter from schema.xml and do not reindex, the old documents already in the index will have charFilter applied to them while new ones getting indexed going forward would not have charFilter, so there will be an inconsistency. So it is recommended to reindex documents if changes apply to existing documents[already in index]. There are very rare use cases in which reindex is not required.
answers question: http://stackoverflow.com/q/25024663
score: 0
has comment: http://stackoverflow.com/comment/38921014

http://stackoverflow.com/comment/38838698
score: 0
type: Comment
type: QuestionComment
has text: @RyanJ - I will not use nextInt because i want to check if the user enters an exit string. Hence, take string only.
comment on: http://stackoverflow.com/q/24983091

http://stackoverflow.com/q/24943648
downvote count: 0
has answer: http://stackoverflow.com/a/24952093
favorite count: 0
tagged with: cassandra
has body: I am having trouble puting those single quotes for ASCII/Timestamp columns and not puting for other types like Int, Decimal, Boolean etc. The data comes from another db/table, which is a sql. I have all the column data as string. I don't want to format each column data to check null values and then decide to put quote or not. Is it possible to pass in insert data value without giving single quotes, using prepared statement or whatever.
type: AnsweredQuestion
score: 3
accepted answer: http://stackoverflow.com/a/24952093
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/38769530
tagged with: prepared-statement
has comment: http://stackoverflow.com/comment/38775756
type: Question
tagged with: cql
possible better answer: http://stackoverflow.com/a/24943802
has title: Inserting data in cassandra without puting in single quotes using cql java driver
linked to: http://stackoverflow.com/q/60174
has answer: http://stackoverflow.com/a/24943802
answer count: 2

http://stackoverflow.com/a/24920742
answers question: http://stackoverflow.com/q/24920110
type: AcceptedAnswer
has body: Try to replaceAll whitespaces (\s) to regex or sign (|). Now you can simply use this pattern. String test = "John Doe"; String regex = test.replaceAll("\\s", "|"); Pattern pattern = Pattern.compile(regex, Pattern.CASE_INSENSITIVE); Matcher matcher = pattern.matcher("John"); System.out.println(matcher.find()); System.out.println(matcher.start()); matcher = pattern.matcher("xJohn"); System.out.println(matcher.find()); System.out.println(matcher.start()); If you want to not match xJohn on search of John then change: String regex = "^" + test.replaceAll("\\s", "|") +"$";
downvote count: 0
score: 1
type: Answer
upvote count: 1
accepted answer of: http://stackoverflow.com/q/24920110

http://stackoverflow.com/comment/38801279
comment on: http://stackoverflow.com/q/24962424
has text: Figured out a way: Using base64 strings (as in my very first try, before I tried to transfer bytes directly, because nothing worked). So, as you can see in my EDIT2, base64 strings doesn't work either. And based on base64 strings the BigInteger-values of the modulus are different in c# and java .
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38931806
score: 0
type: Comment
has text: This removed .do from url but I want to display that page name, On which user is forwarded.In this case it show actioname in url
comment on: http://stackoverflow.com/a/25032408
type: AnswerComment

http://stackoverflow.com/comment/38719840
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24919751
score: 2
has text: You should look into using a hash such as md5

http://stackoverflow.com/comment/38813924
has text: Could this be occurring when your interval spans the beginning or the end of daylight savings time?
comment on: http://stackoverflow.com/q/24969331
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25054935
type: Question
has comment: http://stackoverflow.com/comment/38973957
has answer: http://stackoverflow.com/a/25055582
has body: I am trying to write a Java code where I need to fetch data from a RESTful Api using Apache HttpClient. My web server has a self signed certificate. The code I have used is as follows: public class WebClientDevWrapper { public static HttpClient wrapClient(HttpClient base) { try { ClientConnectionManager ccm = base.getConnectionManager(); SSLSocketFactory sslsf = new SSLSocketFactory(new TrustSelfSignedStrategy()); Scheme https = new Scheme("https", 444, sslsf); ccm.getSchemeRegistry().register(https); return new DefaultHttpClient(ccm, base.getParams()); } catch (Exception ex) { ex.printStackTrace(); return null; } } public static void main(String[] args) throws ClientProtocolException, IOException{ HttpClient client ; client = new DefaultHttpClient(); client = WebClientDevWrapper.wrapClient(client); HttpGet request = new HttpGet("https://localhost/restapi"); HttpResponse response = client.execute(request); BufferedReader rd = new BufferedReader (new InputStreamReader(response.getEntity().getContent())); String line = ""; while ((line = rd.readLine()) != null) { System.out.println(line); } } } On running this code, I am getting the following error: "javax.net.ssl.SSLException: Certificate for doesn't contain CN or DNS subjectAlt" Please help.
has comment: http://stackoverflow.com/comment/38973853
score: 0
tagged with: rest
answer count: 1
tagged with: apache-httpclient-4.x
has title: Error while trying to do GET using Apache HttpClient in Java
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/25055582

http://stackoverflow.com/q/25050957
has answer: http://stackoverflow.com/a/25051109
type: Question
has answer: http://stackoverflow.com/a/25051132
possible better answer: http://stackoverflow.com/a/25051132
score: 0
answer count: 2
accepted answer: http://stackoverflow.com/a/25051109
tagged with: jstack
has title: possible to get the calling stack of a specific thread of a java app?
has comment: http://stackoverflow.com/comment/38966456
has body: My java app has over 100 threads, each thread is doing similar thing. using jstack could print the stack for all threads, but there are too many information, is it possible to print the stack of a specific thread of a java? e.g only print the thread whose id is 100 of a java app.
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/comment/38996434
type: AnswerComment
has text: @Geek I like to make the parallel with ambiguity with method overloading.
type: Comment
score: 1
comment on: http://stackoverflow.com/a/25066733

http://stackoverflow.com/comment/38854942
has text: Also note that a transaction is not useful, if you only perform a single command on a db. A transaction comes to help when you perform more operations: CONFIRM them all or FAIL them all.
type: Comment
score: 0
comment on: http://stackoverflow.com/a/24991823
type: AnswerComment

http://stackoverflow.com/q/24971385
tagged with: java
answer count: 2
has comment: http://stackoverflow.com/comment/38816846
has answer: http://stackoverflow.com/a/24973982
possible better answer: http://stackoverflow.com/a/24971833
has comment: http://stackoverflow.com/comment/38816857
has body: I developed some android program, but it throws NLE on android 4.4.2 and works well on android 4.1.2. I think the problem is : setContentView(R.layout.drawerlayout); but my drawerlayout is OK with no errors. partly code: @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); //setContentView(R.layout.activity_main); setContentView(R.layout.drawerlayout); if (android.os.Build.VERSION.SDK_INT &gt; 9) { StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder() .permitAll().build(); StrictMode.setThreadPolicy(policy); } SharedPreferences pref = getApplicationContext().getSharedPreferences("setting", 0); // 0 - for private mode login=pref.getBoolean("loged_in", false); Drawable d=getResources().getDrawable(R.drawable.action_bar_bg); getActionBar().setBackgroundDrawable(d); try { catnum = 1; addcat("دسته بندی ها",0); new CateFetch().execute("a","c", "b"); mTitle = mDrawerTitle = getTitle(); mPlanetTitles = arr;// getResources().getStringArray(R.array.planets_array); mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); mDrawerList = (ListView) findViewById(R.id.left_drawer); } catch (Exception E) { } // set a custom shadow that overlays the main content when the drawer opens mDrawerLayout.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START); // set up the drawer's list view with items and click listener mDrawerList.setAdapter(new ArrayAdapter&lt;String&gt;(this, R.layout.drawer_list_item, mPlanetTitles)); mDrawerList.setOnItemClickListener(new DrawerItemClickListener()); // enable ActionBar app icon to behave as action to toggle nav drawer getActionBar().setDisplayHomeAsUpEnabled(true); getActionBar().setHomeButtonEnabled(true); // ActionBarDrawerToggle ties together the the proper interactions // between the sliding drawer and the action bar app icon mDrawerToggle = new ActionBarDrawerToggle( this, /* host Activity */ mDrawerLayout, /* DrawerLayout object */ R.drawable.ic_drawer, /* nav drawer …
downvote count: 0
has answer: http://stackoverflow.com/a/24971833
accepted answer: http://stackoverflow.com/a/24973982
favorite count: 0
has comment: http://stackoverflow.com/comment/38816677
has comment: http://stackoverflow.com/comment/38816552
tagged with: nullpointerexception
has comment: http://stackoverflow.com/comment/38816762
tagged with: android
has comment: http://stackoverflow.com/comment/38816411
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38816575
upvote count: 2
type: Question
has comment: http://stackoverflow.com/comment/38816782
has title: NPE in android layout

http://stackoverflow.com/a/24960762
score: 1
upvote count: 1
downvote count: 0
answers question: http://stackoverflow.com/q/24960647
type: Answer
has body: $("#identity").click(function(e){ $("#fromfrancetoggle").toggle(); $("#lamiettetoggle").toggle(); $(this).toggleClass('active'); e.preventDefault(); });

size
type: Tag
tags question: http://stackoverflow.com/q/24967809
tag name: size
tags question: http://stackoverflow.com/q/25066106

http://stackoverflow.com/comment/38760028
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24941171
has text: Do you know for a fact that the Android device can route network traffic to the server in question? Does the code work with some other ftp server on the public internet, or does it only seem to work with http ?

http://stackoverflow.com/comment/38919906
type: QuestionComment
comment on: http://stackoverflow.com/q/25026084
score: 1
has text: Is your `Hello.java` in the package `com.example.pretty`? If Yes, then use the link given by @panini to go debug the stack trace step by step.
type: Comment

http://stackoverflow.com/q/25043564
tagged with: java
score: 0
tagged with: gson
has body: I am having an issue when I sent data via POST using jquery.ajax and try to read the value from the HttpServletRequest in java. I am using jdk6 jboss-4.0.3 Struts 1 and for ajax I am using GSON and jquery in the client side Here is my code : JSP jQuery.ajax({ url:'relatorioVolumenNegocio.do?dispatch=changeGraphs', contentType: "application/x-www-form-urlencoded", type: "POST", data: { values: value }, success: function(data){ //do some stuff } }); The JSON value contains the following data: In the browser: [Object { indicador=0, descripcion="Comércio a retalho de c...l para veículos a motor", importe=65}, Object { indicador=1, descripcion="Fundos de pensões", importe=171}, Object { indicador=2, descripcion="Transportes por condutas (pipelines)", importe=0}, 321 more...] (I know is a bunch of data...) Here I can see all the JSON data perfectly, but in the server side I get only this: {"graphData":[{"indicador":51,"descripcion":"Comércio de veículos automóveis","importe":974},{"indicador":15,"descripcion":"Actividades imobiliárias por conta própria","importe":967},{"indicador":140,"descripcion":"Consultoria em equipamento informático","importe":924},{"indicador":308,"descripcion":"Horticultura e produtos de viveiro","importe":881},{"indicador":197,"descripcion":"Comércio por grosso de materiais de construção (excepto madeira) e equipamento sanitário","importe":831},{"indicador":180,"descripcion":"Comércio por grosso de minérios e de metais","importe":792},{"indicador":123,"descripcion":"Fabricação de tijolos, telhas e de outros produtos de barro para a construção","importe":790},{"indicador":20,"descripcion":"Comércio a retalho de ferragens, tintas, vidros, equipamento sanitário, ladrilhos e similares","importe":749},{"indicador":311,"descripcion":"Administração pública ? actividades económicas","importe":742},{"indicador":209,"descripcion":"Agentes do comércio por grosso de produtos alimentares, bebidas e tabaco","importe":714},{"indicador":279,"descripcion":"Comérci…
tagged with: getparameter
has comment: http://stackoverflow.com/comment/38981439
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38952559
tagged with: servlets
tagged with: truncate
type: Question
has comment: http://stackoverflow.com/comment/38953218
has comment: http://stackoverflow.com/comment/38959180
has title: HttpServletRequest.getParameter() truncates the value sent through jQuery.ajax

http://stackoverflow.com/q/24934528
has answer: http://stackoverflow.com/a/24968281
type: Question
has title: How to redirect Saxon 9-4ee schema validation messages to file using cmd interface only?
score: 0
tagged with: batch-file
answer count: 1
has body: I'm using a batch script to process multiple XML files. As part of the process I run Saxon 9.4 enterprise validator. This works fine and I can use %ERRORLEVEL% to determine success or error. In case of an error validation messages are printed on screen. The problem is that when I try to redirect the validation messages to a log file, the logfile is always empty and the messages still appear on screen instead of the log file. I have tried two methods so far and can't think of anything else to try. I have no java programming experience and cannot write my own stream handler. This is what I've tried so far but no success: SETLOCAL ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION set CLASSPATH=%CD%\system\saxon9ee;%CD%\system\saxon9ee\saxon9ee.jar;%CD%\system\saxon9ee\resolver.jar java.exe com.saxonica.Validate ^ -x:org.apache.xml.resolver.tools.ResolvingXMLReader ^ -y:org.apache.xml.resolver.tools.ResolvingXMLReader ^ -r:org.apache.xml.resolver.tools.CatalogResolver ^ --StandardErrorOutputFile:error.txt "input.xml" Above creates a log file but it's always empty. I presume validation errors are not classed as 'error' internally. I have also tried various combinations of command redirection operators but no luck either java.exe com.saxonica.Validate ^ -x:org.apache.xml.resolver.tools.ResolvingXMLReader ^ -y:org.apache.xml.resolver.tools.ResolvingXMLReader ^ -r:org.apache.xml.resolver.tools.CatalogResolver input.xml &gt;&gt; validation.log 2&gt;&amp;1 Is there another way to catch validation messages when running java saxon from the command line/batch script? Thanks.
type: UnansweredQuestion
tagged with: java
tagged with: saxon

http://stackoverflow.com/comment/38977469
type: Comment
has text: be carefull: input.substring(0) will not return the first character but will return the string starting at position 0 = complete string. If you want to do it with substring you have to use input.substring(0,1);
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25056137

http://stackoverflow.com/comment/38754263
comment on: http://stackoverflow.com/a/24931644
type: AnswerComment
score: 0
type: Comment
has text: "the problem isn't in my code" -- great story bro'. Seriously though, even if you believe there is nothing wrong with your code, it would be helpful for others to see how you're calling these routines, and might help to provide further insight into your problems.

http://stackoverflow.com/q/24974816
tagged with: java
has title: regex for numerics and decimals in java
accepted answer: http://stackoverflow.com/a/24974834
type: Question
upvote count: 4
downvote count: 0
score: 4
possible better answer: http://stackoverflow.com/a/24974997
answer count: 3
tagged with: validation
has answer: http://stackoverflow.com/a/24974997
favorite count: 0
has answer: http://stackoverflow.com/a/24974834
has body: Need a regex that allows the following valid values.(only decimals and numbers are allowed) valid : .1 1.10 1231313 0.32131 31313113.123123123 Invalid : dadadd.31232 12313jn123 dshiodah
tagged with: regex
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24974833

http://stackoverflow.com/comment/38940479
has text: But in case of thread made using runnable it prints upto 3 while in case of extending thread it prints upto 1 as expected. The runnabel cases t1 and t2 seems to be confusing me.
comment on: http://stackoverflow.com/a/25037317
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/38899518
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25007457
type: QuestionComment
has text: and I left out the dependency property as well: <org.springframework-version>4.0.3.RELEASE</org.springframework-version>

http://stackoverflow.com/q/24978886
accepted answer: http://stackoverflow.com/a/24978959
score: 0
tagged with: nullpointerexception
tagged with: file-io
answer count: 1
has title: write java.util.logging to a file
tagged with: logging
has answer: http://stackoverflow.com/a/24978959
type: AnsweredQuestion
tagged with: java
has body: While I'm aware of Log4J, and I'm sure there are others, I'm using java.util.logging to write to a file. The error originates in nextTitleActionPerformed which is near the bottom of the soure code. I've looked at a few questions on SO, but must be misunderstanding the mechanism for logging to a file. However, logging to a file results in a NullPointerException as below: BUILD SUCCESSFUL Total time: 3 seconds Jul 27, 2014 12:21:50 AM net.bounceme.dur.client.gui.LoggingGUI &lt;init&gt; INFO: starting log.. Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException at net.bounceme.dur.client.gui.LoggingGUI.nextTitleActionPerformed(LoggingGUI.java:103) at net.bounceme.dur.client.gui.LoggingGUI.access$000(LoggingGUI.java:10) at net.bounceme.dur.client.gui.LoggingGUI$2.actionPerformed(LoggingGUI.java:56) at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2018) at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2341) at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402) at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259) at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252) at java.awt.Component.processMouseEvent(Component.java:6505) at javax.swing.JComponent.processMouseEvent(JComponent.java:3311) at java.awt.Component.processEvent(Component.java:6270) at java.awt.Container.processEvent(Container.java:2229) at java.awt.Component.dispatchEventImpl(Component.java:4861) at java.awt.Container.dispatchEventImpl(Container.java:2287) at java.awt.Component.dispatchEvent(Component.java:4687) at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4832) at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4492) at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4422) at java.awt.Container.dispatchEventImpl(Container.java:2273) at java.awt.Window.dispatchEventImpl(Window.java:2719) at java.awt.Component.disp…
type: Question
tagged with: java.util.logging

http://stackoverflow.com/a/25013004
type: Answer
has body: You can call Jasper reports from Jasper server to your projects/websites by using Visualize.js concept.In this case you can pass your parameter from application to jasperreports and display it. http://community.jaspersoft.com/project/visualizejs Including Visualize.js file Loading... Visualize.js part BIF.init({ domain: 'http:/(Your Jasperserver Domain)/jasperserver-pro/', username: 'jasperadmin', password: 'jasperadmin', mods: ['reports'] },function(Reports) { mReport = Reports.open({ uri:'/public/Reports/Report1', container: document.getElementById('container'), inputParameters: { Id:'037e6b40-88e4-11e3-80d4-2673d3ec42cd', Range:100, ProfileId:'037des70-88e4-11e3-80d4-2673d3ec42cd', Theme:'test' }, onReportFinished: function() { $('#overlay').hide(); } }); }); Hope this will Help you!!!!
score: 0
answers question: http://stackoverflow.com/q/24996914

http://stackoverflow.com/comment/38878551
type: Comment
type: QuestionComment
has text: updated with more details.
comment on: http://stackoverflow.com/q/25001914
score: 0

http://stackoverflow.com/comment/38873413
score: 0
type: AnswerComment
type: Comment
has text: wrong. It's perfectly correct if your class implements that interface.
comment on: http://stackoverflow.com/a/25001763

http://stackoverflow.com/comment/38850939
type: AnswerComment
comment on: http://stackoverflow.com/a/24986554
has text: Thx for your answer, I will try this. I thought I need "src." because the packages are placed in the src folder in eclipse
score: 0
type: Comment

http://stackoverflow.com/a/25092890
accepted answer of: http://stackoverflow.com/q/24972091
has body: I finally managed to resolve the reported errors. This is what I followed: 1) My eclipse was 64-bit version, but it was run using a 32-bit JVM. I changed eclipse.ini to use 64-bit JVM. 2) Deleted the project from my workspace. 3) Cleaned eclipse project files using mvn eclipse:clean. And created the project files again using mvn eclipse:eclipse 4) Imported the project as General &gt; Existing project in eclipse 5) Built the project This time, there were no errors reported for Unsupported IClasspathEntry kind=4. I hope, it helps others facing the same problem. Beware of Eclipse's 32-bit / 64-bit JVM. Prefer to use the same architecture as eclipse - i.e. use 64-bit JVM if your eclipse is 64-bit.
answers question: http://stackoverflow.com/q/24972091
upvote count: 5
type: Answer
downvote count: 0
score: 5
type: AcceptedAnswer

http://stackoverflow.com/comment/38814339
has text: oh..the 1000 was just a test... it origianlly was i < values.length; @ Charlesjean i didnt work with fragemtns yet. Would it be better with fragments? The exact workflow should be like this: Login screen->news feed Topics->content of the topics
comment on: http://stackoverflow.com/q/24970171
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24991702
has body: I found a solution using JavaScript: String boolexpr1 = "(!(true||false)&amp;&amp;!((true)^(true)))" boolean result = (Boolean) new ScriptEngineManager().getEngineByName("javascript").eval(boolexpr1); Didn't expect it could be that simple.
type: Answer
accepted answer of: http://stackoverflow.com/q/24950586
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/24950586
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/24984536
answers question: http://stackoverflow.com/q/24970036
downvote count: 0
has body: JerseyTest provides enable(...) method, that gives you control over configuring values of the properties defined and described in the TestProperties class. public class MyTest extends JerseyTestNg { // rest omitted protected Application configure() { // rest omitted enable(TestProperties.LOG_TRAFFIC); enable(TestProperties.DUMP_ENTITY); } The snippet above enables test traffic logging as well as dumping the HTTP message entity as part of the traffic logging. See here for more details.
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24970036
type: Answer
score: 3
upvote count: 3

http://stackoverflow.com/a/25024094
score: 0
has body: You can use Jsoup to do this, it is a very simple to use api and there are library documentations Downlaod: http://jsoup.org/download Docs: http://jsoup.org/cookbook/introduction/parsing-a-document
type: Answer
answers question: http://stackoverflow.com/q/25023981

http://stackoverflow.com/q/24960831
has answer: http://stackoverflow.com/a/24960939
type: UnansweredQuestion
score: 1
tagged with: scala
tagged with: java
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/38817952
tagged with: playframework
answer count: 1
downvote count: 0
has body: I have a ToDoController.java and the method public static Result getAllToDos() { return ok(index.render("Your new application is also ready.")); } How can i redirect the page to ToDo.html using Play framework. I am trying to write an application using Angular/Java/Play My route file GET / controllers.Application.index() GET / controllers.Assets.at(path="/public",file="index.html") GET /todo controllers.ToDoController.getAllToDos()
favorite count: 0
tagged with: angularjs
has title: Play Framwork Java Angular - redirect to html page

http://stackoverflow.com/comment/38723971
type: QuestionComment
comment on: http://stackoverflow.com/q/24921913
has text: @ElliottFrisch it is a List<List<String>> object
type: Comment
score: 0

http://stackoverflow.com/a/25609123
score: 3
has body: I'm running into the same problem myself. It appears to be caused by this bug, and is caused an issue with Eclipse Luna and the M2E plugin: https://bugs.eclipse.org/bugs/show_bug.cgi?id=412436 Assuming you are using Luna and have M2E installed, I resolved the problem by uninstalling M2E and reinstalling using the "install new software" route rather than "marketplace". Couldn't say why, but this seems to have worked for me.
has comment: http://stackoverflow.com/comment/84494067
upvote count: 3
has comment: http://stackoverflow.com/comment/80165909
type: Answer
answers question: http://stackoverflow.com/q/25051431
downvote count: 0

http://stackoverflow.com/comment/38957340
has text: Do you mean you want to do the redirect after the link. User clicks link to taxView.do, and inside taxView.do there's a `response.sendRedirect("Annuity.do");` so there's both a click and a redirect?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25025057

task
type: Tag
tag name: task
tags question: http://stackoverflow.com/q/25058706

http://stackoverflow.com/comment/38839977
has text: What @DavidWallace said, plus: How do you know what _rectArr.length_ is right after reading the file? I wonder if an array is the best design choice here.
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/24983812
type: Comment

http://stackoverflow.com/comment/38726366
has text: @MadProgrammer How would I do that in a method? I am returning the source code from a method.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24923189
type: AnswerComment

http://stackoverflow.com/a/25000860
has comment: http://stackoverflow.com/comment/38889669
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25000590
downvote count: 0
has comment: http://stackoverflow.com/comment/38889840
has comment: http://stackoverflow.com/comment/38889773
type: Answer
has comment: http://stackoverflow.com/comment/38872941
has comment: http://stackoverflow.com/comment/38889628
upvote count: 1
accepted answer of: http://stackoverflow.com/q/25000590
has comment: http://stackoverflow.com/comment/38889682
score: 1
has body: Try this:- Toolkit.getDefaultToolkit().getImage(getClass().getResource("File dir")); if getResource doesnt work try this. public BufferedImage loadImage(String fileName){ BufferedImage buff = null; try { buff = ImageIO.read(getClass().getResourceAsStream(fileName)); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); return null; } return buff; } try something like: InputStream stream = this.getClass().getClassLoader().getResourceAsStream("/images/image.jpg"); In your JAR file, you might have a directory structure of: jt400.jar - com (class files in here) - images ----image.gif try these methods

http://stackoverflow.com/comment/39569074
score: 0
type: AnswerComment
has text: Do you mean `@ResponseBody`?
type: Comment
comment on: http://stackoverflow.com/a/25366592

http://stackoverflow.com/a/25027586
has comment: http://stackoverflow.com/comment/38927553
answers question: http://stackoverflow.com/q/25010496
type: Answer
score: 5
has comment: http://stackoverflow.com/comment/38985462
upvote count: 5
has body: The C grammar included with the ANTLR project requires preprocessed source files as input. The grammar does not perform any file inclusion, macro expansion, or any other feature provided by the preprocessor. If you do not perform preprocessing prior to using this grammar, the parse tree it produces will not be an accurate representation of the compilation unit. Note that skipping "preprocessor stuff" is not an alternative to using the preprocessor in advance, since file inclusion is only one part of the preprocessor.
downvote count: 0

http://stackoverflow.com/a/24953680
upvote count: 2
answers question: http://stackoverflow.com/q/24953606
has body: You shall write it like this: String query = "SELECT performance_rate_one, performance_rate_two, performance_rate_three, performance_rate_four, performance_rate_five FROM performance WHERE task_name =?"; Cursor cursor = db.rawQuery(query,new String[]{task_name});
downvote count: 0
type: Answer
score: 2

dicom
tag name: dicom
type: Tag
tags question: http://stackoverflow.com/q/24989404

http://stackoverflow.com/a/25039192
answers question: http://stackoverflow.com/q/25020647
type: Answer
score: 3
downvote count: 0
upvote count: 3
has body: Thanks for the tip, I got it working by overriding the call method which is able to access the client object. Then I was able to access the Address Object and return a SimpleStringProperty and update each column appropriately. addressColumn1.setCellValueFactory(new Callback&lt;CellDataFeatures&lt;Client, String&gt;, ObservableValue&lt;String&gt;&gt;() { @Override public ObservableValue&lt;String&gt; call(CellDataFeatures&lt;Client, String&gt; c) { return new SimpleStringProperty(c.getValue().getAddress().getA1()); } });
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25020647

http://stackoverflow.com/comment/38799331
comment on: http://stackoverflow.com/a/24960700
has text: Maybe that because my arraylist is static?As I have tried it with standard variable...Here my arraylist looklike : public static ArrayList<Case> monArrayCase = new ArrayList<Case>();
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/24940416
type: Answer
score: 2
answers question: http://stackoverflow.com/q/24940031
upvote count: 2
has body: Here's my two cents. If your project is to build a search engine ground up, consider looking at the paper by Page and Brin (http://infolab.stanford.edu/~backrub/google.html). Ofcourse the same is not used now by Google but the basis remains similar. If you are using Lucene, all you need to do is create the frontend. But if you plan on making everything on your own, you need to consider how would you rank a page, how often would you update your indexes and how would you store them. Note that today's web contains not only textual data, there are videos, tweets, images and other forms of media. Consider formulating a plan for them. Like any search engine, your priority should be fast lookup and that would depend on how your indexes are stored and retrieved. Another priority is showing up the results in a particular format. Consider formulating a plan for that like would it based on the number of backlinks, freshness, etc.
downvote count: 0

http://stackoverflow.com/q/24955537
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/38947660
tagged with: ehcache
has answer: http://stackoverflow.com/a/24955688
tagged with: spring
accepted answer: http://stackoverflow.com/a/24955688
score: 4
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/46441851
has title: How can I clear ehcahe objects in spring configured java project programmatically
tagged with: caching
has answer: http://stackoverflow.com/a/40975391
type: Question
upvote count: 4
possible better answer: http://stackoverflow.com/a/46441851
has body: Now my project need is to trigger the flushing of all active cached objects. Based on all my findings I have written the following code. Collection&lt;String&gt; names = cacheManager.getCacheNames(); for (String name : names) { Cache cache = cacheManager.getCache(name); cache.put(name, null); } Here cacheManger is the object of @Autowired EhCacheCacheManager cacheManager. Even i have tried cache.evict(name); But all these hack doesn't work for me, when it comes for keyed caches. Yes too i have tried the annotation based envition using following code snippets: @Caching(evict = { @CacheEvict(value = "cache1", allEntries = true), @CacheEvict(value = "cache2", allEntries = true) }) public static boolean refresh() { return true; } So the whole point I want to flush all my ehcached cached object. I got one understanding towards the clearing all the cached, if i could get all the keys then I could flush them by using following code snippet: Cache cache = cacheManager.getCache(nameOfCache); if (cache.get(keyOfCache) != null) { cache.put(keyOfCache, null); }
answer count: 3
has comment: http://stackoverflow.com/comment/38796708

http://stackoverflow.com/comment/38831779
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24979566
has text: Try using `c.buttons()` instead of `color.buttons()`
type: Comment

http://stackoverflow.com/q/25011613
answer count: 1
has comment: http://stackoverflow.com/comment/38892507
has title: How to deploy Workflow engine on jBOSS AS 7
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25015631
tagged with: java
tagged with: eclipse
type: Question
has body: I have running jBOSS AS 7 and I want to deploy my Workflow engine on this server. How can I do it? I have files .bpmn and .java. In .bpmn file I have scenario and in .java file I have class with functions which I'm using in my .bpmn file. Please help me. Greetings rizon
tagged with: bpmn
tagged with: jboss
has comment: http://stackoverflow.com/comment/38892781
score: 0
tagged with: jbpm

http://stackoverflow.com/a/25065801
has body: You should be using the JAVA_OPTS_EXT environment variable to set any extra JAVA_OPTS that you would like your application to use. Try using this command to set it: rhc env-set JAVA_OPTS_EXT=VALUE
answers question: http://stackoverflow.com/q/25065091
upvote count: 1
has comment: http://stackoverflow.com/comment/38994334
score: 1
has comment: http://stackoverflow.com/comment/38994474
has comment: http://stackoverflow.com/comment/39106201
downvote count: 0
type: Answer

http://stackoverflow.com/q/24980191
score: 0
tagged with: stack
tagged with: java
tagged with: javafx
accepted answer: http://stackoverflow.com/a/24980543
has title: Matrix of Buttons (How to Create and Arrange) in JavaFX
tagged with: matrix
type: AnsweredQuestion
has body: This is my first program written in JavaFX (as opposed to Swing). I'm starting small by simply displaying data sets in a matrix of buttons (I do not wish to use a Table just yet). package matrixjavafx; import javafx.application.Application; import javafx.event.ActionEvent; import javafx.event.EventHandler; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.layout.StackPane; import javafx.stage.Stage; import java.util.Random; // required for random number generation /** * * @author Matt */ public class MatrixJavaFX extends Application { Button[][] matrix; //names the grid of buttons @Override public void start(Stage primaryStage) { int SIZE = 10; int length = SIZE; int width = SIZE; StackPane root = new StackPane(); matrix = new Button[width][length]; // allocates the size of the matrix // runs a for loop and an embedded for loop to create buttons to fill the size of the matrix // these buttons are then added to the matrix for(int y = 0; y &lt; length; y++) { for(int x = 0; x &lt; width; x++) { Random rand = new Random(); // Creates new Random object for generating random numbers // The following variables are generated using Random object rand. // rand.nextInt(2) generates a double ranging from 0.000 to 0.999. // setting the target variable to be an integer truncates the range to 0 - 1. int rand1 = rand.nextInt(2); // Declare and initialize random integer (0 - 1) + 1 matrix[x][y] = new Button(/*"(" + rand1 + ")"*/); //creates new random binary button matrix[x][y].setText("(" + rand1 + ")"); // Sets the text inside the matrix matrix[x][y].setOnAction(new EventHandler&lt;ActionEvent&gt;() { @Override public void handle(ActionEvent event) { System.out.println("Random Binary Matrix (JavaFX)"); } }); root.getChildren().add(matrix[x][y]); } } Scene scene = new Scene(root, 500, 500); primaryStage.setTitle("Random Binary Matrix (JavaFX)"); primaryStage.setScene(scene); primaryStage.show(); } /** * @param args the command line arguments */ pub…
has answer: http://stackoverflow.com/a/24980543
tagged with: pane
type: Question
answer count: 1

http://stackoverflow.com/comment/38829388
has text: @Aminoo If you are in a cluster session variables must be serialized and (usually are then) written to a database. Request variables aren't. Also, the more you store in the session the slower and less scalable your application will generally be.
type: Comment
comment on: http://stackoverflow.com/a/24978207
score: 1
type: AnswerComment

xml-parsing
tags question: http://stackoverflow.com/q/25027884
tag name: xml-parsing
tags question: http://stackoverflow.com/q/24958312
tags question: http://stackoverflow.com/q/25030989
type: Tag
tags question: http://stackoverflow.com/q/24934469
tags question: http://stackoverflow.com/q/24968908

http://stackoverflow.com/q/25041861
answer count: 5
tagged with: jlabel
has answer: http://stackoverflow.com/a/25042577
type: UnansweredQuestion
has title: How to use JLabel as a String
tagged with: swing
has answer: http://stackoverflow.com/a/25042554
type: Question
has comment: http://stackoverflow.com/comment/38949073
tagged with: java
has answer: http://stackoverflow.com/a/25041945
has body: This is my JLabel. It gets a value from another function and I am able to display the value of status in the JFrame. But I am not able to print it in console. JFrame frame=new JFrame("Demo"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setVisible(true); frame.setSize(300,150); status = new JLabel("Status"); frame.add(status,BorderLayout.CENTER); System.out.println(status); Why is this happening?
has answer: http://stackoverflow.com/a/25044926
has comment: http://stackoverflow.com/comment/38949308
score: 0
has answer: http://stackoverflow.com/a/25042129

http://stackoverflow.com/comment/38991512
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25063642
has text: @Gumbo Because the if statement is within a loop. I left the loop out as I figured it weren't relevant to the question.
score: 0

http://stackoverflow.com/comment/38748012
score: 0
type: Comment
type: QuestionComment
has text: Having successfully loading the first fxml on the stage, i want to load the login page upon clicking the "enter" button
comment on: http://stackoverflow.com/q/24934122

swagger-ui
tag name: swagger-ui
type: Tag
tags question: http://stackoverflow.com/q/24951268

http://stackoverflow.com/comment/38801328
type: Comment
comment on: http://stackoverflow.com/q/24961180
has text: Did you do anything other than adding a .jar file to the clsaspath? Did you write any code to load these fonts? If so, please edit your question to include that code. (It would also help to know exactly what version of Jasper Reports you're using.)
score: 0
type: QuestionComment

http://stackoverflow.com/a/25097722
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25067428
type: Answer
answers question: http://stackoverflow.com/q/25067428
has body: now works here how I did @Entity @Table(name="aluno") public class Aluno implements Serializable{ private static final long serialVersionUID = 1L; @Id @GeneratedValue private Integer id; //informacoes gerais @NotNull private String nome; //historico de graduacao @OneToMany(mappedBy = "aluno", cascade = CascadeType.ALL, fetch = FetchType.LAZY) private List&lt;HistoricoDeGraduacao&gt; listaHistoricoGraduacao; public Aluno() { } public void addListaHistoricoGraduacao(HistoricoDeGraduacao hdg){ if(listaHistoricoGraduacao == null){ listaHistoricoGraduacao = new ArrayList&lt;HistoricoDeGraduacao&gt;(); } listaHistoricoGraduacao.add(hdg); } public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public String getNome() { return nome; } public void setNome(String nome) { this.nome = nome; } public List&lt;HistoricoDeGraduacao&gt; getListaHistoricoGraduacao() { return listaHistoricoGraduacao; } public void setListaHistoricoGraduacao(List&lt;HistoricoDeGraduacao&gt; listaHistoricoGraduacao) { this.listaHistoricoGraduacao = listaHistoricoGraduacao; } @Override public int hashCode() { int hash = 7; return hash; } @Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final Aluno other = (Aluno) obj; return true; } } @Entity @Table(name="graduacao") public class Graduacao implements Serializable{ private static final long serialVersionUID = 1L; @Id @GeneratedValue private Integer id; @NotNull @Column(unique = true) private String graduacao; @ElementCollection @CollectionTable(name="graus_graduacao", joinColumns=@JoinColumn(name="id_graduacao")) @Column(name="graus") private List&lt;String&gt; graus; @OneToMany(mappedBy = "graduacao", cascade = CascadeType.ALL, fetch = FetchType.LAZY) private List&lt;HistoricoDeGraduacao&gt; listaHistoricoGraduacao; public Graduacao() { } public Graduacao(Integer id, String graduacao, List&lt;String&gt; graus) { this.id = id; this.graduacao…

http://stackoverflow.com/comment/38932731
has text: This looks pretty good. I'll try it out. This could save me a lot of work, because I don't have to create a widget :)
comment on: http://stackoverflow.com/a/25032979
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/25019484
tagged with: c3p0
tagged with: spring
type: AnsweredQuestion
tagged with: connection-pooling
has body: I'm using com.mchange.v2.c3p0.ComboPooledDataSource as my datasource for an Oracle DB in a Spring MVC web project. Here's my bean properties configurations for this class: &lt;bean id="pmiDataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close"&gt; &lt;property name="driverClass" value="oracle.jdbc.driver.OracleDriver" /&gt; &lt;property name="jdbcUrl" value="jdbc:oracle:thin:@//server:port/SID" /&gt; &lt;property name="user" value="****" /&gt; &lt;property name="password" value="****" /&gt; &lt;property name="acquireIncrement" value="3" /&gt; &lt;property name="initialPoolSize" value ="10" /&gt; &lt;property name="minPoolSize" value="10" /&gt; &lt;property name="maxPoolSize" value="15" /&gt; &lt;/bean&gt; here, no matter how I set the pool size, it doesn't change the threads number of ThreadPoolAsynchronousRunner. e.g 1. &lt;property name="minPoolSize" value ="1" /&gt; &lt;property name="initialPoolSize" value="1" /&gt; &lt;property name="maxPoolSize" value="15" /&gt; 2. &lt;property name="minPoolSize" value="5" /&gt; &lt;property name="initialPoolSize" value ="6" /&gt; &lt;property name="maxPoolSize" value="15" /&gt; I always have 3 thread in my JVisual VM UPDATE : help help!
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/25046801
has title: ComboPooledDataSource poolsize configurations not working
score: 0
accepted answer: http://stackoverflow.com/a/25046801
answer count: 1

http://stackoverflow.com/q/25039666
has title: Stopping a window from displaying till it is fully drawn?
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38944827
has answer: http://stackoverflow.com/a/25043676
tagged with: java
upvote count: 1
tagged with: swing
type: Question
has body: I am working on a Java program that takes in a large amount of files (3000 max) with an associated array of 1/0's. Currently I have a visualization of the array where there is a grid where each box is filled black for 1 or white for 0. When drawn it runs well but takes around a minute to fully load (and potentially locks the computer up in the meantime.) Is there a way I can: 1, not display the window till it is done (i.e JFrame create, //draw window frame.setVisible(true)) and 2, track the progress of the process so that I can use a progress bar with it? edit: Can I run a thread to draw it and then simply make a while loop to only display it once the thread is completed?
has comment: http://stackoverflow.com/comment/38945189
has answer: http://stackoverflow.com/a/25043007
has comment: http://stackoverflow.com/comment/38944896
linked to: http://stackoverflow.com/q/4637215
answer count: 2
downvote count: 0
score: 1
favorite count: 0

http://stackoverflow.com/a/39709146
type: Answer
downvote count: 1
has body: For android studio 2.2 version VM option is not available directly from project structure. steps to make gradle sync successful:-> 1)OPEN project 2)Click on gradle script 3)open gradle.properties 4)Change org.gradle.jvmargs=-Xmx1536m to org.gradle.jvmargs=-Xmx1024m 5)Save the work 6)Open File->Invalidate cache/Restart And its done!!! Enjoy Android!!!
score: 16
upvote count: 17
answers question: http://stackoverflow.com/q/25009717

http://stackoverflow.com/comment/38948925
comment on: http://stackoverflow.com/q/25040921
has text: Do I have to make a jPanel and then add a jTextField with a KeyListener added to it?
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/38743544
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24921046
has text: nobody encountered this problem so far?

http://stackoverflow.com/comment/38961940
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25048123
has text: Found a working answer here: http://stackoverflow.com/questions/3961071/android-how-to-make-a-clickable-map-image-with-each-country-producing-a-differe thanks for the help :)

http://stackoverflow.com/comment/38942500
type: Comment
comment on: http://stackoverflow.com/a/25038312
has text: Should be equal as long as the underlying millis since epoch are the same. This doesn't take time zone into account. If they are unequal your post about `02:00:00 CEST` is misleading. You need to provide the equality that is failing. Do a get millis on both values and compare them. Should point you in the right direction.
score: 0
type: AnswerComment

boolean
tags question: http://stackoverflow.com/q/24916255
tags question: http://stackoverflow.com/q/24936122
tags question: http://stackoverflow.com/q/24977783
tags question: http://stackoverflow.com/q/25036045
tags question: http://stackoverflow.com/q/25050976
tag name: boolean
tags question: http://stackoverflow.com/q/25026601
tags question: http://stackoverflow.com/q/24950435
tags question: http://stackoverflow.com/q/25048025
tags question: http://stackoverflow.com/q/24913818
tags question: http://stackoverflow.com/q/25025593
type: Tag

http://stackoverflow.com/a/28178734
upvote count: 7
has body: The OS level requirements are "real" and shouldn't normally be circumvented. As to how real it is I cannot answer. Ultimately as system libraries are updated, and newer versions of JDK are compiled against them older systems won't be able to use parts of Java that use the newer functions in those libraries or even the libraries as a whole if the pointers/links have changed. If you want to be absolutely sure Java will work on your system, you will need to compile it from source. But that is a massive pain on a Mac unfortunately. If you want to try anyway, check out the Mac Port Project over on OpenJDK.
type: AcceptedAnswer
type: Answer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24995066
answers question: http://stackoverflow.com/q/24995066
score: 7

http://stackoverflow.com/q/25045561
favorite count: 0
has comment: http://stackoverflow.com/comment/38957626
upvote count: 4
possible better answer: http://stackoverflow.com/a/25045742
has comment: http://stackoverflow.com/comment/38957689
has title: Find the location of the smallest int in an array using a method using Java
type: AnsweredQuestion
score: 2
has comment: http://stackoverflow.com/comment/38956533
tagged with: java
has answer: http://stackoverflow.com/a/25046380
tagged with: methods
has body: I have written the following method to find the location/index of the smallest number within the array. private static int indexOfMin( int[] a, int cnt ) { int loc = 0;//the variable that will hold the index position int min = a[loc];//the variable that will compare the value of loc against its location for (int i = 1; i &lt; a.length; i++) { if (a[i] &lt; min )//if value is less { min = a[i];// make value of i equal to min loc = i; loc takes on value of the index of the value of min } } return loc ; } Instead of returning the location of the smallest int, it returns the location of the last int. How do I find the location of the smallest int and return it into int loc? FURTHER EDITS: This is the program in it's entirety. The other two methods I'm still working on. So ignore them. public static void main (String[] args) throws Exception { final int CAP = 20; // capacity Scanner infile = new Scanner( new File(args[0]) ); int[] arr = new int[ CAP ]; int count = 0; while ( count &lt; arr.length &amp;&amp; infile.hasNextInt() ) { arr[ count ] = infile.nextInt(); count++; } infile.close(); printArray( arr, count ); // this method is given to you as as. don't modity it int minVal = minOf( arr, count ); System.out.println( "Smallest number is: " + minVal); // YOU MUST WRITE THE DEFINITION (code) BELOW MAIN FOR indexOfMin METHOD int indOfMin = indexOfMin( arr, count ); System.out.println( "Smallest number is located at index position: " + indOfMin ); // YOU MUST WRITE THE DEFINITION (code) BELOW MAIN FOR maxOf METHOD int maxVal = maxOf( arr, count ); System.out.println( "Largest number is: " + maxVal); // YOU MUST WRITE THE DEFINITION (code) BELOW MAIN FOR indexOfMax METHOD int indOfMax = indexOfMax( arr, count ); System.out.println( "Largest number is located at index position: " + indOfMax ); } // END main // GIVEN AS IS - DO NOT MODIFY private static int minOf( int[] a, int cnt ) { int min = a[0]; for ( int i=0 ; i&lt;cnt ; i++ ) { if (a[i] &lt; min) min = a[i]; } return…
has answer: http://stackoverflow.com/a/25045633
type: Question
has answer: http://stackoverflow.com/a/25046498
has comment: http://stackoverflow.com/comment/38956852
tagged with: arrays
has comment: http://stackoverflow.com/comment/38956500
answer count: 6
has answer: http://stackoverflow.com/a/25045742
has answer: http://stackoverflow.com/a/25046364
accepted answer: http://stackoverflow.com/a/25046364
has comment: http://stackoverflow.com/comment/38956501
downvote count: 2
has answer: http://stackoverflow.com/a/25046005
has comment: http://stackoverflow.com/comment/38956590

http://stackoverflow.com/comment/38788239
type: Comment
type: QuestionComment
score: 0
has text: I am not getting any error neither I am getting any content assist suggestions. If any compilation error remains in jsp scriptlet i came to know it only at runtime on tomcat console
comment on: http://stackoverflow.com/q/24949338

http://stackoverflow.com/comment/38842327
type: QuestionComment
has text: @VassilisDe Where are you displaying it and what font are you using?
comment on: http://stackoverflow.com/q/24984718
score: 0
type: Comment

atomic
type: Tag
tags question: http://stackoverflow.com/q/25038919
tag name: atomic
tags question: http://stackoverflow.com/q/24993095

http://stackoverflow.com/q/24947530
has body: I am using ArrayList and I want an example of Exception in case if multiple threads try to access the same list without synchronization ? I done this in single threaded application in which if we remove an element from list while iteration it throws ConcurrentModificationExceptoin but I want to achieve the same in multi threaded environment. If anyone could give me an example of that would be highly appreciated ? package com.test2; public class ThreadTest extends Thread { List list = new ArrayList&lt;String&gt;(); @Override public void run() { list.add("1"); list.add("2"); list.add("3"); list.add("4"); list.add("5"); try { Thread.sleep(1); } catch (InterruptedException e) { e.printStackTrace(); } list.add("6"); list.add("7"); list.add("8"); Iterator&lt;String&gt; it = list.iterator(); while (it.hasNext()) { System.out.println(it.next()); } } public static void main(String[] args) { Thread th1 = new ThreadTest(); Thread th2 = new ThreadTest(); Thread th3 = new ThreadTest(); th1.start(); th2.start(); th3.start(); try { th1.join(); th2.join(); th3.join(); } catch (InterruptedException e) { e.printStackTrace(); } } }
has comment: http://stackoverflow.com/comment/38772173
has comment: http://stackoverflow.com/comment/38772353
has comment: http://stackoverflow.com/comment/38772160
accepted answer: http://stackoverflow.com/a/24947698
has title: Example of exception in ArrayList?
possible better answer: http://stackoverflow.com/a/24947666
has answer: http://stackoverflow.com/a/24947666
has answer: http://stackoverflow.com/a/24947642
has comment: http://stackoverflow.com/comment/38772255
linked to: http://stackoverflow.com/q/7037268
has comment: http://stackoverflow.com/comment/38772227
has comment: http://stackoverflow.com/comment/38772204
has answer: http://stackoverflow.com/a/24947633
has answer: http://stackoverflow.com/a/24947698
answer count: 4
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38772257
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/38772195
tagged with: multithreading
has comment: http://stackoverflow.com/comment/38772292
tagged with: collections
type: Question

http://stackoverflow.com/q/24928377
accepted answer: http://stackoverflow.com/a/24928790
score: 2
upvote count: 3
tagged with: java
downvote count: 1
type: Question
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24928790
has body: I'm a game server developer. I'm using hazelcast for my game server (SmartfoxServer 2x) to avoid request db directly. But I wonder how to use hazelcast to get the best performance: Always create new hazelcast client instance when access cache and then shutdown it. Or Create a hazelcast client instance pool, and reuse. Never shutdown until application end. Or Create only one hazelcast client instance, never shutdown until application end. Or Make my realtime server as a hazelcast member. What's the right way? My system serve for about 5000 CCU. My game is a kind of card game - turn based. Each game occurs in about 2 minutes, with maximum 4 players. When It end, I have to log every transactions (money change), and new money value for user. With 5000 ccu, in worst case, at the same time there're (5000/4) * (4 + 4) = 10000 entries have to be logged. It cannot be done with mysql queries directly (slow), but with hazelcast, it's possible, right? But I'm a newbie in Hazelcast technique, so I don't know what is the right way to solve my issue. Thank in advance,
answer count: 1
tagged with: hazelcast
favorite count: 0
tagged with: in-memory-database
tagged with: smartfoxserver
has title: Implement Hazelcast with SmartFoxServer

http://stackoverflow.com/a/25015708
has comment: http://stackoverflow.com/comment/38928364
has comment: http://stackoverflow.com/comment/38900178
has comment: http://stackoverflow.com/comment/38903197
has comment: http://stackoverflow.com/comment/38928269
has comment: http://stackoverflow.com/comment/38900573
has comment: http://stackoverflow.com/comment/38900057
has comment: http://stackoverflow.com/comment/38901199
downvote count: 0
has comment: http://stackoverflow.com/comment/38905970
answers question: http://stackoverflow.com/q/25015622
upvote count: 2
has comment: http://stackoverflow.com/comment/38899913
type: Answer
has comment: http://stackoverflow.com/comment/38904022
has body: If you get the error on computer A but not on B, then there must be a difference. You'll have to compare every little detail: Java VM type and versions OS version free memory on both options that you use to start do you really have the same versions of everything (code, JARS)? Are you loading the exact same data on both systems? Eventually, you'll stuble over something that is different and which explains the odd behavior.
has comment: http://stackoverflow.com/comment/38899845
score: 2
has comment: http://stackoverflow.com/comment/38899996
has comment: http://stackoverflow.com/comment/38930047
has comment: http://stackoverflow.com/comment/38900701
accepted answer of: http://stackoverflow.com/q/25015622
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38901511

http://stackoverflow.com/comment/38919401
has text: I really appreciated java 8 alternative ;) Thank you!
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25025632

geotools
type: Tag
tags question: http://stackoverflow.com/q/25040949
tag name: geotools

http://stackoverflow.com/a/24967004
has comment: http://stackoverflow.com/comment/38823860
has comment: http://stackoverflow.com/comment/38836576
has comment: http://stackoverflow.com/comment/38880717
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/24966111
score: 1
upvote count: 1
has body: I would recommend using Guava Ordering. Using Ordering.explicit allows us to compare things in the order that they appear in a list. In order to sort the objects by name after they are sorted by priority, the two orderings are composed together with Ordering.thenComparing. // Sorts MyObject by name public static final Ordering&lt;MyObject&gt; MY_OBJECT_FOOD_ORDERING = new Ordering&lt;MyObject&gt;() { @Override public int compare(final MyObject left, final MyObject right) { return ComparisonChain.start() .compare(left == null ? null : left.getName(), right == null ? null : right.getName()) .result(); } }; public static final Ordering&lt;MyObject&gt; buildPriorityOrdering(final List&lt;String&gt; priorities) { return buildPriorityOrdering(Ordering.explicit(ImmutableList.&lt;String&gt; builder() .addAll(priorities) .build()) .nullsLast()); } public static final Ordering&lt;MyObject&gt; buildPriorityOrdering(final Ordering&lt;String&gt; priorityOrdering) { return new Ordering&lt;ListOrdering.MyObject&gt;() { @Override public int compare(final MyObject left, final MyObject right) { return ComparisonChain.start() .compare(left == null ? null : left.getPriority(), right == null ? null : right.getPriority(), priorityOrdering) .result(); } }; } public static void main(final String... args) { final List&lt;String&gt; priorities = ImmutableList.&lt;String&gt; builder() .add("high") .add("medium") .add("low") .build(); final List&lt;MyObject&gt; myObjects = ImmutableList.&lt;MyObject&gt; builder() .add(new MyObject("doughnut", "high")) .add(new MyObject("cheese", "low")) .add(new MyObject("eggs", null)) .add(new MyObject("apple", "low")) .add(new MyObject("fudge", null)) .add(new MyObject("bacon", "medium")) .build(); final List&lt;MyObject&gt; myObjectsSorted = FluentIterable.from(myObjects) .toSortedList(buildPriorityOrdering(priorities).thenComparing(MY_OBJECT_FOOD_ORDERING)); /* * Results: * MyObject [name=doughnut, priority=high] * MyObject [name=bacon, priority=medium] * …

http://stackoverflow.com/comment/38932336
type: Comment
has text: @1337 And the Maps inside the ArrayList? You create instances of these as well. And they probably create instances of some other objects inside of them (depending of the implementation).
score: 0
comment on: http://stackoverflow.com/q/25032813
type: QuestionComment

http://stackoverflow.com/a/53687064
upvote count: 0
has body: //I use that static boolean esURL(String cadena){ boolean bandera = false; bandera = cadena.matches("\\b(https://?|ftp://|file://|www.)[-a-zA-Z0-9+&amp;@#/%?=~_|!:,.;]*[-a-zA-Z0-9+&amp;@#/%=~_|]"); return bandera; }
score: -1
downvote count: 1
answers question: http://stackoverflow.com/q/24924072
type: Answer

http://stackoverflow.com/q/25016854
tagged with: java
has body: I want to calculate MD5 hash of the file. If I use fast_md5 with native lib http://twmacinta.com/myjava/fast_md5.php, then Java read file from HDD with 90 MB/s...120 MB/s and calc time is 70 seconds. If I use QT QCryptographicHash hash(QCryptographicHash::Md5); QFile in("C:/file.mkv"); QFileInfo fileInfo("C:/file.mkv"); qint64 imageSize = fileInfo.size(); const int bufferSize = 1000000; char buf[bufferSize+5]; int bytesRead; if (in.open(QIODevice::ReadOnly)) { while ( (bytesRead = in.read(buf, bufferSize)) &gt; 0) { // imageSize -= bytesRead; // hash.addData(buf, bytesRead); } } else { qDebug() &lt;&lt; "Failed to open device!"; } in.close(); qDebug() &lt;&lt; hash.result().toHex(); then my program read file from HDD with speed 20...78 MB/s and calc time is 210 seconds. Is it possible to accelerate the processing of MD5 Calc in QT? May need to increase the buffer from 1000000 to a larger value?
has title: QT - QFile - slow read from file
type: Question
score: 0
answer count: 1
tagged with: md5-file
has comment: http://stackoverflow.com/comment/38903340
has answer: http://stackoverflow.com/a/25017750
accepted answer: http://stackoverflow.com/a/25017750
tagged with: qt
tagged with: c++
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38903017

http://stackoverflow.com/a/24981660
score: 1
has comment: http://stackoverflow.com/comment/38837003
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24981633
downvote count: 0
has body: This should be like this because i.add(BigInteger.ONE) doesn't update the variable i. for (; i.compareTo(big) &lt;= 0; i=i.add(BigInteger.ONE)) { tot = tot.multiply(i); } There are two changes: It should be &lt;=0 instead of &lt;0 Assign it back to i to update it. How to confirm? BigInteger i = new BigInteger("2"); System.out.println(i.add(BigInteger.ONE)); // print 3 System.out.println(i); // print 2
accepted answer of: http://stackoverflow.com/q/24981633
type: Answer
upvote count: 1

http://stackoverflow.com/comment/38990305
type: Comment
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/25062653
has text: Does [this question](http://stackoverflow.com/questions/1393004/java-modified-utf-8-strings-in-python) help? (ie, this looks like a duplicate)

http://stackoverflow.com/q/24916670
has answer: http://stackoverflow.com/a/24916933
tagged with: java
has comment: http://stackoverflow.com/comment/39007022
type: Question
tagged with: android-camera
score: 0
answer count: 2
has title: Using Camera.TakePicture with Front Camera Causes Phone to Crash
has comment: http://stackoverflow.com/comment/38714029
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/24916895
has body: I'm working on a simple app that lets the user take a picture of their self and then make modifications to the image. This had been working splendidly but now all of a sudden attempting to take a picture causes the entire phone to crash. The only way I've been able to "resolve" the issue has been by changing: mCamera = Camera.open(1); to: mCamera = Camera.open(); This doesn't make sense to me as Camera.open(1) had been working just fine for the entire life of the app prior. The phone even crashes when using: mCamera.takePicture(null, null, null); //Useless I know. Just for test purposes. The worst part is that I can't get a logcat of the problem because the entire phone crashes and restarts. And if I attempt to run it in an emulator it runs just fine. And even with tons of searching I haven't found anyone that has had the camera api cause the entire phone to crash. So I guess my question is, does anyone have an idea what might be causing this? Or where I might begin to look to fix it? Edit: I should add that I also tried using: int cameraCount = 0; Camera.CameraInfo cameraInfo = new Camera.CameraInfo(); cameraCount = Camera.getNumberOfCameras(); for (int camIdx = 0; camIdx &lt; cameraCount; camIdx++) { Camera.getCameraInfo(camIdx, cameraInfo); if (cameraInfo.facing == Camera.CameraInfo.CAMERA_FACING_FRONT) { try { mCamera = Camera.open(camIdx); } catch (RuntimeException e) { Log.e(TAG, "Camera failed to open: " + e.getLocalizedMessage()); } } } This also opened the front facing camera and allowed me to preview, same as mCamera = Camera.open(1); but still crashes the phone when taking a picture.
has comment: http://stackoverflow.com/comment/58606984

http://stackoverflow.com/q/25069047
has comment: http://stackoverflow.com/comment/39000904
has comment: http://stackoverflow.com/comment/39000967
tagged with: while-loop
has body: After giving the input to writtenBooks, it skips the option to enter input for authorDemographics and continues to the next prompt. At this point, regardless of the input i typed it continuously prompts me "Type 1 for Yes. Type 2 for No." Looking forward to any feedback. Thanks /* body */ System.out.println ("Hello, welcome to the convention!"); System.out.println ("Please enter your full name: "); authorName = input.nextLine (); System.out.flush(); System.out.println ("Please enter the amount of books you have written: "); writtenBooks = input.nextInt (); System.out.println ("Who is your target demographic for your books?"); System.out.println ("Type: Under 3 , 3 through 7 , 8 through 10 , 11 through 13 , or 14 and older."); authorDemographics = input.nextLine (); System.out.flush(); /* loop */ demoLoop = 0; while (!ageGroup [4].equals(authorDemographics) &amp;&amp; demoLoop == 0) { System.out.println ("Would you like to enter more demographics?"); System.out.println ("Type 1 for Yes. Type 2 for No."); question = input.nextInt (); } if (question == 1) { System.out.println ("Who is your target demographic for your books?"); System.out.println ("Type: Under 3, 3 through 7, 8 through 10, 11 through 13, or 14 and older."); authorDemographics01 = input.nextLine (); System.out.flush(); } else { demoLoop = 1; System.out.println ("Author Name:" + authorName); System.out.println ("First Demographic: " + authorDemographics); System.out.println ("Second Demographic: " + authorDemographics01); System.out.println ("Amount of books written: " + writtenBooks);
has comment: http://stackoverflow.com/comment/39000997
has comment: http://stackoverflow.com/comment/39001636
has answer: http://stackoverflow.com/a/25069237
has comment: http://stackoverflow.com/comment/39000945
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39000996
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/39002347
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/25069127
has title: String Loop Java

http://stackoverflow.com/q/25006577
has body: I'm not sure what I am doing wrong? What is fromdate and what is todate? here is my code... The max date works perfectly, so I'm really confused. It seems to me the new Date().getTime should return the right value or is it something else? meetingDateButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { DatePickerDialog dpd = new DatePickerDialog(MapActivity.this, new DatePickerDialog.OnDateSetListener() { @Override public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) { SimpleDateFormat simpledateformat = new SimpleDateFormat("EEEE"); Date date = new Date(year, monthOfYear, dayOfMonth - 1); String dayOfWeek = simpledateformat.format(date); meetingSelectDate.setText(dayOfWeek + " " + (monthOfYear + 1) + "/" + dayOfMonth + "/" + year); } }, mYear, mMonth, mDay); dpd.setTitle("Select Date:"); Date maxDate = new Date(); maxDate.setTime(new Date().getTime()+(86400000*7)); dpd.getDatePicker().setMaxDate(maxDate.getTime()); dpd.getDatePicker().setMinDate(new Date().getTime()); dpd.show(); } });
answer count: 2
downvote count: 0
favorite count: 0
has title: Set Minimum date for DatePickerDialog getting IllegalArgumentException Fromdate does not precede toDate
tagged with: android
has answer: http://stackoverflow.com/a/25007287
upvote count: 13
type: AnsweredQuestion
tagged with: java
score: 13
type: Question
possible better answer: http://stackoverflow.com/a/43971250
accepted answer: http://stackoverflow.com/a/25007287
has answer: http://stackoverflow.com/a/43971250

http://stackoverflow.com/comment/38877966
type: Comment
comment on: http://stackoverflow.com/a/25003378
score: 0
has text: Make sure that your import for CaptionPanel is com.google.gwt.user.client.ui
type: AnswerComment

swt
tags question: http://stackoverflow.com/q/24944237
tags question: http://stackoverflow.com/q/25056426
tags question: http://stackoverflow.com/q/25000655
tags question: http://stackoverflow.com/q/24918696
tags question: http://stackoverflow.com/q/24993240
tags question: http://stackoverflow.com/q/24980980
tags question: http://stackoverflow.com/q/25000590
tags question: http://stackoverflow.com/q/24992688
tags question: http://stackoverflow.com/q/24954934
tags question: http://stackoverflow.com/q/25044143
tags question: http://stackoverflow.com/q/24926106
tags question: http://stackoverflow.com/q/25037139
tags question: http://stackoverflow.com/q/24932036
tags question: http://stackoverflow.com/q/24924658
type: Tag
tags question: http://stackoverflow.com/q/24968869
tags question: http://stackoverflow.com/q/24959861
tags question: http://stackoverflow.com/q/25022936
tags question: http://stackoverflow.com/q/24976355
tags question: http://stackoverflow.com/q/24931169
tags question: http://stackoverflow.com/q/25008764
tags question: http://stackoverflow.com/q/25021297
tags question: http://stackoverflow.com/q/24943125
tags question: http://stackoverflow.com/q/24927587
tag name: swt
tags question: http://stackoverflow.com/q/24949135
tags question: http://stackoverflow.com/q/24959177

http://stackoverflow.com/comment/38716713
comment on: http://stackoverflow.com/q/24917944
type: Comment
has text: You got an answer but you don't show any effort trying to do it yourself. Pity.
score: 0
type: QuestionComment

http://stackoverflow.com/comment/39048187
comment on: http://stackoverflow.com/q/25019784
has text: Have you tried to launch app on a read device?
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/38802234
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24963620
has text: If the answers on the duplicate question don't make sense then you should say _what_ doesn't make sense
score: 4

http://stackoverflow.com/comment/38960415
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25047627
has text: You're calling methods on `player` without checking if it's null first and you set `player` to null when stop is pressed.

remote-debugging
tag name: remote-debugging
tags question: http://stackoverflow.com/q/24984274
type: Tag

http://stackoverflow.com/a/25041328
downvote count: 0
answers question: http://stackoverflow.com/q/25041253
upvote count: 2
type: Answer
score: 2
has body: br = new BufferedReader(new FileReader("H:\\infilename.txtt")); Typing error mainly; you spelled the name of the file wrong. You should instead write: br = new BufferedReader(new FileReader("H:\\infilename.txt"));

http://stackoverflow.com/comment/38848488
has text: I am following this tutorial http://www.mkyong.com/spring-mvc/spring-mvc-hello-world-example/ but I do not see the webapp folder or something as a base directory. Just a normal src folder. What am I doing wrong here?
type: AnswerComment
comment on: http://stackoverflow.com/a/24988165
score: 0
type: Comment

http://stackoverflow.com/comment/43941631
score: 11
comment on: http://stackoverflow.com/a/24956464
has text: So you just waited ? what is the exact solution here?
type: AnswerComment
type: Comment

http://stackoverflow.com/a/24919729
answers question: http://stackoverflow.com/q/24919027
has body: WORKING CODE: private static boolean isItemInDataThenRemove(Map&lt;String, Object&gt; data, String removeKey) { data.entrySet().stream().filter(entry -&gt; entry.getKey().equalsIgnoreCase(removeKey)).forEach(entry -&gt; { data.remove(entry.getKey()); }); return true; }
score: 0
type: Answer

http://stackoverflow.com/q/25037148
tagged with: vaadin7
type: AnsweredQuestion
tagged with: java
tagged with: swing
type: Question
score: 0
has title: Hierarchical style of coding Java GUI
accepted answer: http://stackoverflow.com/a/25037283
answer count: 1
has answer: http://stackoverflow.com/a/25037283
has body: There is interesting approach in Groovy: SwingBuilder. Example: swing.edt { frame(title:'Frame', defaultCloseOperation:JFrame.EXIT_ON_CLOSE, pack:true, show:true) { vbox { textlabel = label("Click the button!") button( text:'Click Me', actionPerformed: { count++ textlabel.text = "Clicked ${count} time(s)." println "Clicked!" } ) widget(sharedPanel()) widget(sharedPanel()) } } } I think, it make code is much more readable and maintainable. And I use similar approach in Java for Swing or Vaadin applications. Example: @Theme("mytheme") @SuppressWarnings("serial") public class MyVaadinUI extends UI { private VerticalLayout layout; @WebServlet(value = "/*", asyncSupported = true) @VaadinServletConfiguration(productionMode = false, ui = MyVaadinUI.class, widgetset = "i.x.songbook.main.AppWidgetSet") public static class Servlet extends VaadinServlet { } @Override protected void init(VaadinRequest request) { setContent(layout = new VerticalLayout() { { setMargin(true); addComponent(new HorizontalLayout() { { setWidth("100%"); { Label expandingGap = new Label(); expandingGap.setWidth("100%"); addComponent(expandingGap); setExpandRatio(expandingGap, 5f); } { Label titleLabel = new Label(" Title ", ContentMode.HTML); addComponent(titleLabel); setExpandRatio(titleLabel, 30f); } { Label fixedGap = new Label(); fixedGap.setWidth("10px"); addComponent(fixedGap); } { TextField searchField = new TextField(); searchField.setWidth("100%"); searchField.setDescription("Search"); addComponent(searchField); setExpandRatio(searchField, 50f); } { Label expandingGap = new Label(); expandingGap.setWidth("100%"); addComponent(expandingGap); setExpandRatio(expandingGap, 5f); } } }); addComponent(new Button("Button") { { addClickListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { layout.addComponent(new Label("Thank you for clicking")); } }); } }); } }); } } What do you think about it?

http://stackoverflow.com/q/24984116
tagged with: java
tagged with: boonex-dolphin
linked to: http://stackoverflow.com/q/3563593
tagged with: eclipse
type: Question
answer count: 1
score: 0
has answer: http://stackoverflow.com/a/24984208
tagged with: android
has body: Okay, So I'm working on an Android app but get the following error: java.lang.NoClassDefFoundError in com.networkstudios.app.LoginActivity. java.lang.NoClassDefFoundError: com.networkstudios.app.LoginActivity$1 at com.networkstudios.app.LoginActivity.(LoginActivity.java:37) at java.lang.Class.newInstanceImpl(Native Method) at java.lang.Class.newInstance(Class.java:1319) at android.app.Instrumentation.newActivity(Instrumentation.java:1068) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2007) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2117) at android.app.ActivityThread.access$700(ActivityThread.java:134) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1218) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:137) at android.app.ActivityThread.main(ActivityThread.java:4867) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:511) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1007) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:774) at dalvik.system.NativeStart.main(Native Method) Here is the code for LoginActivity.java found in com.networkstudios.app: http://pastebin.com/4dMxD8nb Any Ideas on this?
linked to: http://stackoverflow.com/q/19413711
type: UnansweredQuestion
tagged with: eclipse-adt
has title: Android App Error: java.lang.NoClassDefFoundError

http://stackoverflow.com/q/24938461
favorite count: 0
has body: I'm building a piano in Java. I have multiple clips which should be played, and to save RAM, I decided to store them in HashMap for later use. But this fails, it only plays one time, ond one time only. What am Ia doing wrong? Source: //imports etc. HashMap&lt;String, Clip&gt; cache = new HashMap&lt;String, Clip&gt;(); //defined as global variable, before the constructor public void play(String file) { Clip clip = null; AudioInputStream audio = null; if (cache.containsKey(file)) { clip = cache.get(file); } else { audio = AudioSystem.getAudioStream(getClass().getResource("/res/sounds/" + file + ".wav")); clip = AudioSystem.getClip(); clip.open(audio); cache.put(file, clip); } clip.start(); } Note: String file is just a name of a .wav, such as "C4", or "F#5". And I repeat once again, this code plays the sound for the first time, but never after.
accepted answer: http://stackoverflow.com/a/24938518
upvote count: 1
has title: Java caching .wav fails
type: AnsweredQuestion
tagged with: audio
tagged with: hashmap
tagged with: java
tagged with: clip
has comment: http://stackoverflow.com/comment/38754723
type: Question
has answer: http://stackoverflow.com/a/24938518
has comment: http://stackoverflow.com/comment/38754874
answer count: 1
downvote count: 0
score: 1

http://stackoverflow.com/comment/38805016
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24964694
has text: at first I was following a tutorial about game making.. He didn't use activities so neither do I now... And I have to say, it works well
score: 0

http://stackoverflow.com/q/24974458
has comment: http://stackoverflow.com/comment/38823016
tagged with: lambda
has comment: http://stackoverflow.com/comment/38822726
answer count: 2
has comment: http://stackoverflow.com/comment/38822443
upvote count: 1
has title: How do filter out this list with java 8 streams and functional interfaces?
tagged with: java-8
has answer: http://stackoverflow.com/a/24975371
tagged with: java
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24977118
tagged with: arrays
downvote count: 0
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/38822412
has body: if I have a list of arrays like this (pseudo java code): Note the list valsSorted will be always sorted with x[0] asc and x[1] desc order. List valsSorted = {[1 5][1 4][1 3][2 1][3 2][3 1][4 2][4 1][5 1][6 2][6 1]}; How do I filter this list with Java 8 streams and lambdas so that I get: result = {[1 5][2 1][3 2][4 2][5 1][6 2]} The first item of the array (x[0]) is ID and the second is a version number. So the rule is give all distinct IDs with the highest version back. If I would use a for loop the following code would be fine: ArrayList&lt;int[]&gt; result= new ArrayList(); int keep = -1; for (int[] x : valsSorted) { int id = x[0]; int version = x[1]; if(keep == id) continue; keep = id; result.add(x); }
has comment: http://stackoverflow.com/comment/38822818
type: Question
linked to: http://stackoverflow.com/q/23699371

http://stackoverflow.com/comment/38932214
has text: use this https://github.com/pskink/PatchworkDrawable
comment on: http://stackoverflow.com/q/25032784
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25013781
has comment: http://stackoverflow.com/comment/38900097
answer count: 1
tagged with: end-to-end
has answer: http://stackoverflow.com/a/25020163
type: UnansweredQuestion
has title: TestNG functional testing @Test order sequence
tagged with: testng
has body: I am currently trying to write some automation tests using TestNG, which will verify some users actions on a website, so the tests are end-to-end functional tests as opposed to unit tests. I have created an XML file which will hold the test data (the structure of this XML file will not change). The test script will read the information from the test file and pass that into a DataProvider, which then feeds the @Tests. The problem is - the dataprovider appears to be pumping each @Test method with every instance of the test data, and it is not running the tests in sequence. I have attached the code - please could someone advice if my approach is correct, or what needs to be tweaked in the code to make this runnable for every set of test data. Test Data File <TestData> letmein ok! tesco Market 1000 Buy letmein ok! barc RFQ 100 Buy The dataprovider reads this test data and passes it into an Object[][] The automation test script is as follows; public class PlaceOrderTestScript { InitiateTesting x; static TestDataProvider y; static WebDriver driver; boolean loggedin = false; @Parameters("browser") @BeforeTest public void beforeMethod(String browser) throws Exception { x = new InitiateTesting(); y = new TestDataProvider(); driver = x.launch(browser); //select driver, browser and launch website } @DataProvider public static Object[][] dp(ITestContext context) throws Exception { String testdatalocation = context.getCurrentXmlTest().getParameter("placeordertestdata"); //suite.xml holds details of the test data file location Object[][] data = y.Provider(testdatalocation); return data; } @Test (dataProvider = "dp") public void SignIn(String username, String password, String product, String ordertype, String quantity, String side) throws Exception { System.out.println("Log into site"); // only run this test once if (loggedin == false) { LogIn_Page.txtbx_UserName(driver).sendKeys(username); LogIn_Page.txtbx_Password(driver).sendKeys(password); LogIn_Page.btn_LogIn(driver).click();…
type: Question
tagged with: functional-testing
has comment: http://stackoverflow.com/comment/38901069
has comment: http://stackoverflow.com/comment/38898790
tagged with: java
score: 0

http://stackoverflow.com/comment/38993353
type: Comment
type: QuestionComment
has text: Just included it in a pastebin
score: 0
comment on: http://stackoverflow.com/q/25064864

http://stackoverflow.com/q/24976723
has answer: http://stackoverflow.com/a/24976758
has body: I want to add a random operators so I can randomly add/subtract/multiply/divide multiple variables. The code below doesn't work. I think it's because the randomly generated operator is a char which actually has a value so it's added rather than used as an operator. Anyway I'm new at this and any help would be great thanks! class ClassA{ public static void main(String[] args){ ClassB x = new ClassB(); int a=1,b=2,c=3,d=4; int answer; //Trying to achieve //answer = a (+,-,*,/) b (+,-,*,/) c (+,-,*,/) d //i.e answer = a+x.randomOperator()+b+x.randomOperator()+c+x.randomOperator()+d; System.out.println("answer="+answer); } } I generate the random operator sign in a different class. import java.util.Random; public class ClassB{ public char randomOperator(){ Random rv = new Random(); int apples = rv.nextInt(3); char operator; switch (apples) { case 1: operator = '+'; break; case 2: operator = '-'; break; case 3: operator = '*'; break; default: operator = '/'; break; } return operator; } } I also think I should add I'm trying to do this for multiple numbers and while two numbers is fine the more numbers I add it gets vastly more complex so I cannot really write out every combination. Maybe this just cannot be done but I thought I'd ask! thanks!
score: 0
tagged with: random
tagged with: operator-keyword
has answer: http://stackoverflow.com/a/24976754
has comment: http://stackoverflow.com/comment/38826506
possible better answer: http://stackoverflow.com/a/24976758
has title: Using a random operator many variables
type: AnsweredQuestion
tagged with: java
type: Question
answer count: 2
accepted answer: http://stackoverflow.com/a/24976754

http://stackoverflow.com/q/24929687
accepted answer: http://stackoverflow.com/a/24930506
type: Question
answer count: 1
tagged with: jakarta-mail
score: 0
has body: I have the following issue, I am trying to attach a file to a mail being sent but it does not attach to the mail. Please see code below for mail: public static boolean sendEmail(String subject, String emailMessage, String from, String to[],String[] attachFiles ) throws MessagingException, IOException { boolean result = true; try { final String username = "nmtsystem@gmail.com"; final String password = "nMT@DMIn!"; Properties props = new Properties(); props.put("mail.smtp.auth", "true"); props.put("mail.smtp.starttls.enable", "true"); props.put("mail.smtp.host", "smtp.gmail.com"); props.put("mail.smtp.port", "587"); Session session = Session.getInstance(props, new javax.mail.Authenticator() { @Override protected PasswordAuthentication getPasswordAuthentication() { return new PasswordAuthentication(username, password); } }); MimeMessage message = new MimeMessage(session); message.setFrom(new InternetAddress(from)); InternetAddress[] toAddress = new InternetAddress[to.length]; // To get the array of addresses for (int i = 0; i < to.length; i++) { // changed from a while loop toAddress[i] = new InternetAddress(to[i]); } for (int i = 0; i < toAddress.length; i++) { // changed from a while loop message.addRecipient(javax.mail.Message.RecipientType.TO, toAddress[i]); } // creates message part MimeBodyPart messageBodyPart = new MimeBodyPart(); // creates multi-part Multipart multipart = new MimeMultipart(); multipart.addBodyPart(messageBodyPart); // adds attachments if (attachFiles != null && attachFiles.length > 0) { for (String filePath : attachFiles) { MimeBodyPart attachPart = new MimeBodyPart(); try { attachPart.attachFile(filePath); } catch (IOException ex) { ex.printStackTrace(); } multipart.addBodyPart(attachPart); } } message.setSubject(subject); message.setContent(" " + emailMessage + " ", "text/html"); Transport.send(message); } catch (MessagingException ex) { result = false; throw ex; } return result; } And this is the code with the body of the mail: public void …
has answer: http://stackoverflow.com/a/24930506
type: AnsweredQuestion
has title: File not attaching to email
tagged with: java

http://stackoverflow.com/comment/38778451
type: AnswerComment
comment on: http://stackoverflow.com/a/24950802
score: 0
has text: @merlin2011: and that's why I've got the paragraph about "if you're very lucky"
type: Comment

http://stackoverflow.com/a/24914314
has comment: http://stackoverflow.com/comment/38711127
has comment: http://stackoverflow.com/comment/38709555
has comment: http://stackoverflow.com/comment/38709505
score: 5
downvote count: 0
answers question: http://stackoverflow.com/q/24914067
type: Answer
has comment: http://stackoverflow.com/comment/38709991
has comment: http://stackoverflow.com/comment/38709609
has comment: http://stackoverflow.com/comment/38709431
has comment: http://stackoverflow.com/comment/38710721
has body: Java programs require a JRE to run. That's true of runnable jars as well as applets. You can use jnlp to automatically download a JRE for you, but since applets and webstarts have been all but deprecated, that's probably not the way to go. You can tell your users that they need to have a JRE installed on their machines before running your program. This is pretty reasonable as most people have a JRE, but it can get complicated if your users have an older version of the JRE and you're compiling for a newer version. You can also bundle a JRE with your program using something like JWrapper or Launch4J. This will guarantee that your program works on any client machine, but it means you have to create separate versions for each operating system, and the download size will be vastly increased since you have to include the JRE with your project. There aren't any real best practices to help you, unfortunately. In my experience most smaller projects simply require a JRE to be installed, and most big projects (like the games by Puppy Games) bundle a JRE inside the program itself. It's really up to you.
upvote count: 5

http://stackoverflow.com/q/25008251
answer count: 1
downvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/38886068
tagged with: jframe
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38885739
upvote count: 0
has answer: http://stackoverflow.com/a/25017700
tagged with: mouselistener
tagged with: java
has title: How to detect if the mouse if over a point in a JFrame?
tagged with: swing
has body: I'm using MouseListener and I can figure out how to detect if I move my mouse over I point in my JFrame.
type: Question
has comment: http://stackoverflow.com/comment/38885855
score: -1

http://stackoverflow.com/comment/38705874
has text: To start with I would separate movement and animation - use 1 image to begin with and just get the movement working. After that then approach the image switching problem.
score: 2
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24912419

http://stackoverflow.com/q/24944304
has answer: http://stackoverflow.com/a/24944356
has body: We have a project (say, Foo) which has some public static methods, some of them return String. Now, I need to access that project's jar from command-line and call one of those public static String methods to get that String. EDIT 1: I need to pass that returned string as an argument to a shell script. Something like this: ./my_bash_script.sh &lt;value returned from jar&gt; &lt;more arguments&gt; How do we do it? Tried to call the jar from command-line, but that didn't help. java -cp Foo.jar full.package.name.ClassName Error: Could not find or load main class jar It was expected, since the class doesn't have a Main function. Also tried to add a wrapper around the Foo.jar. Like, added this jar (Foo.jar) in my other project as a dependency, and called public static String method from Foo.jar. Well, this works, but I have to return a String outside Java application and Main has to be void. Can anyone please help me with this? Please ask for more explanation, if I have left out any detail, before down-voting.
answer count: 3
upvote count: 1
has comment: http://stackoverflow.com/comment/38766547
tagged with: jar
has comment: http://stackoverflow.com/comment/38766529
has comment: http://stackoverflow.com/comment/38766342
has comment: http://stackoverflow.com/comment/38766409
has comment: http://stackoverflow.com/comment/38766344
has comment: http://stackoverflow.com/comment/38766300
favorite count: 0
tagged with: static
has answer: http://stackoverflow.com/a/24944484
accepted answer: http://stackoverflow.com/a/24944484
has comment: http://stackoverflow.com/comment/38766485
has answer: http://stackoverflow.com/a/24944807
downvote count: 0
has comment: http://stackoverflow.com/comment/38766269
type: Question
linked to: http://stackoverflow.com/q/8054703
type: AnsweredQuestion
has title: How to call public static String method from jar from command-line?
score: 1
possible better answer: http://stackoverflow.com/a/24944356
tagged with: java

http://stackoverflow.com/q/24972965
favorite count: 0
has title: Java EE CDI Interceptor not working when annotation has parameters
accepted answer: http://stackoverflow.com/a/24973100
tagged with: interceptor
tagged with: java-ee-7
upvote count: 7
tagged with: jakarta-ee
type: AnsweredQuestion
score: 7
tagged with: java
has answer: http://stackoverflow.com/a/24973100
type: Question
answer count: 1
downvote count: 0
has body: I want to write a CDI interceptor. The interception works well if my annotation only contains 1 parameter but breaks if 2 parameters are used. The question is why? The interceptor class: @Monitored @Interceptor @Priority(APPLICATION) public class MonitoringInterceptor { @AroundInvoke public Object logInvocation(InvocationContext ctx) throws Exception { LOGGER.error("METHOD CALLED!!!"); //this is not called when annotation has 2 parameters return ctx.proceed(); } } The annotation: @InterceptorBinding @Target({TYPE, METHOD}) @Retention(RUNTIME) @Inherited public @interface Monitored { public String layer() default "BUSINESS"; public String useCase() default "N/A"; } Now the interesting part: @Stateless public class MyBean { //this does not work, why? @Monitored(layer = "BUSINESS", useCase = "test") //if I use the following annotation it works well //@Monitored(layer = "BUSINESS") public String sayHello(String message) { return message; } } I know that MyBean is not annotated with @Interceptors. This is intended. The interceptor is declared in beans.xml: <?xml version="1.0" encoding="UTF-8"?> my.package.MonitoringInterceptor

http://stackoverflow.com/a/25061982
has comment: http://stackoverflow.com/comment/38989000
has comment: http://stackoverflow.com/comment/38987978
has comment: http://stackoverflow.com/comment/38987578
accepted answer of: http://stackoverflow.com/q/25061649
has comment: http://stackoverflow.com/comment/38989054
has body: If you can get the array placed into a full String: String args = "-app app1 app2 app3 -env ev1 env2"; String[] splitDashes = args.split("-"); List&lt;String&gt; appList = new ArrayList(); List&lt;String&gt; envList = new ArrayList(); for(String split : splitDashes){ String[] splitSpaces = split.split(" "); if (splitSpaces[0].equals("app")) { for(String s : splitSpaces){ if(!s.equals("app")) appList.add(s); } } else if(splitSpaces[0].equals("env")) { for(String s : splitSpaces){ if(!s.equals("env")) envList.add(s); } } } Okay, I finally came up with a solution for this, assuming that -app will always be first. This is for String[] args array: public void DoSomething(){ String[] args = {"-app", "app1", "app2", "app3", "app4", "app5", "-env", "env1", "env2", "env3", "env4"}; List&lt;String&gt; appList = new ArrayList(); List&lt;String&gt; envList = new ArrayList(); int indexOfApp = -1; int indexOfEnv = -1; for(int i = 0; i&lt;args.length; i++){ if(args[i].equals("-app")){ indexOfApp = i; }else if(args[i].equals("-env")){ indexOfEnv = i; } } int countOfApp = -1; int countOfEnv = -1; if(indexOfApp != -1 &amp;&amp; indexOfEnv != -1){ countOfApp = indexOfEnv - 1; countOfEnv = args.length - (indexOfEnv + 1); } System.out.println(countOfApp); System.out.println(countOfEnv); for(int appIndex = indexOfApp; appIndex &lt; countOfApp; appIndex++){ appList.add(args[appIndex]); } for(int envIndex = indexOfEnv + 1; envIndex &lt; args.length; envIndex++){ envList.add(args[envIndex]); } Assert.assertEquals(5, appList.size()); Assert.assertEquals(4, envList.size()); }
answers question: http://stackoverflow.com/q/25061649
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38988490
has comment: http://stackoverflow.com/comment/38989227
type: Answer
has comment: http://stackoverflow.com/comment/38988053

http://stackoverflow.com/comment/38860321
type: QuestionComment
has text: You have asked 2 questions. You should ask them separately.
comment on: http://stackoverflow.com/q/24993790
score: 0
type: Comment

http://stackoverflow.com/comment/38824749
has text: The main thread shouln't need to wait for other threads. If you don't want you program to end while a certain thread is still running, just make that thread non-deamon.
type: Comment
comment on: http://stackoverflow.com/a/24975196
score: 0
type: AnswerComment

http://stackoverflow.com/q/24977130
type: Question
score: -1
has body: I'm trying to create a basic non static line of text that doesn't reprint itself but \r is either not working or I'm doing it wrong; I am a very new person to java so I'm sorry if the answer is really obvious. Here is my code: import java.util.Scanner; public class TextFight { public static void main(String args[]) { int MonsterHealth = 10; int YourHealth = 15; while(true) { System.out.println("............"); System.out.print("\r............"); System.out.println("| |"); System.out.print("\r| |"); System.out.println("| 0 0 |"); System.out.print("\r| 0 0 |"); System.out.println("| ------- |"); System.out.print("\r| ------- |"); System.out.println("............"); System.out.print("\r............"); System.out.println(MonsterHealth); System.out.print("\r" + MonsterHealth); System.out.println(""); System.out.println(""); System.out.println("............"); System.out.print("\r............"); System.out.println("| |"); System.out.print("\r| |"); System.out.println("| 0 0 |"); System.out.print("\r| 0 0 |"); System.out.println("| ------- |"); System.out.print("\r| ------- |"); System.out.println("............"); System.out.print("\r............"); System.out.println(""); System.out.println(YourHealth); System.out.print("\r" + YourHealth); } } } What it's doing is this: 15............ ............| | | || 0 0 | | 0 0 || ------- | | ------- |............ ............10 10 ............ ............| | | || 0 0 | | 0 0 || ------- | | ------- |............ ............ 15 15............ ............| | | || 0 0 | | 0 0 || ------- | | ------- |............ ............10 Please give me examples of code again I am a beginner.
has answer: http://stackoverflow.com/a/24977144
has title: How to properly update a line of text
answer count: 1
favorite count: 0
type: UnansweredQuestion
upvote count: 0
tagged with: java
downvote count: 1

http://stackoverflow.com/comment/38938353
type: QuestionComment
has text: it depends on an last clicked item. Say it's.. 200 now and I get like 9 items visible on screen at one time. The issue is that my view is not scrolling _at all_ :<
comment on: http://stackoverflow.com/q/25036094
score: 0
type: Comment

http://stackoverflow.com/a/24954147
type: AcceptedAnswer
type: Answer
has body: You can try the following code segment. It only shows how to check the java version. I am not familiar with Play.. You can do the necessary check for Play version inside the if condition with "YOUR_SUPPORTED_JAVA_VERSION" if type -p java; then echo found java executable in PATH _java=java fi if "$_java" ; then version=$("$_java" -version 2&gt;&amp;1 | awk -F '"' '/version/ {print $2}') echo version "$version" if "$version" &gt; "YOUR_SUPPORTED_JAVA_VERSION" ; then echo SUPPORTED_VERSION else echo NOT_SUPPORTED_VERSION fi fi
accepted answer of: http://stackoverflow.com/q/24951669
answers question: http://stackoverflow.com/q/24951669
score: 0

http://stackoverflow.com/q/24917112
tagged with: java
tagged with: bukkit
tagged with: mysql
has comment: http://stackoverflow.com/comment/38719228
has comment: http://stackoverflow.com/comment/38715412
has comment: http://stackoverflow.com/comment/38719187
type: Question
score: 3
upvote count: 3
answer count: 2
has comment: http://stackoverflow.com/comment/38719311
has comment: http://stackoverflow.com/comment/38717175
has body: I'm trying to make a Bukkit plugin with MySQL support. The plugin that I'm making is a eco plugin, so I have to put all the names of the players in a MySQL table. I'm using a PlayerJoinEvent to register the player in the database if they haven't been registered yet. When I enable my plugin it isn't giving any errors, but when a player joins(that is when the PlayerJoinEvent gets fired) an error appears. [19:07:54 INFO]: UUID of player behhhans is da772a82-cdc9-3b79-962b-4cdc7623dd7a [19:07:54 ERROR]: Could not pass event PlayerLoginEvent to Tokeconomy v1.0 org.bukkit.event.EventException at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.ja va:294) ~[spigot.jar:git-Spigot-1523] at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.jav a:62) ~[spigot.jar:git-Spigot-1523] at org.bukkit.plugin.TimedRegisteredListener.callEvent(TimedRegisteredLi stener.java:30) ~[spigot.jar:git-Spigot-1523] at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.j ava:502) [spigot.jar:git-Spigot-1523] at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.j ava:487) [spigot.jar:git-Spigot-1523] at net.minecraft.server.v1_7_R3.PlayerList.attemptLogin(PlayerList.java: 400) [spigot.jar:git-Spigot-1523] at net.minecraft.server.v1_7_R3.LoginListener.c(LoginListener.java:97) [ spigot.jar:git-Spigot-1523] at net.minecraft.server.v1_7_R3.LoginListener.a(LoginListener.java:43) [ spigot.jar:git-Spigot-1523] at net.minecraft.server.v1_7_R3.NetworkManager.a(NetworkManager.java:187 ) [spigot.jar:git-Spigot-1523] at net.minecraft.server.v1_7_R3.ServerConnection.c(ServerConnection.java :81) [spigot.jar:git-Spigot-1523] at net.minecraft.server.v1_7_R3.MinecraftServer.v(MinecraftServer.java:7 20) [spigot.jar:git-Spigot-1523] at net.minecraft.server.v1_7_R3.DedicatedServer.v(DedicatedServer.java:2 83) [spigot.jar:git-Spigot-1523] at net.minecraft.server.v1_7_R3.MinecraftServer.u(MinecraftServer.java:5 83) [spigot.jar:git-Spigot-1523] at net.…
has comment: http://stackoverflow.com/comment/38717621
has answer: http://stackoverflow.com/a/24918471
accepted answer: http://stackoverflow.com/a/24918471
favorite count: 0
possible better answer: http://stackoverflow.com/a/25077495
has answer: http://stackoverflow.com/a/25077495
type: AnsweredQuestion
downvote count: 0
has title: MySQL - Java - BukkitAPI - Error while connecting to MySQL database

http://stackoverflow.com/q/25062898
score: 1
has body: It's been too long since I last attempted an application and for the life of me, I can't seem to get an answer myself. I need to get a user to enter a password and username in my application upon login, and I wat to do that by searching a database in PHP Myadmin. I've got the code to a level where (I think) it should be close to completion, but the logic escapes me. I need to figure the if statement to compare the username and password the user entered to the database via the JSONArray, also, if the code won't work anyway, a heads up will be appreciated :) if statement is marked with ----> I know I need some form of for loop to siv through and compare values, but it's something i've never dealt with. Here's the code for my login screen: public class HomeScreen extends Activity implements OnClickListener { private ProgressDialog m_ProgressDialog = null; EditText editText1; EditText editText2; String clear1; String user; String password; URL url; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_home_screen); View loginBTN = findViewById(R.id.button1); loginBTN.setOnClickListener(this); editText1=(EditText)findViewById(R.id.editText1); editText2=(EditText)findViewById(R.id.editText2); clear1 =""; } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.home_screen, menu); return true; } public void onClick(View v) { switch (v.getId()) { case R.id.button1: user = editText1.getText().toString(); password = editText2.getText().toString(); if ( editText1 != null &amp;&amp; editText1.length() != 0 &amp;&amp; editText2 != null &amp;&amp; editText2.length() != 0){ getData(); m_ProgressDialog = ProgressDialog.show(HomeScreen.this, "Please wait...", "Checking Details...", true); m_ProgressDialog.setCancelable(true); if(testData()) { Intent i = new Intent(this, Afterlog.class); startActivit…
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: Question
tagged with: arrays
has answer: http://stackoverflow.com/a/25066946
has comment: http://stackoverflow.com/comment/38997372
has answer: http://stackoverflow.com/a/25274378
answer count: 3
upvote count: 1
has title: Trying to verify password via JSONarray in android
tagged with: android
linked to: http://stackoverflow.com/q/25066237
tagged with: getjson
favorite count: 0
downvote count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25065937

http://stackoverflow.com/comment/38821930
has text: I would like to add photo's but my account reputation does not allow me to in the post. Is there any other way of adding images?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24974099
score: 0

http://stackoverflow.com/q/25003724
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/38877800
has comment: http://stackoverflow.com/comment/38877854
has comment: http://stackoverflow.com/comment/38879147
score: 0
has comment: http://stackoverflow.com/comment/38877865
tagged with: linux
has title: About the Regular Expression difference between Windows and Linux
type: UnansweredQuestion
has body: The following 'target' is a part of my build.xml. Basically, it will call the 'less4j-1.7.0.jar' to compile all the files end with ".less" in "jsp/jsp_1/css/less" folder into ".css" files in the folder "jsp/jsp_1/css/less". &lt;target description="Compile less to css" name="compile-less0"&gt; &lt;property name="lessFiles0" value="jsp/jsp_1/css/less/*.less"/&gt; &lt;property name="desFolder0" value="-o jsp/jsp_1/css"/&gt; &lt;exec executable="java" failonerror="true"&gt; &lt;arg line="-jar lib/less4j-1.7.0.jar"/&gt; &lt;arg line="-m"/&gt; &lt;arg line="${lessFiles0}"/&gt; &lt;arg line="${desFolder0}"/&gt; &lt;/exec&gt; &lt;/target&gt; This runs very well in the Windows OS. However, when I try to run the same ant script in my Linux server, I got the following errors: compile-less0: [exec] Errors produced by compilation of jsp/jsp_1/css/less/*.less [exec] ERROR The file jsp/jsp_1/css/less/*.less does not exists. [exec] Could not compile the file jsp/jsp_1/css/less/*.less I am thinking if this have some relation with the regular expression format. The "*.less" means all the files end with ".less". And in Windows, it works very well. But why there is error when running this in Linux?
has comment: http://stackoverflow.com/comment/38877895
answer count: 0

http://stackoverflow.com/comment/38802523
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24963789
has text: Ant doesn't do a whole lot by itself. You'll need a script for it to run. By default, this is `build.xml`, found in the current working directory, but you can make it run other scripts with the `-f` flag.

http://stackoverflow.com/a/24948325
answers question: http://stackoverflow.com/q/24948305
score: 4
has body: Arrays#copyOfRange - Copies the specified range of the specified array into a new array. java.util.Arrays.copyOfRange(copyFrom, startindex, endIndex); Arrays#copyOfRange method internally use System#arraycopy. Source for reference AND alternatively you can use System utility it also. System#arraycopy(Object src, int srcPos, Object dest, int destPos, int length) -
type: Answer
upvote count: 4
downvote count: 0

http://stackoverflow.com/a/24915387
type: Answer
score: 1
has body: According to jdbc Statement.SUCCESS_NO_INFO — the command was processed successfully, but the number of rows affected is unknown Statement.SUCCESS_NO_INFO is defined as being -2, so your result says everything worked fine, but you won't get information on the number of updated columns. As per oracle docs For a prepared statement batch, it is not possible to know the number of rows affected in the database by each individual statement in the batch. Therefore, all array elements have a value of -2. According to the JDBC 2.0 specification, a value of -2 indicates that the operation was successful but the number of rows affected is unknown.
upvote count: 1
accepted answer of: http://stackoverflow.com/q/24914788
has comment: http://stackoverflow.com/comment/38711364
answers question: http://stackoverflow.com/q/24914788
has comment: http://stackoverflow.com/comment/38711385
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/25062998
score: 1
downvote count: 0
has body: For completeness sake; this error is caused by a bug in bnd (reported here: https://github.com/bndtools/bnd/issues/573). The operating system name/version reported by Java is not recognised, as this version of bnd was released before Windows 8.1. Aside from the error in the output there should be very little effect. You may encounter problems running bundles that contain native code, but the majority of bundles containing pure Java will work fine.
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/25016396

http://stackoverflow.com/a/24959860
has body: String[] parts = a.split(" - "); int[] numb = new int[parts.length]; for(int n = 0; n &lt; parts.length; n++) { numb[n] = Integer.parseInt(parts[n]); } firstnumber = numb[0]; secondnumber = numb[1];
answers question: http://stackoverflow.com/q/24959747
type: Answer
score: 0

http://stackoverflow.com/comment/72670830
score: 1
type: AnswerComment
has text: Well I guess u have less memory for the rest of your running tasks on your computer during build time but for me, that was not an issue.
type: Comment
comment on: http://stackoverflow.com/a/25013822

http://stackoverflow.com/comment/38985482
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25060178
has text: exactly what I'm asking for in the comment.
score: 0

http://stackoverflow.com/q/24938506
possible better answer: http://stackoverflow.com/a/24939568
type: AnsweredQuestion
tagged with: java
has title: How to randomly rename buttons. Java
answer count: 2
has body: I created a 10x10 grids for my battle ship game. all my buttons are being named as numbers, how ever I want them to be named from A1 to J10 in order and I cant get hol of how I need to do it. public class Center_Panel extends JPanel { public Center_Panel() { this.setLayout(new GridLayout(1, 2, 10, 10)); JPanel panel1 = new JPanel(new GridLayout(10, 10)); panel1.setBackground(Color.BLUE); for (int i = 0; i &lt; 10; i++) { for (int j = 0; j &lt; 10; j++) { JButton button = new JButton(Integer.toString(i + +j)); panel1.add(button); button.addActionListener (new ActionListener() { @Override public void actionPerformed(ActionEvent e){ }}); //GridCellP1 [i][j] = button; } }
has answer: http://stackoverflow.com/a/24938924
accepted answer: http://stackoverflow.com/a/24938924
score: 0
has answer: http://stackoverflow.com/a/24939568
type: Question
has comment: http://stackoverflow.com/comment/38755849

http://stackoverflow.com/comment/38803684
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24964293
has text: Also what happened to the `create table` line? Why is it not included in the tokens?
type: Comment

http://stackoverflow.com/comment/38796419
has text: But can I use Scanner to parse the info I want if I use getResourceAsStream?
type: Comment
comment on: http://stackoverflow.com/a/24958388
type: AnswerComment
score: 0

http://stackoverflow.com/comment/38997596
score: 0
type: AnswerComment
has text: Do you have the other files that you could share or an apk you have compiled?.I have compile mine and its no good https://www.dropbox.com/s/ch72znu7y4xrtw2/sendsms-release.apk
type: Comment
comment on: http://stackoverflow.com/a/25066217

http://stackoverflow.com/a/24929587
accepted answer of: http://stackoverflow.com/q/24923002
answers question: http://stackoverflow.com/q/24923002
type: Answer
score: 0
has body: Q1: Am not sure i got your question. But What i understand is , you are expecting a servlet class generated from your index.jsp and placed under WEB-INF right? jsp files are converted to servlet in run time, you cannot see them in your project directory structure. But if you really want to see them target\tomcat\work\localEngine\localhost\&lt;name related to webapp&gt;\org\apache\jsp is the location of the generated servlets. Q2: You can see in server and settings tab while creating new app. or you can see in server properties. Hope it helps
type: AcceptedAnswer

http://stackoverflow.com/a/24962489
score: 1
upvote count: 1
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/24962385
has body: If you throw an exception in the default case the break will never get executed so you can leave it away then. I personally use braces to avoid bad readability when dealing with switches in general. So for instance: switch (variable) { case 1: { code; mode code; break; } default: { break; } } Without the braces but instead good indented it's also well readable. Example: switch (variable) { case 1: code; mode code; break; default: { break; }

http://stackoverflow.com/comment/87136652
comment on: http://stackoverflow.com/a/27853391
type: AnswerComment
has text: @phuong Second link is broken
score: 0
type: Comment

http://stackoverflow.com/comment/38852741
type: Comment
has text: @DanTemple yes I agree with you :)
comment on: http://stackoverflow.com/a/24990326
type: AnswerComment
score: 0

http://stackoverflow.com/q/25013581
has title: IntelliJ IDEA 13.1.3 64-bit --- Visibility of Network Drives in Module Settings
has comment: http://stackoverflow.com/comment/38907368
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38912114
tagged with: java
has comment: http://stackoverflow.com/comment/38903707
has body: I have set up a new project inside the aforementioned IDE on a Windows 7 - 64-bit machine. I wanted to add libraries to the project. These libraries reside on a network folder. By clicking on the project inside the Project Explorer and successively pressing F4 i managed to get into the Module Settings. Under Project Settings i clicked Libraries, then the Plus-sign and Java. Unfortunately no network drives show up. How can i make the IntelliJ IDEA 13.1.3 64-bit access my network drives?
type: Question
score: 0
tagged with: intellij-idea
has comment: http://stackoverflow.com/comment/38909850
tagged with: windows

http://stackoverflow.com/q/24987818
tagged with: java
has comment: http://stackoverflow.com/comment/43273884
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38848020
has comment: http://stackoverflow.com/comment/38848305
has body: i use jdk 1.7, jekins, maven, when i build the project,the unit test fails, the error is : java.lang.VerifyError: Expecting a stackmap frame at branch target 73 Exception Details: Location: com/DataDictDao.save(Lcom/DataDict;)Ljava/lang/Long; @25: ldc Reason: Expected stackmap frame at this location. Bytecode: 0000000: 033d 11ff ff3e 1212 1100 25b8 0018 2ab4 0000010: 0022 122d b900 3302 0012 1211 0027 b800 0000020: 182a b400 352b b900 3a02 0012 1211 0028 0000030: b800 182a b400 2212 3cb9 0033 0200 1212 0000040: 1100 2cb8 0018 a700 2d12 1211 0029 b800 0000050: 183a 0412 1211 002a b800 182a b400 2212 0000060: 3e19 04b9 0042 0300 1212 1100 2bb8 0018 0000070: 1904 bf12 1211 002d b800 182b b600 48b8 0000080: 004e b0 Exception Handler Table: bci [25, 62] => handler: 73 Stackmap Table: same_locals_1_stack_item_extended(@81,Object[#43]) same_frame(@123) at java.lang.Class.getDeclaredConstructors0(Native Method) at java.lang.Class.privateGetDeclaredConstructors(Class.java:2493) at java.lang.Class.getDeclaredConstructors(Class.java:1901) at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.determineCandidateConstructors(AutowiredAnnotationBeanPostProcessor.java:231) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.determineConstructorsFromBeanPostProcessors(AbstractAutowireCapableBeanFactory.java:1002) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:975) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:487) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:296) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSing…
linked to: http://stackoverflow.com/q/8958267
has comment: http://stackoverflow.com/comment/38847897
linked to: http://stackoverflow.com/q/8638143
tagged with: java-7
has comment: http://stackoverflow.com/comment/38847995
tagged with: verifyerror
favorite count: 0
type: Question
score: 5
has comment: http://stackoverflow.com/comment/41200154
answer count: 2
downvote count: 2
has answer: http://stackoverflow.com/a/26262578
tagged with: maven
upvote count: 7
has answer: http://stackoverflow.com/a/44299209
has title: java.lang.VerifyError: Expecting a stackmap frame at branch target 73

http://stackoverflow.com/q/25031068
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38929280
tagged with: java
type: Question
has title: Send content / data from internal eclipse browser to a plug in
has body: I am developing both an eclipse plug in and a website. I want this two to interact with each other. The case is the following. I have an eclipse plug in and I am using the org.eclipse.ui.browser.IWorkbenchBrowserSupport to open an internal browser and point it to a specific url. User can interact with my website from the eclipse internal browser without a problem. The next thing I want to achieve is if a user clicks on a specific HTML element in my website (through the internal browser) to trigger an event or something and pass information from the internal browser to my plugin. This information can be something like : an element was clicked with properties a,b and c. You can think it as something similar with the mailto: directive, when clicking that directive the mail client launches. Any ideas on how i can achieve that? Any insights to point me to the right direction? I have found this (Create an Eclipse plugin that responds to links in the internal web browser) similar question which is 2 years old.
linked to: http://stackoverflow.com/q/9517680
score: 0
has comment: http://stackoverflow.com/comment/38934286
tagged with: eclipse-plugin

http://stackoverflow.com/a/24958208
upvote count: 6
accepted answer of: http://stackoverflow.com/q/24958142
has body: The problem is I switched syntax to 'FETCH JOIN' form the correct one: 'JOIN FETCH'. The correct query should look like this SELECT p FROM Person p JOIN FETCH p.positions pos WHERE p.id=:id The correct syntax with 'ALL' looks like this: SELECT p FROM Person p FETCH ALL PROPERTIES WHERE p.id=:id
score: 6
answers question: http://stackoverflow.com/q/24958142
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/a/25062602
has comment: http://stackoverflow.com/comment/38988920
type: Answer
upvote count: 1
accepted answer of: http://stackoverflow.com/q/25062312
has body: What should go into equals()? There are fields that define the identity of an object and there are fields that define its properties. The serial number of your phone is part of its identity, its colour or battery charge percentage is just a property. equals() should only depend on fields that define identity, and that is independent of whether the fields are accessible from the outside or not, it comes from the semantics of the fields themselves. So the question should really be: is there any reason to hide the identity of an object from its clients? And if the answer seems to be "yes", the next, more fundamental question is: is there any reason to identify the objects in the first place? After all, there are lots of objects out there that don't require to have an identity beyond the trivial. There are several possible problems that arise from it, here's one example. Example of problem public class Foo { private Bar hidden; private String accessible; @Override public boolean equals( Object ob ) { return hidden.equals(((Foo)ob).hidden); } @Override public int hashCode() { //Let's not forget that we MUST override hashCode() if we override equals() :) } } Now image a naive client wants to put these into a TreeSet. The class isn't Comparable but nothing to worry, we can write a comparator for it: public class FooComparator implements Comparator&lt;Foo&gt; { public int compare( Foo first, Foo second ) { return first.getAccessible().compareTo( second.getAccessible() ); } } Job done, great! Except poor client unwittingly violated the contract of TreeSet as the comparator provided isn't consistent with equals(). How to work around this? Let's suppose that despite knowing all this, you still want your own equals() that depends on hidden fields. Because you want to put them in a HashSet for example. You can then do this: public class Foo { private Bar hidden; private String accessible; private final Helper helper = new Helper(); Helper helper() { return helper; } class Helper…
score: 1
answers question: http://stackoverflow.com/q/25062312
type: AcceptedAnswer
downvote count: 0

jtds
tags question: http://stackoverflow.com/q/25037522
tag name: jtds
type: Tag

http://stackoverflow.com/comment/38966749
type: Comment
score: 0
has text: Hi Thanks. I will add the fixed non-permutation numbers to array2 and update array1 see what happens. I will drop all leading 0s and just assume if 12 comes up its 012.
type: AnswerComment
comment on: http://stackoverflow.com/a/25050531

http://stackoverflow.com/a/25054628
has comment: http://stackoverflow.com/comment/38973407
answers question: http://stackoverflow.com/q/25053215
score: 0
has comment: http://stackoverflow.com/comment/38973241
has comment: http://stackoverflow.com/comment/38973292
has body: To make sure that the jsp page can access your bean fields you could use your IDE's generate getters and setters method. it is much more accurate i think than manually typing the getters and setters. source&gt;generate setters and getters select field to generate getters and setters. you can call the endDate object with EL by ${project.endDate} and i can see in your code that you have a project list?iterate it with foreach import the taglib &lt;%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%&gt; iterate the list &lt;c:foreach items="projectlist" var="proj"&gt; &lt;c:out value="${proj.endDate}"/&gt; &lt;/c:foreach&gt;
type: Answer
has comment: http://stackoverflow.com/comment/38973667
has comment: http://stackoverflow.com/comment/38973445

http://stackoverflow.com/a/24934542
score: 1
type: Answer
has comment: http://stackoverflow.com/comment/38747074
upvote count: 1
answers question: http://stackoverflow.com/q/24934351
downvote count: 0
has body: Have you tried System.err.println(this.getClass().getName()); ? -- sorry I just can't comment by myself (yet) -- I want to know the jsp view page location and it's file name – lovespring That's exactly what you get: if you invoke what i wrote, you'll get (e.g. in example.jsp) org.apache.jsp.&lt;Folder&gt;.example_jsp

http://stackoverflow.com/comment/38792073
type: Comment
comment on: http://stackoverflow.com/a/24958388
score: 0
has text: You don't need to do anything like that, use getResourceAsStream.
type: AnswerComment

http://stackoverflow.com/a/24971258
upvote count: 5
type: Answer
has body: A quick test reveals that nothing happens: import javax.swing.JComboBox; class ComboBoxTest { public static void main(String[] args) { JComboBox&lt;String&gt; box = new JComboBox&lt;String&gt;(); box.removeAllItems(); } } No errors were thrown
downvote count: 0
score: 5
accepted answer of: http://stackoverflow.com/q/24971211
answers question: http://stackoverflow.com/q/24971211
type: AcceptedAnswer

http://stackoverflow.com/q/24916866
has comment: http://stackoverflow.com/comment/39141775
tagged with: spring-mvc
tagged with: java
has title: Error in opening InputStream from temp directory
type: Question
tagged with: jasper-reports
has comment: http://stackoverflow.com/comment/38760721
has comment: http://stackoverflow.com/comment/38715140
answer count: 1
has comment: http://stackoverflow.com/comment/38717826
has comment: http://stackoverflow.com/comment/38719729
has comment: http://stackoverflow.com/comment/38717866
has comment: http://stackoverflow.com/comment/38763731
has comment: http://stackoverflow.com/comment/38741580
score: 0
has comment: http://stackoverflow.com/comment/39141714
has answer: http://stackoverflow.com/a/55104130
has body: EDIT: I recommend against saving .jasper files to the temp directory and then attempting to load from that location. It's a lot of trouble. I am attempting to add JasperReport functionality to a Spring web app. The idea is that a pre-compiled .jasper file can be added to the server's Temp folder and filled then exported by the user. I can successfully read .jrxml from the classpath, compile it into a JasperReport, fill it, and export it within the same method. In trying to separate these tasks, I've run into trouble. Specifically, when attempting to open an input stream from the temp directory. The following code successfully creates a compiled .jasper file in the temp directory (I have omitted checks against filename for brevity). Resource res = appContext.getResource("classpath:jasperreports/" + filename + ".jrxml"); File f = new File( org.apache.commons.lang.SystemUtils.getJavaIoTmpDir(), filename + ".jasper"); JasperCompileManager.compileReportToStream(res.getInputStream(), new FileOutputStream(f)); Trying to READ from the temp folder causes a problem. After checking the temp folder for the newly-created .jasper, I call the following code. Map&lt;String, Object&gt; params = new HashMap&lt;String, Object&gt;(); String resourcePath = org.apache.commons.lang.SystemUtils.getJavaIoTmpDir().getPath().toString(); Resource compiledReport = appContext.getResource(resourcePath + "/" + filename + ".jasper"); //Directly accessing the folder didn't work, either //Resource compiledReport = appContext.getResource("C:/Users/&lt;MyUsername Here&gt;/AppData/Local/Temp/SimpleEmployeeReport.jasper"); JasperPrint filledReport = JasperFillManager.fillReport(compiledReport.getInputStream(), params, mds.getConnection()); Which results in an exception thrown at getInputStream: java.io.FileNotFoundException: Could not open ServletContext resource [/C:/Users/&lt;MyUsername&gt;/AppData/Local/Temp/SimpleEmployeeReport.jasper] I'd appreciate any light you can shed on this!
has comment: http://stackoverflow.com/comment/38714691
has comment: http://stackoverflow.com/comment/38719376
has comment: http://stackoverflow.com/comment/38714910
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39141746
tagged with: spring

http://stackoverflow.com/comment/38876515
score: 0
has text: Because there is more memory overhead with `enum` than there is with straight `ints`
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25003208

http://stackoverflow.com/comment/38865233
comment on: http://stackoverflow.com/a/24938941
score: 0
type: AnswerComment
type: Comment
has text: We backported the fix to 4.0.x and 3.0.x so it's in 3.0.5.BUILD-SNAPSHOT. We don't publish the schema until it's released; you can find it int the jar, or on github.

http://stackoverflow.com/comment/39005826
has text: Unfortunately the sticking point is that nothing is reporting yet which file(s) are being processed when encountering the ZipException. I tend to agree that it appears like it is a permissions/corruption issue.
type: AnswerComment
type: Comment
score: 1
comment on: http://stackoverflow.com/a/25053764

http://stackoverflow.com/comment/38993035
comment on: http://stackoverflow.com/q/25064930
score: 0
type: Comment
type: QuestionComment
has text: [PrettyTime](http://ocpsoft.org/prettytime/)

libgdx
tags question: http://stackoverflow.com/q/24946268
tags question: http://stackoverflow.com/q/24962180
tags question: http://stackoverflow.com/q/24967153
tags question: http://stackoverflow.com/q/24983097
tag name: libgdx
tags question: http://stackoverflow.com/q/25027423
tags question: http://stackoverflow.com/q/24918988
tags question: http://stackoverflow.com/q/25042893
tags question: http://stackoverflow.com/q/25011089
tags question: http://stackoverflow.com/q/25036767
tags question: http://stackoverflow.com/q/25022680
tags question: http://stackoverflow.com/q/25026265
tags question: http://stackoverflow.com/q/24925940
tags question: http://stackoverflow.com/q/24922539
tags question: http://stackoverflow.com/q/25007864
tags question: http://stackoverflow.com/q/25026600
tags question: http://stackoverflow.com/q/24922571
tags question: http://stackoverflow.com/q/24925549
tags question: http://stackoverflow.com/q/25006216
tags question: http://stackoverflow.com/q/25012478
tags question: http://stackoverflow.com/q/24922458
tags question: http://stackoverflow.com/q/25005567
tags question: http://stackoverflow.com/q/24976385
type: Tag
tags question: http://stackoverflow.com/q/25043410
tags question: http://stackoverflow.com/q/24975436
tags question: http://stackoverflow.com/q/24933903
tags question: http://stackoverflow.com/q/25007443
tags question: http://stackoverflow.com/q/24983925
tags question: http://stackoverflow.com/q/25020794
tags question: http://stackoverflow.com/q/24969395
tags question: http://stackoverflow.com/q/25047541
tags question: http://stackoverflow.com/q/24997223
tags question: http://stackoverflow.com/q/25058315
tags question: http://stackoverflow.com/q/24985945
tags question: http://stackoverflow.com/q/25007638
tags question: http://stackoverflow.com/q/25026428
tags question: http://stackoverflow.com/q/24952390
tags question: http://stackoverflow.com/q/24988852
tags question: http://stackoverflow.com/q/24957752
tags question: http://stackoverflow.com/q/25006702
tags question: http://stackoverflow.com/q/24949749
tags question: http://stackoverflow.com/q/24924143
tags question: http://stackoverflow.com/q/24964255
tags question: http://stackoverflow.com/q/24961153

http://stackoverflow.com/q/24989777
has comment: http://stackoverflow.com/comment/38852340
has answer: http://stackoverflow.com/a/51212804
type: Question
has answer: http://stackoverflow.com/a/24999719
score: 4
has title: An error has occurred with the WebSphere MQ JMS connection
upvote count: 4
tagged with: weblogic11g
answer count: 2
has comment: http://stackoverflow.com/comment/53738535
downvote count: 0
tagged with: jms
favorite count: 0
has body: Getting below error with MQ(Message Queue), how to resolve this? Message : com.ibm.msg.client.jms.DetailedJMSException: JMSWMQ1107: A problem with this connection has occurred. An error has occurred with the WebSphere MQ JMS connection. Use the linked exception to determine the cause of this error. Caused by [1] --> Message : com.ibm.mq.MQException: JMSCMQ0001: WebSphere MQ call failed with compcode '2' ('MQCC_FAILED') reason '2009' ('MQRC_CONNECTION_BROKEN'). Caused by [3] --> Message : com.ibm.mq.jmqi.JmqiException: CC=2;RC=2009;AMQ9208: Error on receive from host '/xx.xx.xx.xx:xxxx (emb701t7.dci.bt.com)'. [1=-1,2=ffffffff,3=/xx.xx.xx.xx:xxxx (emb701t7.dci.bt.com),4=TCP] Please take me forward.
tagged with: ibm-mq
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38889606
has comment: http://stackoverflow.com/comment/38925706
has comment: http://stackoverflow.com/comment/53738846
has comment: http://stackoverflow.com/comment/38892917
has comment: http://stackoverflow.com/comment/38889903
has comment: http://stackoverflow.com/comment/38931443
tagged with: java

http://stackoverflow.com/q/24932402
has answer: http://stackoverflow.com/a/24932581
score: 0
answer count: 3
has title: Android sent string from one activity to another not working
has answer: http://stackoverflow.com/a/24932448
tagged with: android
accepted answer: http://stackoverflow.com/a/24932581
tagged with: android-intent
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/24932448
has body: I want to ask something that maybe simple, but I still can't find the problem. I sent a string from one activity to another activity, but its show nothing. I already checked it several times, and I think there's nothing wrong with my code. Here's My first java code ( FoodFilter.class) listView.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id) { // getting values from selected ListItem String name = ((TextView) view.findViewById(R.id.filter_type)) .getText().toString(); String cost = ((TextView) view.findViewById(R.id.item_list)) .getText().toString(); String description = ((TextView) view.findViewById(R.id.category_name)) .getText().toString(); // Starting single contact activity Intent in = new Intent(getApplicationContext(), FoodFilterDetail.class); in.putExtra(TAG_NAME, name); in.putExtra(TAG_EMAIL, cost); in.putExtra(TAG_PHONE_MOBILE, description); startActivity(in); } }); This is the FoodFilterDetail.class @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); this.setContentView(R.layout.foods_filterdetail); TextView txtProduct = (TextView) findViewById(R.id.filterItemList); Intent i = getIntent(); // getting attached intent data String product = i.getStringExtra("TAG_NAME"); // displaying selected product name txtProduct.setText(product); } Here's my xml &lt;RelativeLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@android:color/transparent" android:layout_marginLeft="7dip" android:layout_marginRight="7dip" &gt; &lt;TextView android:id="@+id/filterItemList" android:layout_width="fill_parent" android:layout_height="wrap_content" android:padding="15dip" android:layout_alignParentLeft="true" android:layout_centerVertical="true" android:background="@android:color/transparent" android:text="Sort By" android:textSize="20sp" android:textStyle="bold" /&gt; &lt;/RelativeLayout&gt; …
tagged with: java
has answer: http://stackoverflow.com/a/24932678
type: Question

http://stackoverflow.com/comment/38959121
has text: whats line number 92?
score: 0
comment on: http://stackoverflow.com/q/25046374
type: Comment
type: QuestionComment

jpype
tag name: jpype
type: Tag
tags question: http://stackoverflow.com/q/25048190

http://stackoverflow.com/q/24940873
possible better answer: http://stackoverflow.com/a/47985794
has answer: http://stackoverflow.com/a/24940906
has answer: http://stackoverflow.com/a/24940922
has answer: http://stackoverflow.com/a/47985794
has comment: http://stackoverflow.com/comment/38759562
answer count: 3
has comment: http://stackoverflow.com/comment/38760238
has body: I am taking a course on Java and the "instructor" is introducing how to get the user's input. I don't understand what is the "input.nextLine()" for. Here's the code: import java.util.Scanner; public class Application { public static void main(String[] args) { // Create Scanner object Scanner input = new Scanner(System.in); // Output the prompt System.out.println("Type in something: "); // Wait for the user to enter a line of text String line = input.nextLine(); // Tell them what they entered System.out.println("You just typed " + "'" + line + "'."); } }
favorite count: 0
tagged with: user-input
has comment: http://stackoverflow.com/comment/38759346
upvote count: 2
downvote count: 2
accepted answer: http://stackoverflow.com/a/24940922
tagged with: input
has comment: http://stackoverflow.com/comment/38762098
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38761581
score: 0
tagged with: java
has title: Meaning of input.nextLine()
type: Question
has comment: http://stackoverflow.com/comment/38759687
has comment: http://stackoverflow.com/comment/38759390

http://stackoverflow.com/comment/38854465
has text: Take a look at [Collections#Shuffle](http://docs.oracle.com/javase/7/docs/api/java/util/Collections.html#shuffle(java.util.List)). It's a static method, meaning you can call it from anywhere :)
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24991444
type: Comment

http://stackoverflow.com/comment/39151841
type: AnswerComment
has text: I doubt many methods would exceed 8kb when written. But does the JIT itself grow them by inlining methods and unrolling loops?
type: Comment
comment on: http://stackoverflow.com/a/25149423
score: 1

http://stackoverflow.com/a/24996012
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24995859
upvote count: 3
answers question: http://stackoverflow.com/q/24995859
type: AcceptedAnswer
type: Answer
has body: Limited stack size is a function of how much memory you allocate to the JVM. Resource-constrained systems have less memory that can be allocated, so absolutely there are real-world scenarios where stack size is a limitation, and there are times where you have to use iterative solutions to naturally-recursive problems as a result. Increasing the physical memory of a system only matters if you allow that memory to be allocated by the JVM, otherwise you'll get the defaults of that platform.
score: 3

http://stackoverflow.com/comment/38738803
comment on: http://stackoverflow.com/q/24930044
score: 0
has text: `and lib files like libeay32.lib` Library files are not used at run time. They are used only in the build process. Add the DLL's to a path specified by your PATH environment variable and see if that solves the issue. If you add a new directory to your PATH, then you may need to restart Eclipse for the effect to take place.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38804173
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24964712
type: Comment
has text: I don't think this behaviour is the one he expects, is the contrary. For what I understood, the back button is working fine, the problem is when clicking the back btn of the action bar

http://stackoverflow.com/comment/38845087
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24986278
type: Comment
has text: thank you guys. So there is no easy way to avoid these getters in my case? As I am not familiar with dependency injection at all...

http://stackoverflow.com/q/24915823
score: 0
tagged with: java
tagged with: eclipse
type: Question
has comment: http://stackoverflow.com/comment/38712656
tagged with: filenotfoundexception
tagged with: appletviewer
has comment: http://stackoverflow.com/comment/38712245
tagged with: applet
has comment: http://stackoverflow.com/comment/38714295
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38747768
has body: I have a problem with Applet. First I have to pick file with data with JFileChooser. After that JTable is created. Since I run this Applet with AppletViewer from Eclipse everything is ok. But when I try to do this when I place it in HTML file I get FileNotFoundException even though I made some needed permision in .java.policy. Could you give me some tips, where should I place files general to make them visible for Applet? I mean they are in eclipse project directory and they are visible when I run Applet with AppletViever but they are not visible when I run it from HTML but they are still in project directory.
has title: Where to place files to make tham visible for Applet?
has comment: http://stackoverflow.com/comment/38755464
has comment: http://stackoverflow.com/comment/38714673

http://stackoverflow.com/a/26580219
type: Answer
has body: Your method works fine. You can change the output string to uppercase if that is your main issue: public static void conversion(int integer, int base) { if (integer &gt; 0 &amp;&amp; base &gt; 0) { System.out.println(integer + " in binary -&gt; "+ (Integer.toString(integer, base)).toUpperCase()); } }
answers question: http://stackoverflow.com/q/24920916
score: 0

http://stackoverflow.com/comment/55524503
has text: Specifically to the updating the process status: use a nested transaction. Make sure your JPA provider supports them.
type: Comment
comment on: http://stackoverflow.com/a/24916395
score: 0
type: AnswerComment

http://stackoverflow.com/comment/38924456
score: 0
has text: @ElderMael The JSP as it is broken up is 239 lines. All JSPs together are ~650 lines or so.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25028171

http://stackoverflow.com/q/25051585
has comment: http://stackoverflow.com/comment/38967585
has comment: http://stackoverflow.com/comment/38967598
type: Question
upvote count: 2
has body: I have two arrays 1) String[] images = {"#1","#2", "#3", "#4", "#5" }; 2) String[] items = {"1","2", "3", "4", "5", "6", "7", "8" }; The Items may vary , but the images array is fixed. I wan the output mapping like image 1 =&gt; item 1 image 2 =&gt; item 2 image 3 =&gt; item 3 image 4 =&gt; item 4 image 5 =&gt; item 5 image 1 =&gt; item 6 image 2 =&gt; item 7 image 3 =&gt; item 8 and so on. My work around is as follows, public static void main(String[] args) { for( int y=0;y&lt; items.length;y++ ){ for( int i=0;i&lt; images.length;i++ ){ if( y &gt;= images.length ){ int remaining = items.length % images.length; System.out.println("remaining..." + remaining); for( int x=0;x&lt;=remaining;x++ ){ System.out.println( "image" +images[x]+"=&gt; item =&gt;"+items[x]); } return; } System.out.println( "image" +images[y]+"=&gt; item =&gt;"+items[y]); break; } } }
tagged with: arrays
has answer: http://stackoverflow.com/a/25051634
accepted answer: http://stackoverflow.com/a/25051634
answer count: 1
downvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/38967601
type: AnsweredQuestion
has title: Looping one array with another array in Java
score: 1
tagged with: java

javascript
tags question: http://stackoverflow.com/q/24945216
tags question: http://stackoverflow.com/q/25057704
tags question: http://stackoverflow.com/q/25017117
tags question: http://stackoverflow.com/q/24952131
tags question: http://stackoverflow.com/q/24986962
tags question: http://stackoverflow.com/q/24998047
tags question: http://stackoverflow.com/q/24988020
tags question: http://stackoverflow.com/q/24925358
tags question: http://stackoverflow.com/q/24936873
tags question: http://stackoverflow.com/q/24937209
tags question: http://stackoverflow.com/q/24965194
tags question: http://stackoverflow.com/q/25019945
tags question: http://stackoverflow.com/q/24961452
tags question: http://stackoverflow.com/q/24942101
tags question: http://stackoverflow.com/q/24962863
tags question: http://stackoverflow.com/q/24937319
tags question: http://stackoverflow.com/q/24991859
tag name: javascript
tags question: http://stackoverflow.com/q/25041851
tags question: http://stackoverflow.com/q/25045854
tags question: http://stackoverflow.com/q/24933866
tags question: http://stackoverflow.com/q/24986282
tags question: http://stackoverflow.com/q/25055449
tags question: http://stackoverflow.com/q/25035172
tags question: http://stackoverflow.com/q/24957104
tags question: http://stackoverflow.com/q/24949506
tags question: http://stackoverflow.com/q/25042247
tags question: http://stackoverflow.com/q/25006652
tags question: http://stackoverflow.com/q/25041814
tags question: http://stackoverflow.com/q/24972066
type: Tag
tags question: http://stackoverflow.com/q/25021155
tags question: http://stackoverflow.com/q/24926684
tags question: http://stackoverflow.com/q/24971788
tags question: http://stackoverflow.com/q/25005999
tags question: http://stackoverflow.com/q/24954516
tags question: http://stackoverflow.com/q/24963696
tags question: http://stackoverflow.com/q/24977781
tags question: http://stackoverflow.com/q/24970931
tags question: http://stackoverflow.com/q/24921462
tags question: http://stackoverflow.com/q/25030600
tags question: http://stackoverflow.com/q/24972559
tags question: http://stackoverflow.com/q/24962023
tags question: http://stackoverflow.com/q/25055878
tags question: http://stackoverflow.com/q/24927496
tags question: http://stackoverflow.com/q/24932702
tags question: http://stackoverflow.com/q/25020039
tags question: http://stackoverflow.com/q/24964609
tags question: http://stackoverflow.com/q/25008841
tags question: http://stackoverflow.com/q/25003557
tags question: http://stackoverflow.com/q/24968893
tags question: http://stackoverflow.com/q/24953856
tags question: http://stackoverflow.com/q/24984648
tags question: http://stackoverflow.com/q/24960647
tags question: http://stackoverflow.com/q/24911008
tags question: http://stackoverflow.com/q/24932806
tags question: http://stackoverflow.com/q/25049048
tags question: http://stackoverflow.com/q/24954125
tags question: http://stackoverflow.com/q/25041700
tags question: http://stackoverflow.com/q/24927501
tags question: http://stackoverflow.com/q/25021453
tags question: http://stackoverflow.com/q/25059301
tags question: http://stackoverflow.com/q/24966678
tags question: http://stackoverflow.com/q/25054045
tags question: http://stackoverflow.com/q/24933975
tags question: http://stackoverflow.com/q/24946092
tags question: http://stackoverflow.com/q/25027785
tags question: http://stackoverflow.com/q/24955350
tags question: http://stackoverflow.com/q/24950277
tags question: http://stackoverflow.com/q/24978218
tags question: http://stackoverflow.com/q/25022357
tags question: http://stackoverflow.com/q/24997990
tags question: http://stackoverflow.com/q/24946911

http://stackoverflow.com/a/24948339
score: 0
answers question: http://stackoverflow.com/q/24948194
has body: Following happens if you use constructor without boolean. FileOutputStream(File file) throws FileNotFoundException { this(file, false); } Normally in these kind of scenarios values true or false are decided based on most used operation. So if you are writing on OutputStream you will be creating a new file most of the time, hence it passes false as default. Cheers !!
type: Answer

http://stackoverflow.com/q/25062298
has title: Validating JSON using GSON in java
favorite count: 0
has body: I'm using GSON to validate a string which is in JSON format: String json="{'hashkey':{'calculatedHMAC':'f7b5addd27a221b216068cddb9abf1f06b3c0e1c','secretkey':'12345'},operation':'read','attributes':['name','id'],'otid':'12'}"; Gson gson=new Gson(); Response resp = new Response(); RequestParameters para = null; try{ para = gson.fromJson(json, RequestParameters.class); }catch(Exception e){ System.out.println("invalid json format"); } Its doing good but when I remove the quotes like below, I have removed from hashkey: "{hashkey':{'calculatedHMAC':'f7b5addd27a221b216068cddb9abf1f06b3c0e1c','secretkey':'12345'},operation':'read','attributes':['name','id'],'otid':'12'}" It's still validating it as a proper JSONformat and not throwing any exception and not going in catch body. Any reason why it is doing so? How would I solve this? RequestParameters class: public class RequestParameters { HashKey hashkey; String operation; int count; int otid; String[] attributes; }
has comment: http://stackoverflow.com/comment/100347481
type: UnansweredQuestion
type: Question
linked to: http://stackoverflow.com/q/949449
upvote count: 5
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: gson
has answer: http://stackoverflow.com/a/25062503
score: 5
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/38987892
linked to: http://stackoverflow.com/q/43233898

http://stackoverflow.com/a/24959816
answers question: http://stackoverflow.com/q/24959747
upvote count: 2
has comment: http://stackoverflow.com/comment/38797458
has comment: http://stackoverflow.com/comment/38797576
has body: You will want to put validation code in for each step. You want to know the value you have is good. if(a!=null &amp;&amp;a.Contains(" - ")) { String[] separated = CurrentString.split(" - "); } separated[0]; // This will contain the first number separated[1]; // This will contain the second number Edit int valueOne= 0; int valueTwo= 0; try { valueOne = Integer.parseInt(strings[0]); // firstNumber becomes 234 valueTwo = Integer.parseInt(strings[1]); // secondNumber becomes 456 } catch(NumberFormatException e) { System.out.println("Please enter real numbers!"); }
type: Answer
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/38797183

http://stackoverflow.com/comment/38969386
comment on: http://stackoverflow.com/q/25052077
score: 0
has text: @MadProgrammer I can't make a runnable example simply because I don't know how to make my code short and surely those image won't show even if you run the program so how would you know if it repainted or not?
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24920046
upvote count: 4
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/24919880
has body: || is a logical OR operator in Java. In addition to above answers one important point to keep in mind for using || is short circuit evaluation. So if you have expression1 || expression2 expression2 will not be evaluated if expression1 is evaluated to be true.
score: 4

http://stackoverflow.com/q/25047541
has body: How do you make the box2dlights ignore textures and sprites in ambient lighting? For example I have a stage that has the ambient lighting set to dark. I want my lights to brighten up a platform directly underneath the light, but the background image behind the light should remain dark and not lit up. Currently the lights are the top rendered layer and everything underneath the light is lit up.
upvote count: 4
tagged with: java
tagged with: box2d
type: Question
tagged with: libgdx
has answer: http://stackoverflow.com/a/30682022
score: 4
has comment: http://stackoverflow.com/comment/47436692
tagged with: box2dlights
has title: Box2dlights - Layering lights
answer count: 1
downvote count: 0
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/38733595
type: Comment
comment on: http://stackoverflow.com/a/24927095
has text: I know—that’s why I asked in the first place as I was sure there would be other solutions. I have three ListViews for each type above TypeA containing all current instances and the possibility to open detail views for each single instance of either type. That’s why I thought about using the schema I provided in the first place.
type: AnswerComment
score: 0

http://stackoverflow.com/q/24913833
has title: Build a cluster consists of 3 linux machines using JGroups
type: Question
has answer: http://stackoverflow.com/a/24927168
has comment: http://stackoverflow.com/comment/38713849
upvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/38710870
has comment: http://stackoverflow.com/comment/38715578
tagged with: network-programming
tagged with: jgroups
has body: I would build a cluster consist of three Lunix machines by using the JGroups. The code is running fine, but each machine works independently and apparently there is no clustering. However, when I run the code in single machine as standalone and I create 3 instances, it works fine and forms a cluster. So I believe the problem is not the code. The following is the java code and UDP.XML file. package com.github.dustinbarnes; import org.jgroups.JChannel; import org.jgroups.ReceiverAdapter; import org.jgroups.View; import org.jgroups.blocks.locking.LockService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.locks.Lock; @SuppressWarnings("FieldCanBeLocal") public class Node extends ReceiverAdapter { private static final Logger LOG = LoggerFactory.getLogger(Node.class); private AtomicBoolean isMaster = new AtomicBoolean(false); private Thread statusPrinter; private Thread acquiringThread; private LockService lockService; private JChannel channel; private Lock masterLock; public static void main(String[] args) throws Exception { Node node = new Node(); node.start(); } public Node() throws Exception { this.channel = new JChannel(Node.class.getClassLoader().getResourceAsStream("udp.xml")); this.channel.setReceiver(this); this.channel.connect("master-cluster"); this.lockService = new LockService(this.channel); } public void start() { this.startAcquiringThread(); this.startStatusPrintingThread(); } @Override public void viewAccepted(View view) { LOG.info("Cluster event has happened!"); } private void startAcquiringThread() { acquiringThread = new Thread() { @Override public void run() { Thread.currentThread().setName("acquire-lock"); getLock(); } }; acquiringThread.setDaemon(true); acquiringThread.start(); } private void getLock() { masterLock = lockService.getLock("master"); masterLock.lock(); isMaster.set(true); LOG.info("I have become the master!"); } private void startStatusPrintingThrea…
tagged with: java
type: UnansweredQuestion
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/38715675
has comment: http://stackoverflow.com/comment/38708523
favorite count: 0

http://stackoverflow.com/comment/38844225
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24986097
score: 0
has text: [This answer](http://stackoverflow.com/a/11404720/2071828) seems to mainly answer this question. Not really a dup though.

http://stackoverflow.com/a/24990885
has comment: http://stackoverflow.com/comment/38853271
type: Answer
has comment: http://stackoverflow.com/comment/53310503
answers question: http://stackoverflow.com/q/24990691
upvote count: 2
score: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/38853119
has comment: http://stackoverflow.com/comment/38853547
has comment: http://stackoverflow.com/comment/38853847
has body: As far as I'm aware, the compiler will always initialize class variables to default values (even final variables). For example, if you were to initialize an int to itself, the int would be set to its default of 0. See below: class Test { final int x; { printX(); x = this.x; printX(); } Test() { System.out.println("const called"); } void printX() { System.out.println("Here x is " + x); } public static void main(String[] args) { Test t = new Test(); } } The above would print the following: Here x is 0 Here x is 0 const called

http://stackoverflow.com/comment/39002243
has text: My objective is simple. I have 50 decoupled suites that currently execute sequentially. I would like these to execute in parallel. The current testNG framework does NOT recognize parallelism at the suite level via the maven surefire plugin config (but it does at the class/method level). So my question is, how can I reach a state where I'm running suites in parallel via a workaround.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25051290

http://stackoverflow.com/comment/38758299
type: QuestionComment
comment on: http://stackoverflow.com/q/24939125
score: 0
has text: t1.run() and t2.run() both run simutaneously....but they falls on same method....but see we go for multithreding to limit the limitations of single thread....in singlethread, each method execute one after other...so,in multithreding i want to see how 2 methods execute simultaneously...so i need program like c#.net to understand in better way...
type: Comment

http://stackoverflow.com/a/24912906
has comment: http://stackoverflow.com/comment/40844967
score: 6
has comment: http://stackoverflow.com/comment/38709708
accepted answer of: http://stackoverflow.com/q/24912589
answers question: http://stackoverflow.com/q/24912589
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: The library project should be placed on the same drive with your workspace. the referencing project was in the same eclipse workspace as the library project.
upvote count: 6

http://stackoverflow.com/q/24934155
type: UnansweredQuestion
has body: Is it possible to get the position/index of the JMenuItem inside its JMenu? For instance, I have a JMenu called "Search" and 3 JMenuItems called "Find", "Count" and "Replace", and I have just 1 class manager to manage all the 3 JMenuItems. Hence I use the getSource() method to obtain which of the JMenuItems are clicked, so that I can pass the index of the JMenuItem to the constructor of another class. My problem is if wanted to add more JMenuItems or to change the order of the JMenuItems, I would have to change the indexes passed to the constructor of the other class. Thank you!
has answer: http://stackoverflow.com/a/24934470
tagged with: swing
tagged with: jmenu
has comment: http://stackoverflow.com/comment/38748238
has answer: http://stackoverflow.com/a/29643301
type: Question
tagged with: indexing
has comment: http://stackoverflow.com/comment/38754932
tagged with: java
has comment: http://stackoverflow.com/comment/38754814
has title: Getting the position of a JMenuItem from its parent JMenu
tagged with: jmenuitem
score: 0
answer count: 2

http://stackoverflow.com/comment/38900675
has text: What is the full stack trace for this: Caused by: java.lang.ClassCastException ?
score: 0
comment on: http://stackoverflow.com/a/25011206
type: AnswerComment
type: Comment

http://stackoverflow.com/a/25058361
upvote count: 5
has body: Why, oh why do you read the whole shebang at once in memory? Just read a line from a buffered file reader, write a line to a buffered file writer.
downvote count: 0
has comment: http://stackoverflow.com/comment/38980070
type: Answer
has comment: http://stackoverflow.com/comment/38980038
answers question: http://stackoverflow.com/q/25058288
has comment: http://stackoverflow.com/comment/38980007
score: 5

http://stackoverflow.com/comment/38912033
score: 0
type: AnswerComment
has text: Yes you can, but it's not wise. All your classes will be depending on reflection to set a value for that field. That renders the class useless in other projects that don't use the Spring IoC container.
comment on: http://stackoverflow.com/a/25021904
type: Comment

http://stackoverflow.com/comment/38957281
comment on: http://stackoverflow.com/q/25045844
has text: I edited the original question.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38961468
score: 0
comment on: http://stackoverflow.com/q/25048025
has text: Awesome I definitely understand the conditions they are checking. I still don't really understand the question though. Being that the test is done on paper, how would I know how many valid words there are with length 7? @JimGarrison
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/38740504
score: 0
type: Comment
has text: in the class Operations, What is the advantage of returning ABC so the caller can do ABC.a() over providing a method a() in allOps which calls ABC.a() itself?
type: AnswerComment
comment on: http://stackoverflow.com/a/24929103

http://stackoverflow.com/comment/38720122
comment on: http://stackoverflow.com/q/24919624
has text: Yes, I want to re-create the JAR with new class variables each time.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38757132
score: 0
type: AnswerComment
type: Comment
has text: Still not working... I added what you asked for, and look the log, it might help you help me :)
comment on: http://stackoverflow.com/a/24935940

http://stackoverflow.com/q/24929469
has answer: http://stackoverflow.com/a/24929696
has title: executing bash commands from a specific directory
has body: From my application I have to execute an external jar of which I do not have the source. Given an input file, it processes it, creates an "output" directory and puts in it an mxml output file. Problem is: it creates said directory in tomcat/bin instead of inside the directory of the original file. Here's what I've tried so far. Initially Process p = new ProcessBuilder("java -jar "+newfile.getParent()+"\\converter.jar "+newfile.getPath()+" -mxml").start(); Then, seeing how from console the "output" directory was created in the directory the command was called from, I tried: String startSim[] = {"cd "+newfile.getParent()+"\\" , "java -jar converter.jar "+newfile.getName()+" -mxml"}; try { Runtime.getRuntime().exec(startSim).waitFor(); } catch (Exception e) { e.printStackTrace(); System.out.println("Log non creato."); } But with this I get the "file not found" exception for the first instruction. Does anyone know how to possibly solve this problem? I'd like to avoid having to reach for my output file all the way in my tomcat/bin directory. Thanks for any suggestion! Paolo P.s.: by the way, before trying all this I tried simply calling the method I need from the library, but had the same exact problem. So I resolved to execute the jar, instead. And here we are. :)
score: 0
answer count: 2
tagged with: bash
tagged with: jar
has answer: http://stackoverflow.com/a/24929728
accepted answer: http://stackoverflow.com/a/24929728
possible better answer: http://stackoverflow.com/a/24929696
type: AnsweredQuestion
tagged with: java
type: Question
tagged with: execute

http://stackoverflow.com/q/25052422
has answer: http://stackoverflow.com/a/25134264
answer count: 1
accepted answer: http://stackoverflow.com/a/25134264
type: AnsweredQuestion
has title: How to get the create mode of a path in zookeeper
score: 0
tagged with: java
type: Question
tagged with: apache-zookeeper
has body: In zookeeper, I can usezookeeper.exists(path,false)to check if the path exists. But if the path exists, witch method can I use to get the create mode of the path?(Persistent or Ephemeral)

http://stackoverflow.com/comment/38931993
score: 0
type: QuestionComment
type: Comment
has text: I have the same problem too, it seems that the app is killed if the memory is low and all the static data is gone. I just finish the activity if the static instance that it need is not there. I think I need a better solution too.
comment on: http://stackoverflow.com/q/25032657

http://stackoverflow.com/a/25069430
score: 2
upvote count: 2
accepted answer of: http://stackoverflow.com/q/25063653
has body: This is an interesting question! Basically you want to wait for all child threads to complete, but have no control over them. Here is a demonstration of the technique using ThreadGroup: Assuming you have a MailHelper class like this: public class MailHelper { public void sendMail(){ Thread t = new Thread(new Runnable() { @Override public void run() { System.out.println("MailHelper: Sending mail for 6s"); for(int i = 0; i &lt; 6; i++){ try { Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); } System.out.println("."); } System.out.println("MailHelper: Sent mail!"); } }); t.start(); } } then our Main class demonstrates how use it: public class Main { public static void main(String[] args) throws InterruptedException { final MailHelper mh = new MailHelper(); ThreadGroup mailThreadGroup = new ThreadGroup("mailGroup"); Thread callSendmailThread = new Thread(mailThreadGroup, new Runnable() { @Override public void run() { System.out.println("Calling sendMail()."); mh.sendMail(); System.out.println("sendMail() returned."); } }); callSendmailThread.start(); callSendmailThread.join(); System.out.println("callSendmailThread joined. Waiting for rest of ThreadGroup to finish."); // We cannot rely on ThreadGroup.activeCount() to give us an accurate number, and it could be zero! Thread[] mailThreads = new Thread[mailThreadGroup.activeCount() + 1]; //Therefore retry enumerate until our array was large enough to hold all while ( mailThreadGroup.enumerate( mailThreads, true ) == mailThreads.length ) { mailThreads = new Thread[ mailThreads.length * 2 ]; } for(Thread t : mailThreads){ if(t != null &amp;&amp; t.isAlive()){ System.out.println("Joining thread " + t.getName()); t.join(); System.out.println("Thread " + t.getName() + " joined."); } } mailThreadGroup.destroy(); System.out.println("Done!"); } } The output: Calling sendMail(). sendMail() returned. callSendmailThread joined. Waiting for rest of ThreadGroup to finish. Joining thread Thread-1 MailHelper: S…
answers question: http://stackoverflow.com/q/25063653
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/39094807
type: Answer

http://stackoverflow.com/comment/38853571
comment on: http://stackoverflow.com/a/24985116
type: AnswerComment
score: 0
type: Comment
has text: Thanks you both Benoit and Yves, in version 1.1 there is really no problem.

http://stackoverflow.com/a/24988868
upvote count: 1
downvote count: 0
has body: You can write: float floatprice3 = Float.valueOf(price3.getText().toString().substring(1)); And use DecimalFormat to place a restriction on 2 decimal places DecimalFormat df = new DecimalFormat("#,###,##0.00"); System.out.println(df.format(364565.14));
type: Answer
answers question: http://stackoverflow.com/q/24988814
score: 1

http://stackoverflow.com/a/25032408
has comment: http://stackoverflow.com/comment/38931293
answers question: http://stackoverflow.com/q/25032331
has comment: http://stackoverflow.com/comment/38931334
type: AcceptedAnswer
downvote count: 0
has body: Open /WEB-INF/web.xml You will have to find the servlet-name of the org.apache.struts.action.ActionServlet and the servlet-mapping that corresponds to the servlet-name. For example: action org.apache.struts.action.ActionServlet action *.do Finally, simply change the url-pattern to what you desire and redeploy the application.
type: Answer
upvote count: 2
has comment: http://stackoverflow.com/comment/38931806
score: 2
accepted answer of: http://stackoverflow.com/q/25032331

http://stackoverflow.com/a/25020233
downvote count: 0
has body: If you add constructor with arguments, default-no args constructor wont be available. Hence any attempt to create an instance using no-args constructor will fail. Here, it looks like ,Android itself is trying to create instance of this class reflectively using no-args, but since no-args constructor is not available, it is not able to instantiate new object of Exercise class. You can try providing new no args constructor, and initialize your sqlLite db inside this constructor to avoid null pointer ( just initialize mDB inside empty constructor). something like, public Exercise() { this.mDb = new DataBaseHelper(this).getReadableDatabase(); } . The initialization of mDb depends upon what you are trying to get. It could be readable databse, writable database or so forth. You just need to initialize the mDb here to get your code working. If I were you, I would create another class that this Exercise class can use and use SQL related any features on that new class (as DAO layer) rather than using SQLdatabase in Exercise class ( assumption is that your Exercise class in extending Activty class as of now).
type: Answer
has comment: http://stackoverflow.com/comment/38921630
has comment: http://stackoverflow.com/comment/38943932
answers question: http://stackoverflow.com/q/25018488
score: 3
upvote count: 3

tcp
type: Tag
tags question: http://stackoverflow.com/q/24982286
tags question: http://stackoverflow.com/q/25052691
tags question: http://stackoverflow.com/q/24944171
tags question: http://stackoverflow.com/q/24992501
tag name: tcp

http://stackoverflow.com/comment/38824108
comment on: http://stackoverflow.com/q/24975487
score: 0
type: Comment
has text: Is the top code not working?
type: QuestionComment

http://stackoverflow.com/a/24937470
score: 7
answers question: http://stackoverflow.com/q/24937437
accepted answer of: http://stackoverflow.com/q/24937437
upvote count: 7
type: AcceptedAnswer
type: Answer
has body: Use the ternary operator : String three = (one != null) ? one : two;
downvote count: 0

http://stackoverflow.com/comment/85648313
has text: `HttpURLConnection.getErrorStream()` (`sun.net.www.protocol.http` implementation) returns `null` unless `responseCode >= 400`, so your check for 299 is probably incorrect.
type: AnswerComment
comment on: http://stackoverflow.com/a/34754502
type: Comment
score: 3

http://stackoverflow.com/q/25025167
has comment: http://stackoverflow.com/comment/38918496
score: 0
tagged with: java
has body: I know (or think I know) that using things like prepared statements can help future executions of the same query execute faster. However, I was wondering, if you're using prepared statements but the actual values are the same every time, will it then also additionally optimize using the value? To give a little more context, I want to test performance for a service request that uses an underlying database. The easy route would be to send in the same data each time. The more arduous route would be to ensure the data values were different each time. However, in either case, the same SQL query would be generated -- just the values would be different. So, will these scenarios end up testing the same thing or something different because of potential DB optimization? I've tried to research this topic but I feel like a lot of what I'm reading is over my head. Any good links for someone that knows little about DB optimization would also be welcomed in addition to the central question.
has comment: http://stackoverflow.com/comment/38918659
has comment: http://stackoverflow.com/comment/38918613
has comment: http://stackoverflow.com/comment/38918357
has comment: http://stackoverflow.com/comment/38918717
has comment: http://stackoverflow.com/comment/38918497
tagged with: performance
has answer: http://stackoverflow.com/a/25025255
tagged with: database
has comment: http://stackoverflow.com/comment/38918690
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38918584
has comment: http://stackoverflow.com/comment/38918248
has comment: http://stackoverflow.com/comment/38918546
answer count: 2
tagged with: sql
has comment: http://stackoverflow.com/comment/38918416
has answer: http://stackoverflow.com/a/25026344
has title: Does Oracle SQL database optimize by value?
has comment: http://stackoverflow.com/comment/38918285
type: Question
tagged with: oracle-database

http://stackoverflow.com/comment/84491807
score: 1
comment on: http://stackoverflow.com/a/25085658
type: AnswerComment
type: Comment
has text: IMHO https://stackoverflow.com/a/36966419/474034 provides a much better solution than this.

http://stackoverflow.com/comment/38726153
score: 0
has text: You haven't changed your code (or added any new code) in your question, so we don't know what could be causing the new error. Please see the javadoc [here](http://docs.oracle.com/javase/8/docs/api/java/lang/String.html) for the correct usage of `String` methods. If a method needs a `String` parameter, a `char` won't work.
comment on: http://stackoverflow.com/q/24922854
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/38742554
type: QuestionComment
has text: I am not that familiar with sql requests. But somebody else can surely help you with this. Now that we know that the problem is the request structure
comment on: http://stackoverflow.com/q/24931954
score: 0
type: Comment

http://stackoverflow.com/comment/38791298
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24957395
has text: Is it possible that the table was generated before you made some changes to the annotaitons? Do you get the same result if you delete the table and let Hibernate recreate it?

http://stackoverflow.com/a/25064549
score: 0
type: AcceptedAnswer
type: Answer
has body: 1) If your View is not 'a correct view' it will end up in an endless loop. Try this simple view: public class SecuredView extends VerticalLayout implements View { public SecureView() { addComponent(new Label("Secured View")); } @Override public void enter(ViewChangeEvent event) { } } 2) Your if statement needs to be changed: instead of: event.getNewView().getClass().isInstance(SecuredView.class) write: SecuredView.class.isInstance(event.getNewView());
answers question: http://stackoverflow.com/q/25062828
accepted answer of: http://stackoverflow.com/q/25062828

http://stackoverflow.com/comment/38933870
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25014047
score: 0
has text: I don't want to give root_element_name, node_element_name and other element_names in xml document. I want to get all element names by the program sensing auto.

http://stackoverflow.com/q/25053134
linked to: http://stackoverflow.com/q/17767227
tagged with: android
possible better answer: http://stackoverflow.com/a/31294040
has comment: http://stackoverflow.com/comment/38971363
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38971502
has answer: http://stackoverflow.com/a/25053231
tagged with: java
has title: Null Pointer exception in LayoutInflater in Custom Listview
upvote count: 1
linked to: http://stackoverflow.com/q/19469073
type: Question
has comment: http://stackoverflow.com/comment/38971006
answer count: 2
accepted answer: http://stackoverflow.com/a/25053231
tagged with: android-listview
downvote count: 0
tagged with: baseadapter
score: 1
has answer: http://stackoverflow.com/a/31294040
has body: I am beginner in android. I got NullPointerEcxeption error. i want my activity get me listview and each listview contains image , it;s title, and it's description, i read article this i cant get proper understand what is happen to context in MainActivity.java LayoutInflater... I used Base Adapter instead of ArrayAdapter. Please Help.. Thanks in advance. Here i put some code... one imageview, two textviews CustomeList.xml &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" &gt; &lt;TextView android:id="@+id/textView2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignBottom="@+id/imageView1" android:layout_alignParentRight="true" android:layout_toRightOf="@+id/imageView1" android:text="Descript1" /&gt; &lt;ImageView android:id="@+id/imageView1" android:layout_width="48dp" android:layout_height="48dp" android:layout_alignParentLeft="true" android:layout_alignParentTop="true" android:src="@drawable/img2" /&gt; &lt;TextView android:id="@+id/tv1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignLeft="@+id/textView2" android:layout_alignParentRight="true" android:layout_alignParentTop="true" android:text="Title1" android:textAppearance="?android:attr/textAppearanceMedium" /&gt; &lt;/RelativeLayout&gt; activity_main.xml , which contains the Listview.. &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=".MainActivity" &gt; &lt;ListView android:id="@+id/listView1" android:la…
favorite count: 0

http://stackoverflow.com/comment/38956887
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25045030
score: 1
has text: and also, the DI part of the spring will set the required attributes itself. you need not have to explicitly call setters. once you have the object in hand, and want to save the values, do it normally like you would for any other spring managed objects. it would work fine :)

http://stackoverflow.com/comment/38834755
type: Comment
type: QuestionComment
has text: That's just like `for (int i = 0; i < 1; i++)`, actually.
score: 1
comment on: http://stackoverflow.com/q/24920760

http://stackoverflow.com/q/24968950
has comment: http://stackoverflow.com/comment/38811930
has title: Java: Is it safe to use same subprocess variable after the subprocess finishes?
type: Question
answer count: 2
linked to: http://stackoverflow.com/q/24376768
has answer: http://stackoverflow.com/a/24968975
score: 0
tagged with: java
tagged with: process
has body: Is it safe to reuse the same variable to create another subprocess when the previous subprocess finishes? String cmd = nextCmd(); while(waitForNext) { Process p = Runtime.getRuntime().exec(cmd); String iLine = null; String eLine = null; BufferedReader in = new BufferedReader(new InputStreamReader(p.getInputStream())); BufferedReader err = new BufferedReader(new InputStreamReader(p.getErrorStream())); while((iLine = in.readLine())!=null || (eLine = err.readLine())!=null) { // just to clean the Streams } p.waitFor(); cmd = nextCmd(); } will it be eligible for GC'd if the loop continues for thousand times(for example)?
has comment: http://stackoverflow.com/comment/38811887
has answer: http://stackoverflow.com/a/24969279
type: UnansweredQuestion

http://stackoverflow.com/comment/38844031
comment on: http://stackoverflow.com/a/24983874
score: 0
type: AnswerComment
type: Comment
has text: Yay! That fixed it. Thank you! I guess I just had the 32-bit version of eclipse.

http://stackoverflow.com/a/25027411
answers question: http://stackoverflow.com/q/25027390
downvote count: 0
has body: Modern browsers do not send full path info for file uploads. They only send the short file name. There's no way to retrieve it if the client doesn't send it.
score: 1
type: Answer
has comment: http://stackoverflow.com/comment/38925769
upvote count: 1

http://stackoverflow.com/comment/38741351
has text: Have you verified that simply adding packages makes the Gradle build succeed? I'd think it's a different, unrelated problem.
comment on: http://stackoverflow.com/q/24925175
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/38704146
comment on: http://stackoverflow.com/q/24911633
has text: I have heard about it but, I dont know much. Ill take a look though.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25039227
has comment: http://stackoverflow.com/comment/38970865
answer count: 0
type: UnansweredQuestion
score: 0
tagged with: hook
tagged with: svn
tagged with: java
has body: I have created post-commit hook script for my svn repository. When I make commit from console I can get project (the checkout project) path - using 'pwd' order, because the hook is executed in this directory. But when I commit from Eclipse, I can't get path to project. Is there any simple method to get that? Of course I can get the commited project name using svn commands like svnlook changed and then find it on my disk, but this solution is unreliable. Thanks in advance.
type: Question
has comment: http://stackoverflow.com/comment/38944548
has title: Get project path commited from eclipse
tagged with: bash
tagged with: unix

http://stackoverflow.com/comment/42380216
type: QuestionComment
has text: Load the bundle with a custom Control: http://stackoverflow.com/a/4660195/421245
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25053710

http://stackoverflow.com/q/24910795
has answer: http://stackoverflow.com/a/24929357
accepted answer: http://stackoverflow.com/a/24929357
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38729380
downvote count: 0
tagged with: java
has title: MyBatis annotations to call Stored Procedure and get Out Params
type: Question
tagged with: stored-procedures
upvote count: 2
tagged with: out-parameters
answer count: 1
tagged with: mybatis
has body: I am using MyBAtis-3 with MyBAtis-Spring. When i tried to call a stored procedure that returns more than one out params using MyBatis annotations. I don't get anything, I can see that the input parameter is passed to the SP in the logs and it hangs in there with no progress nor exception thrown. PFB the Oracle Stored Procedure which i am trying to access from MyBAtis, create or replace PROCEDURE C2C.GET_DATA ( "IN_PARAM1" IN NUMBER, "OUT_PARAM2" OUT SAMPLETABLE.COL2%TYPE, "OUT_PARAM3" OUT SAMPLETABLE.COL3%TYPE, "OUT_PARAM4" OUT SAMPLETABLE.COL4%TYPE ) AS BEGIN SELECT PARAM2,PARAM3,PARAM4 INTO OUT_PARAM2,OUT_PARAM3,OUT_PARAM4 FROM C2C.SAMPLETABLE WHERE PARAM1=IN_PARAM1 ; END C2C.GET_DATA; PFB the mapper interface method, @Select(value= "{ CALL C2C.GET_DATA( #{param1, mode=IN, jdbcType=INTEGER},#{param2, mode=OUT, jdbcType=VARCHAR},#{param3, mode=OUT, jdbcType=INTEGER},#{param4, mode=OUT, jdbcType=INTEGER})}") @Options(statementType = StatementType.CALLABLE) public void getData(Test test); The Test object contains the parameters passed as input in the Stored Procedure Call statement. When i execute this, it gets hanged over here, main Slf4jImpl ==&gt; Preparing: { CALL C2C.GET_DATA(?,?,?,?)} main Slf4jImpl ==&gt; Parameters: 60(Integer)
favorite count: 0

http://stackoverflow.com/comment/38740172
comment on: http://stackoverflow.com/a/24928025
has text: Try to set "multipart/form-data" instead of "application/x-www-form-urlencoded"
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/24946764
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/38771594
answer count: 1
has body: After my app is destroyed, when I click an item in my listview, it's supposed to copy the data to the clipboard instead the data is returned null although I do infact count some items in the list. Here's some code: @Override protected void onSaveInstanceState(final Bundle outState) { super.onSaveInstanceState(outState); outState.putStringArrayList("list", listFragment.getLocations()); } public void populateList(final StorageManager topItem, final StorageManager bottomItem) { Thread thread = new Thread(new Runnable() { @Override public void run() { locations = topItem.readFile(); times = bottomItem.readFile(); for (int index = 0; index &lt; locations.size() &amp;&amp; index &lt; times.size(); index++) { Map&lt;String, UserLocation&gt; data = new HashMap&lt;String, UserLocation&gt;(); data.put("Top", new UserLocation(index, locations.get(index))); data.put("Bottom", new UserLocation(index, times.get(index))); list.add(data); } Collections.reverse(list); Collections.reverse(locations); } }); thread.run(); } @Override public void onListItemClick(ListView l, View v, int position, long id) { super.onListItemClick(l, v, position, id); String dataToSend = TwoItemListFragment.locations.get(position); if (null != mListener) { mListener.onFragmentInteraction(TwoItemListFragment.list.get(position).hashCode()); } try { copyData(dataToSend); } catch (NullPointerException e) { Log.d(TAG, dataToSend + ""); } } */ public void copyData(String data) { Context context = getActivity().getApplicationContext(); String copied = getString(R.string.copied); Toast copyToast = Toast.makeText(context, copied, Toast.LENGTH_SHORT); try { cl.setPrimaryClip(ClipData.newPlainText("copy", data)); copyToast.show(); } catch (NullPointerException e) { Log.e(TAG, "Could not copy data: NullPointerException"); Log.d(TAG, String.valueOf(TwoItemListFragment.locations.size())); Log.d(TAG, String.valueOf(TwoItemListFragment.locations.get(1))); copyToast = Toast.makeText(context, getString(R.string.null_text), …
has answer: http://stackoverflow.com/a/24962525
score: 0
has title: Why is my List data null after my android app is destroyed?
tagged with: nullpointerexception
has comment: http://stackoverflow.com/comment/38770680
tagged with: android
has comment: http://stackoverflow.com/comment/38773941
has comment: http://stackoverflow.com/comment/38799999
has comment: http://stackoverflow.com/comment/38770739
accepted answer: http://stackoverflow.com/a/24962525
has comment: http://stackoverflow.com/comment/38771836
has comment: http://stackoverflow.com/comment/38772032
type: Question

http://stackoverflow.com/comment/39190925
has text: Any luck with the logs?
score: 0
comment on: http://stackoverflow.com/q/25055867
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24971453
downvote count: 0
has answer: http://stackoverflow.com/a/24971721
has answer: http://stackoverflow.com/a/24971522
favorite count: 0
has answer: http://stackoverflow.com/a/24971482
answer count: 4
tagged with: reference
has body: i bet this question has been already answered, but i dont know how to explain the question in simple words to find a simple answere on google - I'm sorry! This is my test-code: public class test { public static void increase(Integer i){ i++; } public static void main(String[] args){ Integer x = new Integer(10); increase(x); System.out.println(x); } } I have an Integer x and want to modify it through a void-method "increase(..)". Since Integer is an Object, x is a pointer to that object. I want "increase(..)" to modify the Integer itself, so "i" refers to the same object as "x" does. But if i look at the print(x) (which is "10") i assume that the method creates a new Integer with the content of "x". I hope one can understand me... What i need that for? I am trying to use multiple threads to sum up the numbers from 1 to "n". I created a Class "MyThread" which gets a lowerLimit and an upperLimit to sum up the interval, and a "result" (but as reference - not a new object) where the numbers of the intervals are added onto. Best Regards Tak3r07
upvote count: 3
type: UnansweredQuestion
tagged with: java
tagged with: methods
has title: Let a method modify the reference instead of a new object
type: Question
tagged with: object
score: 3
has answer: http://stackoverflow.com/a/24971540

http://stackoverflow.com/comment/62720552
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/24980097
has text: Did you ever find a solution for this? I am looking to do something similar.

http://stackoverflow.com/a/25062337
type: Answer
accepted answer of: http://stackoverflow.com/q/25044828
score: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25044828
has body: As mentioned in my last comment, the JAR was on the webapp's class which meant the error couldn't be caused by a lack of drivers. Apparently when deploying my WAR file, tomcat was referencing an older WAR file or something with code that was not updated with the code I had posted above. After exporting my WAR file and renaming to an arbitrary name followed by deploying it under that name, I was not getting the error anymore. Something else to think about is the my messiness of code in the previous war file; I wasn't closing PreparedStatement, Result, and even the Connection variables correctly. Updating the war with a different name with the code posted above worked.

http://stackoverflow.com/comment/100400414
type: Comment
has text: can we create a separate configuration class to create the bean, instead of writing it in main class?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24921330

http://stackoverflow.com/comment/38768960
score: 1
has text: No it doesn't. There seems to be a thing called an 'operator buffer', but that doesn't translate to 'buffer is the operator I should be using'. buffer() is a *method* in this case.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24922610

http://stackoverflow.com/comment/38722668
type: QuestionComment
comment on: http://stackoverflow.com/q/24921205
score: 1
has text: I'm also guessing that the `dependencies"` in the last line is supposed to have a `"` before it and that's just a copy-paste error.
type: Comment

http://stackoverflow.com/q/24953805
has body: As we know,in the OpenGL ES the class Renderer on android has 3 function:onDrawFrame, onSurfaceChanged, onSurfaceCreated. and we can load the texture in the onSurfaceCreated and onDrawFrame. I want to know can i load the texture before the "Renderer".Likely, I have a class named "Map",and can i load the images texture in the "Map" before the "GLSurfaceView" created. or can i load the images texture before the function "onSurfaceCreated" and "onDrawFrame". if someone know it,please help me. Thanks!!
downvote count: 0
score: 1
tagged with: java
has title: about opengles and texture on android
type: Question
answer count: 1
has answer: http://stackoverflow.com/a/24967032
favorite count: 0
upvote count: 1
tagged with: android
tagged with: textures
type: UnansweredQuestion
tagged with: opengl-es-2.0

http://stackoverflow.com/q/24982065
has comment: http://stackoverflow.com/comment/38836317
score: -5
tagged with: java
has comment: http://stackoverflow.com/comment/38836910
has answer: http://stackoverflow.com/a/24982212
has title: 'Reading an unknown amount of values'? Unsure what to do
type: Question
upvote count: 0
answer count: 1
downvote count: 5
favorite count: 0
has comment: http://stackoverflow.com/comment/38836311
has body: I need to make a program in Java that reads an unknown amount of values (integers), and when a negative value is entered, the loading shall stop. I'm absolutely clueless about what I should do here, could someone please enlighten me?
has comment: http://stackoverflow.com/comment/38836420
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38836791

http://stackoverflow.com/comment/38873853
score: 0
type: AnswerComment
has text: I have used `Context mContext;` declared globally in DBAdapter, Also tried to call `static Context mContext;` which is declared globally in QueryFragment by using `QueryFragment.mContext`
type: Comment
comment on: http://stackoverflow.com/a/25000591

http://stackoverflow.com/comment/38930413
type: Comment
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/25031950
has text: You've introduced a tight coupling between User and UserPost which will make it essentially impossible to test User in isolation or to give it a mock UserPost to work with.

http://stackoverflow.com/comment/38807633
comment on: http://stackoverflow.com/a/24965905
type: AnswerComment
has text: Thanks Don. Using the entities equals() method to verify the initialised entity is as expected and the insert method is called is what i was after.
score: 0
type: Comment

http://stackoverflow.com/comment/38830420
has text: http://slick.ninjacave.com/javadoc/org/newdawn/slick/SpriteSheet.html
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24978850

http://stackoverflow.com/q/25007057
has title: How do I ignore the alpha content when loading an Image off disk into a BufferedImage
accepted answer: http://stackoverflow.com/a/25007080
type: AnsweredQuestion
tagged with: java
tagged with: bufferedimage
type: Question
has answer: http://stackoverflow.com/a/25007080
has body: Currently, when I load an image off disk, BufferedImage img = ImageIO.read(new File("myfile.png"); The resulting color space is one of ARGB. What I'd prefer is a plain old RGB, but without having to do the filtering myself. Is there a way to open an image in a certain color mode?
score: 0
answer count: 1

http://stackoverflow.com/q/24915682
tagged with: mysql
has comment: http://stackoverflow.com/comment/38712593
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/24916076
tagged with: database
score: 0
has comment: http://stackoverflow.com/comment/38712106
has comment: http://stackoverflow.com/comment/38712116
tagged with: sqlite
has comment: http://stackoverflow.com/comment/38712201
has title: Inserting values in to a database
has answer: http://stackoverflow.com/a/24916154
type: UnansweredQuestion
has body: GOT IT WORKING. thanks everyone for the help I'm new to programming and I'm trying to check if my database is empty. If it is empty, it'll have a record inserted in to it. If not, it should run normal. I'm also checking if the file path exists for my image. Every time I run the program it keeps adding "John" (John should only be added if the database is empty). My code: public class Database { private ArrayList&lt;Person&gt; people; public Database(){ people = new ArrayList&lt;Person&gt;(); } public void run(){ Connection connection = null; ResultSet resultSet = null; Statement statement = null; try { Class.forName("org.sqlite.JDBC"); connection = DriverManager .getConnection("jdbc:sqlite:C:\\Users\\James\\Documents\\GoogleApp\\Peopleinfo.sqlite"); statement = connection.createStatement(); if(people.isEmpty()){ File f = new File ("C:\\Users\\James\\Documents\\GoogleApp\\images\\upload.png"); if (f.exists()){ String sql = "INSERT INTO PeoplesInfo (Name,bio,Image) " + "VALUES ('John','California','C:\\Users\\James\\Documents\\GoogleApp\\images\\upload.png');"; statement.executeUpdate(sql); System.out.println("Image exists"); } else { System.out.println("Image doesn't exist");} } else if (!people.isEmpty()) { String sql = "INSERT INTO PeoplesInfo (Name,bio,Image) " + "VALUES ('Stan','California','C:\\Users\\James\\Documents\\GoogleApp\\images\\upload.png');"; statement.executeUpdate(sql); System.out.println("Record added"); } resultSet = statement .executeQuery("SELECT name, bio, image FROM PeoplesInfo"); while (resultSet.next()) { Person p = new Person(resultSet.getString("name"),resultSet.getString("bio"),resultSet.getString("image")); people.add(p); System.out.println(p.toString()); System.out.println("Retrieved element is = " + p.getName()); } resultSet = statement .executeQuery("SELECT name, bio, image FROM PeoplesInfo"); } catch (Exception e) { e.printStackTrace(); } finally { try { resultSet.close(); statement.close(); connection.close(); } catch (Exception e) {…
tagged with: record
has comment: http://stackoverflow.com/comment/38712460
tagged with: java

http://stackoverflow.com/comment/103532544
type: QuestionComment
comment on: http://stackoverflow.com/q/25010365
score: 1
has text: I believe this is not possible with JAXB. I guess it is not possible for practical reasons - it would be problematic during marshalling. For an enum: `public enum DayOfWeek {MONDAY}` Let's say there was an annotation to do ignore case for the enum. This would be fine during unmarshalling, so "MonDAY", "MONDAY", "monday" could all be resolved into DayOfWeek.MONDAY. When marshalling, there would be a problem into what "version" it would marshal. Maybe an implementation where you provide a value to default for marshalling is possible. But I am not aware of anysolution for this problem in JAXB.
type: Comment

http://stackoverflow.com/a/25062829
has body: A friend helped out and told me to use a boolean if statement to find out if I had already added the panel if (tabEvents.getSelectedComponent().equals(tabAddEvent)) { JPanel jp = new AddEvent(); if (initializedAdd == false) { tabAddEvent.setLayout(new GridBagLayout()); tabAddEvent.add(jp); initializedAdd = true; } } Worked nicely! Once this project is done, I shall be looking closer into all the Layouts though! Thanks to everyone for trying to help.
type: AcceptedAnswer
score: 0
accepted answer of: http://stackoverflow.com/q/25038446
type: Answer
answers question: http://stackoverflow.com/q/25038446

http://stackoverflow.com/comment/38753537
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24937901
has text: A class can only extend one super-class...
type: Comment

http://stackoverflow.com/a/25015481
has body: Create a map &lt;String, AtomicInteger&gt;. Use p.getName() as the key. Use this code in the loop to count the elements by name (or any other key you can think of): AtomicInteger counter = map.get( p.getName() ); if( null == counter ) { counter = new AtomicInteger(); map.put( p.getName(), counter ); } counter.increment();
type: AcceptedAnswer
upvote count: 2
type: Answer
score: 2
answers question: http://stackoverflow.com/q/25015391
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25015391

http://stackoverflow.com/comment/38835884
score: 0
type: Comment
has text: Yes, that's right. The interface, much like header files for C, defines the inputs and outputs of a function and they must be implemented verbatim. Anything that returns, must have their return type defined. So you'd have `public int getLevel() { return this.level; }` instead of `public void getLevel() { return this.level; }`.
type: AnswerComment
comment on: http://stackoverflow.com/a/24977517

http://stackoverflow.com/comment/38982549
has text: okay Gimby, I will try to clearify again. Human interactions cannot be JMS, since JMS is usually implemented by a script, application. Same to web services. You seldomly use a webservice without a UI (of course from enduser perspective). About your question, what a acceptable answer may be, all that may extend the above list of human interactions but not interactions, which may be redirected by one of the new or already given entry points.
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/25054989

http://stackoverflow.com/comment/38814899
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24969545
type: Comment
has text: Are we assuming that the BufferedImage is larger than 800x800 and you are trying to determine how to adjust the players (in 800x800) grid to fit the buffered image?

http://stackoverflow.com/q/24977062
tagged with: java
downvote count: 2
tagged with: file
has comment: http://stackoverflow.com/comment/38827143
has body: Please help. I am trying to make the program access a file named "highscore.txt", then: 1: Write a new number in the file 2: Get the lowest value of a list of numbers in the file. Please post the code if you know how. ***Note: I am new to Java so I barely know how to even access the file*** Edit: I got code that I believe should work, but when I run the program it says Exception in thread "main" java.util.InputMismatchException at java.util.Scanner.throwFor(Scanner.java:864) at java.util.Scanner.next(Scanner.java:1485) at java.util.Scanner.nextDouble(Scanner.java:2413) at game.game.main(game.java:91) Java Result: 1 Here is line 84 - 94, and the code I got. 84: Writer wr = new FileWriter("highscore.txt"); 85: wr.write(tries); 86: wr.close(); 87: lowest = tries; 88: File file = new File("highscore.txt"); 89: Scanner inputFile = new Scanner(file); 90: while (inputFile.hasNext()) { 91: numb = inputFile.nextDouble(); 92: if (numb &lt; lowest) lowest = number; 93: } 94: inputFile.close(); Edit: I have it somewhat working. There is an error and it is that it just puts a random Unicode symbol in the text file. Here is the code for that part: try { int content = tries; File file = new File("highscore.txt"); // if file doesnt exists, then create it if (!file.exists()) { file.createNewFile(); } FileWriter fw = new FileWriter(file.getAbsoluteFile()); BufferedWriter bw = new BufferedWriter(fw); bw.write(content); bw.close(); } catch (IOException e) { e.printStackTrace(); } Writer wr = new FileWriter("highscore.txt"); wr.write(tries); wr.close(); lowest = tries; File file = new File("highscore.txt"); Scanner inputFile = new Scanner(file); while (inputFile.hasNextInt()) { numb = inputFile.nextInt(); if (numb &lt; lowest) lowest = numb; } File: 32 12 7 9 18 66 13 17 91
type: Question
score: -2
has comment: http://stackoverflow.com/comment/38827150
upvote count: 0
has answer: http://stackoverflow.com/a/24977950
answer count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/24977950
type: AnsweredQuestion
has title: I need to use a file to update/get High Score information

http://stackoverflow.com/comment/38766006
has text: That worked. But I am getting the problem in Two.jsp now. Can you please look into my EDIT?
type: AnswerComment
type: Comment
score: 0
comment on: http://stackoverflow.com/a/24943780

http://stackoverflow.com/comment/38945754
score: 0
type: Comment
has text: No. There should be another method B.access$0 that grants access to B.y from BB. As this method is static it is not overwritten! The example should just have shown what could happen if it was an instance method. Sorry, maybe it was too confusing.
type: AnswerComment
comment on: http://stackoverflow.com/a/25037616

drupal
type: Tag
tag name: drupal
tags question: http://stackoverflow.com/q/25068646

http://stackoverflow.com/a/24961293
accepted answer of: http://stackoverflow.com/q/24960817
upvote count: 2
answers question: http://stackoverflow.com/q/24960817
has comment: http://stackoverflow.com/comment/39132986
has body: Here is what I have with Hibernate 4 and spring 3.2: You need to use @EnableTransactionManagement for your config class. @Configuration @EnableTransactionManagement @PropertySource({ "classpath:application.properties" }) @ComponentScan({ "org.mysample.model" }) public class PersistenceConfig { @Autowired private Environment env; @Bean public LocalSessionFactoryBean sessionFactory() { LocalSessionFactoryBean sessionFactory = new LocalSessionFactoryBean(); sessionFactory.setDataSource(restDataSource()); sessionFactory.setPackagesToScan(new String[] { "org.mysample.model" }); sessionFactory.setHibernateProperties(hibernateProperties()); return sessionFactory; } @Bean public DataSource restDataSource() { BasicDataSource dataSource = new BasicDataSource(); dataSource.setDriverClassName(env.getProperty("jdbc.driverClassName")); dataSource.setUrl(env.getProperty("jdbc.url")); dataSource.setUsername(env.getProperty("jdbc.username")); dataSource.setPassword(env.getProperty("jdbc.password")); return dataSource; } @Bean @Autowired public HibernateTransactionManager transactionManager(SessionFactory s) { HibernateTransactionManager txManager = new HibernateTransactionManager(); txManager.setSessionFactory(s); return txManager; } } If you need more configuration you can add them by annotating with @Bean. These are several dependencies including hibernate-core:4.3.5.Final and javassist:3.18.1-GA UPDATED: If you define some of your configurations in application.properties file, Spring automatically constructs your Datasource and other configurations: Common application properties
score: 2
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/38799387
type: Answer
has comment: http://stackoverflow.com/comment/38798726
has comment: http://stackoverflow.com/comment/39227875

http://stackoverflow.com/comment/38816007
type: Comment
has text: Do you mean this? public class Model_DB { private String direc,usuario,password,driver; public Model_DB() { this.direc="jdbc:mysql://localhost/java"; this.usuario="root"; this.password=""; this.driver="com.mysql.jdbc.Driver"; }
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24970928

http://stackoverflow.com/comment/38890066
type: AnswerComment
type: Comment
has text: But fail when it try to return result.
comment on: http://stackoverflow.com/a/25009600
score: 0

http://stackoverflow.com/q/24927893
score: 0
has title: Java How to update time elpased for specific objects
tagged with: timer
has body: I'm programming a Kitchen Display System where it takes orders from the counter and post it I'm having troubles with the Timer my problem is that when an order is received the timer restarts to 0 here's my code private void addComponent() { //////component adding codes final Calendar startTime = Calendar.getInstance(); timer.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { String x; DecimalFormat df = new DecimalFormat("00"); long endTime = System.currentTimeMillis(); long diff = endTime - startTime.getTimeInMillis(); int h = (int) (diff) / (60*60*1000); diff -= h * (60*60*1000); int m = (int) (endTime-startTime.getTimeInMillis()) / (60*1000); diff -= m * (60 * 1000); int s = (int) (diff / 1000); //time.setText(df.format(h) + ":" + df.format(m)+ ":" + df.format(s)); x=df.format(h) + ":" + df.format(m)+ ":" + df.format(s); time.setText(x); revalidate(); repaint(); } }); timer.start(); } public static void main(String[] args) { KitchenStation frame=new KitchenStation(); frame.setSize(1000, 600); frame.setVisible(true); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setLocationRelativeTo(null); do { try { frame.gui.removeAll(); frame.addComponent(); frame.getContentPane().validate(); frame.getContentPane().repaint(); frame.receiveFile(); }catch(IOException ex) { ex.printStackTrace(); } }while(true); }
type: UnansweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/24928259
answer count: 1

http://stackoverflow.com/comment/38882942
comment on: http://stackoverflow.com/q/25006618
has text: Got it .. couldn't find it in search before.
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/38889708
type: Comment
type: QuestionComment
has text: How does this code work? The `LIMIT` clause of the SQL statement says get me the first 1000 rows, and you then move to the 200,000th row of the result set. I would have thought you'd end up with `rs2.next()` returning `false`, and the `while` loop doing nothing. What am I missing?
comment on: http://stackoverflow.com/q/25008939
score: 0

http://stackoverflow.com/q/24954345
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/38785047
favorite count: 0
has body: I've enabled spring mvc annotation driven in the my project. After that the spring tags does not work as previously: &lt;spring:bind path="list"&gt; &lt;form:select path="mMaxFrequency"&gt; &lt;form:options items="${status.value}"/&gt; &lt;/form:select&gt; &lt;/spring:bind&gt; During rendering a jsp page, I've got the following exception: Caused by: javax.servlet.jsp.JspException: Type [java.lang.String] is not valid for option items My controller: @RequestMapping(method = RequestMethod.GET) public String show(@ModelAttribute("form") AccessForm form, Map&lt;String, Object&gt; model) throws IOException { AccessSettings settings = getAccessSettings(); form.setAlertSettings(settings.getAlertSettings()); form.setMaxFrequency(settings.getMaxFrequency()); return "page"; } public class AccessForm{ public List&lt;Long&gt; getList() { // some custom logic that generate long items } } Any ideas what is wrong?
type: UnansweredQuestion
has title: ${status.value} does not work
upvote count: 1
tagged with: spring
tagged with: spring-mvc
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/38784369
type: Question
has comment: http://stackoverflow.com/comment/38784422
has answer: http://stackoverflow.com/a/24954469
has comment: http://stackoverflow.com/comment/38793301
tagged with: jsp
has comment: http://stackoverflow.com/comment/38784201
has comment: http://stackoverflow.com/comment/38784739
has comment: http://stackoverflow.com/comment/38784550
has comment: http://stackoverflow.com/comment/38784516
has comment: http://stackoverflow.com/comment/38784791

http://stackoverflow.com/comment/38778979
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24942229
has text: You should rather use `Math.toDegree(angle)` for conversion. Won't solve your problem but avoids puzzled faces...

http://stackoverflow.com/q/24928501
score: -1
has body: in LWJGL I add text to my Display. When done, the program drops to about 1-2FPS. I have capped it with Display.sync(60); Without text, it runs fine. With, absolutely... terrible? Here is the source for my text: import java.awt.Font; import java.io.InputStream; import org.newdawn.slick.Color; import org.newdawn.slick.TrueTypeFont; import org.newdawn.slick.util.ResourceLoader; public class Text { private TrueTypeFont font2; public void drawString(String font, String string, int x, int y, Color color) { // TODO: Fix extreme lag issues. try { InputStream inputStream = ResourceLoader.getResourceAsStream(font); Font awtFont = Font.createFont(Font.TRUETYPE_FONT, inputStream); awtFont = awtFont.deriveFont(24f); // set font size font2 = new TrueTypeFont(awtFont, false); Color.white.bind(); font2.drawString(x, y, string, color); } catch (Exception e) { e.printStackTrace(); } } } Dont exactly want to release my games source but heres the code that displays the text. // Initialization code OpenGL glMatrixMode(GL_PROJECTION); glLoadIdentity(); glOrtho(0, WIDTH, HEIGHT, 0, 1, -1); glMatrixMode(GL_MODELVIEW); glEnable(GL_TEXTURE_2D); glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); Text t = new Text(); t.drawString("res/Minecraftia.ttf", "test", 0, 0, Color.yellow); Edit: // Initialization code OpenGL glMatrixMode(GL_PROJECTION); glLoadIdentity(); glOrtho(0, WIDTH, HEIGHT, 0, 1, -1); glMatrixMode(GL_MODELVIEW); glEnable(GL_TEXTURE_2D); glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glClear(GL_COLOR_BUFFER_BIT); while (!Display.isCloseRequested()) { // Render init(); input(); grid.draw(); drawSelectionBox(); Display.update(); Display.sync(60); } Display.destroy(); System.exit(0); } private void init() { // This is what i'm meant to do???? Text t = new Text(); t.drawString("res/Minecraftia.ttf", "test", 0, 0, Color.white); } Edit again: (Hope not too long) public Boot() { try { Display.setDisplayMode(new DisplayMode(WIDTH, HEIGHT)); Disp…
type: Question
accepted answer: http://stackoverflow.com/a/24928659
upvote count: 0
answer count: 1
favorite count: 0
tagged with: fonts
has title: LWJGL text problems and framerate drops
has answer: http://stackoverflow.com/a/24928659
downvote count: 1
type: AnsweredQuestion
tagged with: java
tagged with: lwjgl

http://stackoverflow.com/comment/38975010
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25045495
has text: Yes. For example via em.createNativeQuery("CREATE TABLE SAMPLE_TABLE(SOME_ID BIGINT NOT NULL)").executeUpdate(); And later on using ALTER TABLE ...
score: 0

http://stackoverflow.com/q/24989653
type: Question
has body: I have a Maven project, which builds 6 separate Maven projects in Jenkins. The problem I face is that over the time the project build fails giving the 137 error code: ERROR: Maven JVM terminated unexpectedly with exit code 137 The project could be built successfully using same Maven goals in the console, but in Jenkins it fails. By restarting Jenkins the problem can be resolved. I have some static array lists. These lists are used for some test cases. Could this be a memory leak?
has answer: http://stackoverflow.com/a/33903891
has comment: http://stackoverflow.com/comment/38851026
has comment: http://stackoverflow.com/comment/42367962
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/34162804
score: 51
answer count: 5
upvote count: 51
linked to: http://stackoverflow.com/q/8643434
has answer: http://stackoverflow.com/a/43480927
has title: Jenkins Maven Build 137 Error
has answer: http://stackoverflow.com/a/49077600
has comment: http://stackoverflow.com/comment/51925804
tagged with: jenkins
type: UnansweredQuestion
tagged with: maven
tagged with: java
has answer: http://stackoverflow.com/a/24991433
has comment: http://stackoverflow.com/comment/38852472

http://stackoverflow.com/q/24943724
has body: I know this has been asked a million times before, but nothing is working for me. I have a service in a separate class that needs to be started when a button is pushed, after an application is launched from a LaunchIntent. Long story short, here's my goal: run commands>wait three seconds for commands to run>launch app>start service The service is to monitor for the CONFIGURATION_CHANGED broadcast. Manifest (the parts that matter): &lt;/activity&gt; &lt;receiver android:name="MyReceiver" &gt; &lt;intent-filter&gt; &lt;action android:name="android.intent.action.CONFIGURATION_CHANGED" &gt; &lt;/action&gt; &lt;/intent-filter&gt; &lt;/receiver&gt; &lt;service android:enabled="true" android:name=".MyService" /&gt; &lt;/application&gt; &lt;/manifest&gt; MyService.java: import android.content.Context; import android.content.Intent; import android.os.IBinder; import android.widget.Toast; import android.app.Service; public class MyService extends Service { String[] commandsdefault = {"/x"}; public void onCreate() { Toast.makeText(this, "x", Toast.LENGTH_SHORT); } public void onDestroy() { Toast.makeText(this, "x", Toast.LENGTH_SHORT); } public void onReceive(Context context, Intent intent) { MainActivity ogres = new MainActivity(); ogres.RunAsRoot(commandsdefault); } @Override public void onStart(Intent intent, int startid) { Toast.makeText(this, "x", Toast.LENGTH_SHORT); } @Override public IBinder onBind(Intent intent) { return null; } } And then I simply have the following line in my MainActivity.java to call the service to start: startService(new Intent(getApplicationContext(), MyService.class)); I am more confused than a mosquito in a mannequin shop. LogCat is returning absolutely nothing helpful other than u=0 not found. Do I have something incorrect here? I'm not even seeing toasts from the service starting.
answer count: 4
has answer: http://stackoverflow.com/a/24944024
tagged with: service
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24956058
tagged with: android
tagged with: android-intent
has title: Service not starting when button is pressed?
has answer: http://stackoverflow.com/a/24944127
has comment: http://stackoverflow.com/comment/38765791
tagged with: java
has answer: http://stackoverflow.com/a/24943879
type: Question
has comment: http://stackoverflow.com/comment/38765681
score: 0

http://stackoverflow.com/q/25040930
has answer: http://stackoverflow.com/a/43634483
type: Question
tagged with: twitter4j
has answer: http://stackoverflow.com/a/29975081
tagged with: java
tagged with: twitter
answer count: 3
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/38949977
has body: I'm very new to twitter API (using Twitter4j) to read my tweets. I have set up my app with the twitter and got the KEY,SECRET and TOKEN/TOKENSECRET Below is the code which I have written. public final class ReadTweets { public static void main(String[] args) { ConfigurationBuilder cb = new ConfigurationBuilder(); cb.setDebugEnabled(true) .setOAuthConsumerKey("myKEY") .setOAuthConsumerSecret("mySECRET") .setOAuthAccessToken("myTOKEN") .setOAuthAccessTokenSecret("myTOKENSECRET"); TwitterFactory tf = new TwitterFactory(cb.build()); Twitter twitter = tf.getInstance(); try { ResponseList&lt;Status&gt; a = twitter.getUserTimeline(new Paging(1,5)); for(Status b :a){ System.out.println(b.getText()); } } catch (TwitterException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } But Im getting the following error. api.twitter.com Relevant discussions can be found on the Internet at: http://www.google.co.jp/search?q=4be80492 or http://www.google.co.jp/search?q=0bf5b837 TwitterException{exceptionCode=[4be80492-0bf5b837 d7e149ce-72c14a70], statusCode=-1, message=null, code=-1, retryAfter=-1, rateLimitStatus=null, version=4.0.2} at twitter4j.HttpClientImpl.handleRequest(HttpClientImpl.java:178) at twitter4j.HttpClientBase.request(HttpClientBase.java:53) at twitter4j.HttpClientBase.get(HttpClientBase.java:71) at twitter4j.TwitterImpl.get(TwitterImpl.java:1556) at twitter4j.TwitterImpl.getUserTimeline(TwitterImpl.java:167) at com.test.twitter.UpdateStatus.main(UpdateStatus.java:47) Caused by: java.net.UnknownHostException: api.twitter.com at java.net.AbstractPlainSocketImpl.connect(Unknown Source) at java.net.PlainSocketImpl.connect(Unknown Source) at java.net.SocksSocketImpl.connect(Unknown Source) at java.net.Socket.connect(Unknown Source) at sun.security.ssl.SSLSocketImpl.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 …
has answer: http://stackoverflow.com/a/29654085
score: 2
upvote count: 2
type: UnansweredQuestion
has title: Twitter4j Api not working, java.net.UnknownHostException: api.twitter.com

http://stackoverflow.com/q/24984188
has comment: http://stackoverflow.com/comment/109916937
has body: I expect to get only one sql query, but I run into the N+1 select trap. I don't really understand why. Here is is the problem in detail: I have an entity "PlayerRef": @Entity @Table(name = "player_ref") public class PlayerRef { //constructor etc... @OptimisticLock(excluded = true) @LazyCollection(LazyCollectionOption.TRUE) @ManyToMany(fetch = FetchType.LAZY, mappedBy = "playerRefs") public Set&lt;Player&gt; getPlayers() { return players; } } And a class Player: @Entity @Table(name = "player") public class Player { //constructor etc... @OptimisticLock(excluded = true) @LazyCollection(LazyCollectionOption.TRUE) @ManyToMany(fetch = FetchType.LAZY) @JoinTable(name="cr_player_ref_player", joinColumns = { @JoinColumn(name="player_id", unique = true) } ,inverseJoinColumns = { @JoinColumn(name="player_ref_id") } ) private Set&lt;PlayerRef&gt; getPlayerRefs() { return this.playerRefs; } } Now, in my program I use the following HQL query to get all playerRef entities: Query playerRefQ = session.createQuery("select playerRef from PlayerRef playerRef ") .setReadOnly(true); playerRefQ.setParameter("sport", sport); @SuppressWarnings("unchecked") List&lt;PlayerRef&gt; allPlayerRefs = playerRefQ.list(); This results in the N+1 Select statements: 1) select playerref0_.id as id1_21_0_, ... from player_ref playerref0_ N times) select players0_.player_ref_id as player_r2_21_0_, players0_.player_id as player_i1_34_0_, player1_.id as id1_19_1_, ... from cr_player_ref_player players0_ inner join betdata.player player1_ on players0_.player_id=player1_.id where players0_.player_ref_id=? This is (again) very unexpected, since I thought the collection is lazy loaded and the set of players of each playerRef should be a hibernate-proxy. Anyone knows how I can really only load the playerRef entities without also loading the associated players? For my use case I need all playerRefs but not the associated players. In an earlier question of mine it was suggested, that somehow the toString() method …
has answer: http://stackoverflow.com/a/24984266
tagged with: sql
upvote count: 1
has title: Why do I get N+1 select queries when lazy loading many-to-many entities
answer count: 1
favorite count: 0
tagged with: lazy-loading
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/110106501
linked to: http://stackoverflow.com/q/24982217
downvote count: 0
score: 1
tagged with: java
tagged with: hibernate
linked to: http://stackoverflow.com/q/4805859
type: Question

http://stackoverflow.com/a/24929540
upvote count: 5
type: AcceptedAnswer
downvote count: 2
type: Answer
score: 3
accepted answer of: http://stackoverflow.com/q/24929175
has body: If I understood you well, you are interested in running tomcat on your event from application. If it is the case, you can write your own method to run tomcat. This is example: public void stopRunTomcat(){ try{ Socket s = new Socket(server,8005); if(s.isConnected()){ PrintWriter print = new PrintWriter(s.getOutputStream(),true); //Stop tomcat if it is already started print.println("SHUTDOWN"); print.close(); s.close(); } //Run tomcat Runtime.getRuntime().exec(System.getProperty("catalina.home")+"\\bin\\startup.sh"); }catch (Exception ex){ ex.printStackTrace(); } } You have to adopt this code to your paths and OS. After that you can call this method from event which have to raise tomcat. I hope that helps.
answers question: http://stackoverflow.com/q/24929175

http://stackoverflow.com/q/24987801
has body: I have been using plattysoft's ListAsGridBaseAdapter to display gridview items with a scrollable header on top. My gridview has 2 columns and when I have an odd number of items (like 1 item) to display, nothing comes up on the gridview, only the header is shown. The items are only shown when there are an even number of items (like 2 or 4 items). I've been trying to debug this for awhile and can't figure out what in the code linked is causing this. EDIT: The grid does not show the n-th odd elements for 1, 3, 5, 7, and 9 gridview items. If you have 10 or more gridview items then it displays all of the items. The edited version of ListAsGridExampleAdapter.java is below: public class ListAsGridExampleAdapter extends ListAsGridBaseAdapter { private List&lt;Item&gt; items = new ArrayList&lt;Item&gt;(); private LayoutInflater inflater; private Context context; public ListAsGridAdapter(Context context) { super(context); this.context = context; inflater = LayoutInflater.from(context); items.add(new Item("item 1/5", "item", R.drawable.item_pic, 0, 0)); items.add(new Item("item 2/5", "item", R.drawable.item_pic, 0, 0)); items.add(new Item("item 3/5", "item", R.drawable.item_pic, 0, 0)); items.add(new Item("item 4/5", "item", R.drawable.item_pic, 0, 0)); items.add(new Item("item 5/5", "item", R.drawable.item_pic, 0, 0)); } @Override public Object getItem(int position) { return items.get(position); } @Override public long getItemId(int position) { return position; } @Override public int getItemCount() { return items.size(); } @Override protected View getItemView(int position, View view, ViewGroup viewGroup) { View item = view; if (view == null) { item = inflater.inflate(R.layout.item_view, viewGroup, false); item.setTag(R.id.item_icon, item.findViewById(R.id.item_icon)); item.setTag(R.id.item_title, item.findViewById(R.id.item_title)); } Item currentItem = (Item)getItem(position); // Fill the view ImageView itemImage = (ImageView)item.getTag(R.id.item_icon); itemImage.setImageRe…
answer count: 1
downvote count: 0
tagged with: baseadapter
accepted answer: http://stackoverflow.com/a/24991087
favorite count: 0
has comment: http://stackoverflow.com/comment/38854805
tagged with: gridview
tagged with: listadapter
upvote count: 2
tagged with: android
has title: ListAsGridBaseAdapter only displays grid items when there are even number of items
has comment: http://stackoverflow.com/comment/38852330
type: AnsweredQuestion
score: 2
has comment: http://stackoverflow.com/comment/38853517
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/38853431
has answer: http://stackoverflow.com/a/24991087

http://stackoverflow.com/q/24932262
type: UnansweredQuestion
has body: Yesterday multiple people on Stack recommended using try-with-resources. I am doing this for all my database operations now. Today I wanted to change Statement to PreparedStatement to make the queries more secure. But when I try to use a prepared statement in try-with-resources I keep getting errors like 'identifier expected' or ';' or ')'. What am I doing wrong? Or isnt this possible? This is my code: try (Connection conn = DriverManager.getConnection(DBURL, DBUSER, DBPASS); PreparedStatement stmt = conn.prepareStatement("SELECT id FROM users WHERE id = ? LIMIT 1"); stmt.setInt(1, user); ResultSet rs = stmt.executeQuery()) { // if no record found if(!rs.isBeforeFirst()) { return false; } // if record found else { return true; } } catch (SQLException e) { // log error but dont do anything, maybe later String error = "SQLException: " + e.getMessage() + "\nSQLState: " + e.getSQLState() + "\nVendorError: " + e.getErrorCode(); return false; }
has answer: http://stackoverflow.com/a/24932498
upvote count: 6
has title: Java prepared statement in try-with-resources not working
tagged with: java
score: 6
linked to: http://stackoverflow.com/q/8066501
tagged with: prepared-statement
type: Question
has answer: http://stackoverflow.com/a/24932335
duplicate of: http://stackoverflow.com/q/8066501
has comment: http://stackoverflow.com/comment/38742813
has answer: http://stackoverflow.com/a/24932351
answer count: 3
tagged with: sql
downvote count: 0
favorite count: 0

http://stackoverflow.com/q/24922153
has body: Hi I am looking for a way to use the JUnit's TemporaryFolder inside the Spring config file. But I am getting the following error. Caused by: java.lang.IllegalStateException: the temporary folder has not yet been created at org.junit.rules.TemporaryFolder.getRoot(TemporaryFolder.java:127) at org.junit.rules.TemporaryFolder.newFolder(TemporaryFolder.java:92) at org.junit.rules.TemporaryFolder.newFolder(TemporaryFolder.java:84) This is my setup @Configuration public static class TestConfig { @ClassRule private final static TemporaryFolder tempFolder = new TemporaryFolder (); @Bean public TestBean testBean(){ return new TestBean(tempFolder.newFolder(); } } @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(classes = {TestConfig.class}) public SomeTesT{ } I even tried to initialize the TemporaryFolder in the static block and that did not work either.
has title: Spring Config with JUnit temporary folder
has comment: http://stackoverflow.com/comment/38724507
type: AnsweredQuestion
tagged with: junit
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/38725335
has comment: http://stackoverflow.com/comment/38724958
has answer: http://stackoverflow.com/a/24929665
tagged with: spring
answer count: 1
accepted answer: http://stackoverflow.com/a/24929665
tagged with: spring-test
score: 4
tagged with: junit4
tagged with: java
upvote count: 4
downvote count: 0

http://stackoverflow.com/a/25062072
downvote count: 0
has body: As a best practice you should create a virtual repository which will aggregate all the remote and local repositories you would like to resolve from. The virtual repository hides the access details of the underlying repositories letting users work with a single, well-known URL. This way you can make sure that only remote repositories that you trust are being used. In addition the underlying participating repositories and their access rules may be changed without requiring any client-side changes.
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/25040924
score: 1

spring-test
tags question: http://stackoverflow.com/q/24922153
tag name: spring-test
type: Tag
tags question: http://stackoverflow.com/q/25065849

http://stackoverflow.com/q/25006764
tagged with: java
accepted answer: http://stackoverflow.com/a/25006851
tagged with: hibernate
type: Question
linked to: http://stackoverflow.com/q/1082095
linked to: http://stackoverflow.com/q/2428706
has title: Deleting ManyToMany relationship?
has body: I'm looking for how to delete a relationship of @ManyToMany. I found this link: How to remove entity with ManyToMany relationship in JPA (and corresponding join table rows)? I'm trying do that, but still doesn't work to me. here my code @Entity @Table(name="aluno") public class Aluno { @Id @GeneratedValue private Integer id; //informacoes gerais @NotNull private String nome; //federacao @ManyToMany(cascade = { CascadeType.REMOVE, CascadeType.PERSIST, CascadeType.MERGE, CascadeType.REFRESH }) @JoinTable(name = "FederacaoAluno", joinColumns = @JoinColumn(name = "id_aluno"), inverseJoinColumns = @JoinColumn(name = "id_federacao")) private List&lt;Federacao&gt; federacao; //get and set @Entity @Table(name="federacao") public class Federacao { @Id @GeneratedValue private Integer id; @NotNull @Column(unique = true) private String federacao; @ManyToMany(mappedBy = "federacao") private List&lt;Aluno&gt; aluno; //get and set here how to I'm trying //now works :) public void removeFederacaoFromAluno(Federacao f){ Federacao federacao = em.find(Federacao.class, f.getId()); em.getTransaction().begin(); for(Aluno a : federacao.getAluno()){ a.getFederacao().remove(federacao); } em.getTransaction().commit(); } Any idea ? /** Exception */ Exception in thread "AWT-EventQueue-0" 23:29:49,441 DEBUG [org.hibernate.ejb.AbstractEntityManagerImpl] - Mark transaction for rollback java.lang.IllegalArgumentException: Removing a detached instance br.com.iguana.beans.Federacao#3 at org.hibernate.ejb.event.EJB3DeleteEventListener.performDetachedEntityDeletionCheck(EJB3DeleteEventListener.java:67) at org.hibernate.event.internal.DefaultDeleteEventListener.onDelete(DefaultDeleteEventListener.java:107) at org.hibernate.event.internal.DefaultDeleteEventListener.onDelete(DefaultDeleteEventListener.java:74) at org.hibernate.internal.SessionImpl.fireDelete(SessionImpl.java:946) at org.hibernate.internal.SessionImpl.delete(SessionImpl.java:925) at org.hibernate.ejb.AbstractEntityManagerImpl.remove(Abstr…
score: 0
tagged with: jpa
answer count: 1
has answer: http://stackoverflow.com/a/25006851
tagged with: persistence
has comment: http://stackoverflow.com/comment/38882988
type: AnsweredQuestion

http://stackoverflow.com/comment/38804343
comment on: http://stackoverflow.com/q/24964639
has text: No problem ! Living and learning haha
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38876801
type: AnswerComment
has text: If there is a method of code which, depending upon some complex conditions, may or may not read a `final` field, and if that code may be run both before and after the field is written, a compiler would in the general case have no way of knowing whether it would ever in fact read the field before it was written.
comment on: http://stackoverflow.com/a/24990921
type: Comment
score: 0

http://stackoverflow.com/a/24998976
answers question: http://stackoverflow.com/q/24998874
type: Answer
upvote count: 3
accepted answer of: http://stackoverflow.com/q/24998874
has body: You can change the "Project SDK" in the Project Structure menu : If you are talking about different modules that require different Java versions, you can also change the "Module SDK" version in the Modules menu (Dependencies tab).
score: 3
has comment: http://stackoverflow.com/comment/38868680
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/24931330
has comment: http://stackoverflow.com/comment/38745249
has comment: http://stackoverflow.com/comment/38743993
has comment: http://stackoverflow.com/comment/38744022
has comment: http://stackoverflow.com/comment/38747087
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24931169
has comment: http://stackoverflow.com/comment/38745677
has comment: http://stackoverflow.com/comment/38744233
has comment: http://stackoverflow.com/comment/38744411
answers question: http://stackoverflow.com/q/24931169
upvote count: 3
has comment: http://stackoverflow.com/comment/38743719
type: Answer
has comment: http://stackoverflow.com/comment/38746115
downvote count: 0
has comment: http://stackoverflow.com/comment/38743542
has comment: http://stackoverflow.com/comment/38743973
has comment: http://stackoverflow.com/comment/38746455
score: 3
has comment: http://stackoverflow.com/comment/38746957
has body: You can force the focus on another Widget that's not your Table. By doing that, you'll loose the dotted line (which represents the focus). Here is an example: public static void main(String[] args) { final Display display = new Display(); final Shell shell = new Shell(display); shell.setText("StackOverflow"); shell.setLayout(new GridLayout(2, true)); final Button button = new Button(shell, SWT.PUSH); button.setText("Focus catcher"); final Table table = new Table(shell, SWT.BORDER | SWT.FULL_SELECTION); table.setHeaderVisible(true); for (int col = 0; col &lt; 3; col++) new TableColumn(table, SWT.NONE).setText("Col " + col); for (int i = 0; i &lt; 10; i++) { TableItem item = new TableItem(table, SWT.NONE); for (int col = 0; col &lt; table.getColumnCount(); col++) item.setText(col, "Cell " + i + " " + col); } for (int col = 0; col &lt; table.getColumnCount(); col++) table.getColumn(col).pack(); table.addListener(SWT.Selection, new Listener() { @Override public void handleEvent(Event event) { table.deselectAll(); button.setFocus(); button.forceFocus(); } }); shell.pack(); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); }

http://stackoverflow.com/comment/127855768
score: 2
comment on: http://stackoverflow.com/a/25012003
type: AnswerComment
type: Comment
has text: @Sip 403 is "forbidden". Response payload is possible but not mandatory. https://datatracker.ietf.org/doc/html/rfc7231#section-6.5.3

http://stackoverflow.com/comment/96219189
has text: Sorry, lost track of it :)
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25021336

http://stackoverflow.com/a/24962791
upvote count: 6
has comment: http://stackoverflow.com/comment/38800577
has comment: http://stackoverflow.com/comment/63647009
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38800752
answers question: http://stackoverflow.com/q/24962626
type: Answer
has body: To get the user's email address: private GoogleApiClient mGoogleApiClient; mGoogleApiClient = new GoogleApiClient.Builder(this) .addConnectionCallbacks(this) .addOnConnectionFailedListener(this) .addApi(Plus.API, null) .addScope(Plus.SCOPE_PLUS_LOGIN) .build(); emailAddr = Plus.AccountApi.getAccountName(mGoogleApiClient); An alternative way would be to query Google+'s plus.profile.emails.read scope (as you have done) but instead of displayName, look for "emails" type jsons, see code example here.
accepted answer of: http://stackoverflow.com/q/24962626
downvote count: 0
score: 6

http://stackoverflow.com/a/24996964
has comment: http://stackoverflow.com/comment/38898089
accepted answer of: http://stackoverflow.com/q/24996852
answers question: http://stackoverflow.com/q/24996852
type: AcceptedAnswer
downvote count: 0
upvote count: 28
type: Answer
score: 28
has body: The basic for statement structure is as follows: BasicForStatement: for ( [ForInit] ; [Expression] ; [ForUpdate] ) Statement Now, from JLS §14.14.1.3. Abrupt Completion of for Statement: If execution of the Statement completes abruptly because of a continue with no label, then the following two steps are performed in sequence: First, if the ForUpdate part is present, the expressions are evaluated in sequence from left to right; their values, if any, are discarded. If the ForUpdate part is not present, no action is taken. Second, another for iteration step is performed. If execution of the Statement completes abruptly because of a continue with label L, then there is a choice: If the for statement has label L, then the following two steps are performed in sequence: First, if the ForUpdate part is present, the expressions are evaluated in sequence from left to right; their values, if any, are discarded. If the ForUpdate is not present, no action is taken. Second, another for iteration step is performed. If the for statement does not have label L, the for statement completes abruptly because of a continue with label L. (emphasis mine) ForUpdate, in your case, is i++. Based on what's above: Your first snippet falls under the first case, so i is incremented. Your second snippet falls under the second case, so i is not incremented because the for statement completes abruptly. Note that if you had continue LABEL1 in your second snippet, i would have been incremented as in your first snippet (in accordance with the JLS). As a tip for the future, for definitive answers regarding language rules/semantics, you should always consult the language specification. For Java, that's the JLS.

http://stackoverflow.com/q/25000446
possible better answer: http://stackoverflow.com/a/25000610
has answer: http://stackoverflow.com/a/25000610
downvote count: 0
has title: RelativeLayout onClick attribute not working
favorite count: 0
has answer: http://stackoverflow.com/a/25000942
tagged with: android
has body: I am showing a List in a ListView through a custom adapter SongsListAdapter.java with custom itemview music_item.xml and there is a method i want to call in my Activity Class MainActivity.java so i cannot use setOnClickListener method what i did is i added an attribute to music_item.xml onClickto call method in MainActivity.java but this is not working, by clicking the list item it is not invoking the method from Activity class SongsListAdapter.java public View getView(final int position, View view, ViewGroup parent) { final ViewHolder holder; if (view == null) { holder = new ViewHolder(); view = inflater.inflate(R.layout.music_item, null); this.mView = view; holder.title = (TextView) view.findViewById(R.id.songName); holder.descr = (TextView) view.findViewById(R.id.songArtists); holder.dp = (ImageView) view.findViewById(R.id.albumIcon); view.setTag(holder); } else { holder = (ViewHolder) view.getTag(); } // Set the results into TextViews holder.title.setText(SongsListItemslist.get(position).getDisplayName()); holder.descr.setText(SongsListItemslist.get(position).getArtist()); holder.dp.setImageBitmap(SongsListItemslist.get(position).getBitmap()); // Listen for ListView Item Click view.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { } }); return view; } MainActivity.java public void songPicked(View view) { Log.v("clicked", "clicked"); musicSrv.setSong(Integer.parseInt(view.getTag().toString())); musicSrv.playSong(); } Music_item.xml &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@drawable/card" android:clickable="true" android:onClick="songPicked" &gt; &lt;ImageView android:id="@+id/albumIcon" android:layout_width="70dp" android:layout_height="70dp" android:layout_alignParentLeft="true" android:layout_alignParentTop="true" android:src="@drawable/abc_ab_bottom_solid_dark_holo" /&gt; &lt;/RelativeLayout&gt; A…
answer count: 4
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25000653
accepted answer: http://stackoverflow.com/a/25000670
tagged with: onclick
score: 1
tagged with: java
upvote count: 1
type: Question
linked to: http://stackoverflow.com/q/4709870
has answer: http://stackoverflow.com/a/25000670

http://stackoverflow.com/q/24951873
accepted answer: http://stackoverflow.com/a/24952432
favorite count: 0
tagged with: inner-classes
tagged with: jframe
upvote count: 1
tagged with: swing
type: AnsweredQuestion
has title: Moving undecorated JFrame using mouse event and thread to update
score: 1
has answer: http://stackoverflow.com/a/24952432
tagged with: java
type: Question
has body: I tend to move my undercoated JFrames quite clumsily, by using creating a static reference to then a mouse event to update the Point location. So In an attempt to better understand Threads , I want to move around a very simple undercoated JFrame as follows: create JFrame add MouseListener onMousePressed: Point p = Mousevent.getPoint(); onMouseReleased: Point p = Mousevent.getPoint(); and at the same time have a thread constantly update the JFrames location. However I cant figure out why the controllerThread, wont do more than one iteration? Also an explanation to why the below code is terrible would be very much appreciated. public AnimationStation() throws HeadlessException { P=this.getLocation(); run(); class ControllerThread extends Thread{ JFrame j; public ControllerThread(JFrame j){ this.j = j; } @Override public void run(){ this.j.setLocation(P); } } ControllerThread ct = new ControllerThread(this); ct.run(); //ct.start(); } @Override public void run() { this.setSize(d); Container cp = this.getContentPane(); P=this.getLocation(); this.setUndecorated(true); this.setVisible(true); this.setAlwaysOnTop(true); this.addMouseListener(new MouseListener() { @Override public void mouseClicked(MouseEvent me) { P = me.getPoint(); } @Override public void mousePressed(MouseEvent me) { P = me.getPoint(); } @Override public void mouseReleased(MouseEvent me) { P = me.getPoint(); } @Override public void mouseEntered(MouseEvent me) { } @Override public void mouseExited(MouseEvent me) { } }); }
answer count: 1
downvote count: 0

http://stackoverflow.com/a/24986826
has comment: http://stackoverflow.com/comment/38846032
score: 4
upvote count: 4
answers question: http://stackoverflow.com/q/24986812
downvote count: 0
has body: In the top of your class: private JLabel hoveredLabel; When adding a JLabel: final JLabel label = ... label.addMouseMotionListener(new MouseListener() { ... public void mouseEntered(MouseEvent me) { hoveredLabel = (JLabel)me.getSource(); } public void mouseExited(MouseEvent me) { hoveredLabel = null; } } And your KeyListener: public void keyPressed(KeyEvent e) { if(e.getKeyCode() == KeyEvent.VK_DELETE){ //Get the JLabel that the mouse has entered/hovering over //Perform action on that JLabel if (hoveredLabel != null) doSomethingWith(hoveredLabel); } } Make sure you add the KeyListener to the contentPane of the JFrame.
has comment: http://stackoverflow.com/comment/38846117
type: Answer
has comment: http://stackoverflow.com/comment/38845746
has comment: http://stackoverflow.com/comment/38845712
has comment: http://stackoverflow.com/comment/38845992
has comment: http://stackoverflow.com/comment/38845696

http://stackoverflow.com/q/25037380
has title: SQLFunctionTemplate does not apply the order of the query parameters
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/31191280
answer count: 1
tagged with: jpa
upvote count: 3
favorite count: 0
downvote count: 0
has body: I reduced the problem to this simple template : //I extend the PostgreSQL dialect because I need a non-standard feature. public class MyDialect extends PostgreSQL82Dialect { public MyDialect() { //With PostgreSQL, "date2 - date1" returns the number of days between the 2 given dates. registerFunction("date_diff", new SQLFunctionTemplate(StandardBasicTypes.LONG, " ((?2) - (?1)) ")); } } In this request, I noticed that Hibernate does not care about the number after ? in ((?2) - (?1)) Hence, If i use : Expression&lt;Date&gt; date1 = ... Expression&lt;Date&gt; date2 = ... em.getCriteriaBuilder().function("date_diff", Integer.class, date1, date2); the call will return the result of (date1 - date2) but I had expected (date2 - date1). Is it a bug or a feature? What is the point of giving a number to the parameters?
accepted answer: http://stackoverflow.com/a/31191280
type: Question
type: AnsweredQuestion
score: 3

http://stackoverflow.com/comment/38857878
comment on: http://stackoverflow.com/q/24993357
type: Comment
type: QuestionComment
has text: Add Log after openRepairs is populated !
score: 0

http://stackoverflow.com/q/24915753
score: 2
has comment: http://stackoverflow.com/comment/38712598
tagged with: digital-certificate
answer count: 0
downvote count: 0
type: UnansweredQuestion
favorite count: 0
has title: Java program to verify digital signature signed by signtool
tagged with: security
type: Question
linked to: http://stackoverflow.com/q/1374170
tagged with: signtool
tagged with: digital-signature
has comment: http://stackoverflow.com/comment/38712362
upvote count: 2
has body: I have digitally signed a file(either .exe or .dll not a jar file) using SignTool. Signtool can also verify the digital signature. But my requirement is to check digital signature of file signed by signtool using java program. I searched on internet but didn't find any info. Could you please give me pointers regarding the same? Thanks for your suggestion.
tagged with: java

http://stackoverflow.com/comment/38762251
type: Comment
has text: Please try to include an explanation in your answer, instead of just code.
comment on: http://stackoverflow.com/a/24942084
score: 0
type: AnswerComment

http://stackoverflow.com/q/25060206
answer count: 1
has body: I'm trying to export my project to a jar file in IntelliJ using these instructions, and failing. I'm getting a NullPointerException on this line in my application: ClassLoader.getSystemClassLoader().getResource(".").getPath(); Note that this same project exports fine in Eclipse. I've tried changing the Class-Path in the manifest to ., as I've noticed this change in the jar exported by Eclipse. Then, my application gets a bit further, but bails when trying to load any of the resource files included in my jar. This is how: Assume my jar is placed in /Users/me/screwed.jar When my application tries to open resource.file in the root of the jar file, it's searching for it here: /Users/me/resource.file This triggers a NullPointerException. How do I fix this, team?
type: UnansweredQuestion
tagged with: java
has title: Trouble building executable jar in IntelliJ
type: Question
tagged with: intellij-idea
tagged with: executable-jar
tagged with: jar
has answer: http://stackoverflow.com/a/25060849
tagged with: manifest
score: 0

http://stackoverflow.com/comment/38868567
has text: How can you tell which `Servlet` is being used? Can you give an example of a URL you send a request to and what the result is?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24996483

http://stackoverflow.com/comment/38929594
comment on: http://stackoverflow.com/a/25030990
has text: @AaronDigulla, thanks for link. Cool regex. However the author wrote that this regex is generated automatically, so I believe it can be a little bit optimized. But anyway as I mentioned it is not trivial at all. This is the reason that Apache commons EmailValidator uses several regular expressions and some additional logic written in java.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/24928169
has comment: http://stackoverflow.com/comment/38736867
answers question: http://stackoverflow.com/q/24928124
type: Answer
has comment: http://stackoverflow.com/comment/38735861
has comment: http://stackoverflow.com/comment/38736276
has comment: http://stackoverflow.com/comment/38737301
score: 5
upvote count: 5
accepted answer of: http://stackoverflow.com/q/24928124
has body: Make a map&lt;String, Comparator&gt; where the key is the operator you want to apply, and the object is the relevant Comparator instance. Get the relevant comparator by key and apply it whenever you want.
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/38864588
has text: Hi Uday,yes this code is working firefoxdriver but it is working in chrome that is the issue could you please resolve it
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24990216

http://stackoverflow.com/q/25064344
accepted answer: http://stackoverflow.com/a/25064524
has title: Java: Unit Test parallel execution of static methods (would run on multiple instances in production)
has answer: http://stackoverflow.com/a/25064524
tagged with: unit-testing
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/38991617
type: Question
has comment: http://stackoverflow.com/comment/39027121
answer count: 1
has body: I have a static method which creates unique IDs, based on a machine id and a counter. This essential would look something like this (without going into details about the actual algorithm): public class Generator { static int counter = 0; static synchronized String generate(int machineId) { return generateID(counter++, machineId); } } In production this would be fine as there would be no concurrent execution of this method per node. However, I would like to write a unit test which starts multiple threads in order to test if all generate IDs fulfill their requirements. Obviously the problem now is the static method, which is great to work with, but prevents to test it that way, as the test is executed on a single machine only and the counter is shared between the threads. Is there any way to trick the runtime to allow multiple instances of a static method within a unit test?
tagged with: static-methods
score: 0

http://stackoverflow.com/comment/38893927
has text: Yes, that's exactly what I meant, I'm going to try that out. Should I load the dll in java?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25001403
type: Comment

http://stackoverflow.com/a/24989424
type: Answer
score: 2
answers question: http://stackoverflow.com/q/24989396
has body: javac - is for compiling a Java file. It generates a .class file from the class. example- javac test.java java - is to run a generated class file example- java test
downvote count: 0
upvote count: 2

http://stackoverflow.com/comment/38779818
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/24951726
has text: Which JDK version are you using? BTW, there are no `header files` in Java
type: Comment

http://stackoverflow.com/a/25047294
has comment: http://stackoverflow.com/comment/38960813
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/25047015
answers question: http://stackoverflow.com/q/25047015
has body: The problem is simple.The exception is caught,response is delegated from catch block and again from the finally block. What you should do is have a single place for delegating your response please note :- A response can be committed only once boolean exceptionOcured =false; try{ // your code } catch(Exception e){ exceptionOcured =true; } finally{ // your code to release resources } if(exceptionOcured){ RequestDispatcher rd = request.getRequestDispatcher("/error.jsp"); rd.forward(request, response); }else{ RequestDispatcher rd = request.getRequestDispatcher("/displayjobs.jsp"); rd.forward(request, response); }
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38968998
type: Answer

buttonclick
type: Tag
tags question: http://stackoverflow.com/q/24955446
tag name: buttonclick
tags question: http://stackoverflow.com/q/25028305

http://stackoverflow.com/q/24976350
has answer: http://stackoverflow.com/a/24976442
tagged with: collections
type: Question
has comment: http://stackoverflow.com/comment/38826274
tagged with: java
has answer: http://stackoverflow.com/a/24979254
score: -1
answer count: 3
downvote count: 1
has comment: http://stackoverflow.com/comment/38825808
has comment: http://stackoverflow.com/comment/38825921
favorite count: 0
has title: Quick one: clarity or short code?
has answer: http://stackoverflow.com/a/24976384
accepted answer: http://stackoverflow.com/a/24976384
has comment: http://stackoverflow.com/comment/38825787
has body: Ok, as I promised quick one so here we go: I got fragment of code that just tokenizes string in by in.split("");, so I get all characters separately and then I remove those that I don't want, and currently it looks like this: List&lt;String&gt; op=new ArrayList&lt;String&gt;(Arrays.asList(in.split(""))); op.removeAll(removable); operators=op.toArray(new String[op.size()]); where op is my temporary variable to handle the removal. Is there any way to put it in one line? And if there is(pls tell me how, I was wondering for some time and I figured there isn't because removeAll() returns boolean) - should it be done or should I stay this way to make it easier to read?
has comment: http://stackoverflow.com/comment/38825901
has comment: http://stackoverflow.com/comment/38830309
type: AnsweredQuestion
upvote count: 0
tagged with: list
possible better answer: http://stackoverflow.com/a/24976442

http://stackoverflow.com/comment/38814177
type: QuestionComment
comment on: http://stackoverflow.com/q/24970120
has text: Add the code for loginPanel loginPanelA
score: 0
type: Comment

http://stackoverflow.com/comment/38898387
has text: That is true, the names of the classes are pourly choosed. But one entry of the class "Nodes" can refer to multiple "Authorities" because any number of them can have the same field "idAuthority" (the primary key is the combination of the "rankAuthority" and the "idAuthority")
score: 0
comment on: http://stackoverflow.com/q/25014649
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38979650
has text: I didn't choose the type, it is a given method of this homework that return priority queue.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25058094

http://stackoverflow.com/comment/38891467
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25010564
type: Comment
has text: @Jack thanks for your time and efforts you made to answer but this is not what I was looking for...

http://stackoverflow.com/q/24910986
answer count: 1
tagged with: passwords
has comment: http://stackoverflow.com/comment/38702687
tagged with: oop
has body: So I am currently taking an online course, and have progressed through fairly well until an exercise where I am supposed to create a password generator, with the password length given by the user. The output of the code seems fine, it generates a password of the given length, but when submitted to the University online checking system; I receive a fail and this error: StringIndexOutOfBoundsException: String index out of range: 26 I'm new and really trying hard to crack this myself. But being new even the apparent solutions are difficult to understand. I have placed the code here being unsure of how to minimise the code to show the problem. https://gist.github.com/anonymous/320cab659ac9646e5162 I would appreciate any help. And most definitely will pay it forward should I have the opportunity. All the best, thanks.
tagged with: java
has answer: http://stackoverflow.com/a/24911211
upvote count: 0
accepted answer: http://stackoverflow.com/a/24911211
tagged with: random
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38703931
favorite count: 0
has title: String index out of rage but cannot see why. Code does as I want it, but fails when submitted to the University checking system
downvote count: 2
score: -2

http://stackoverflow.com/comment/38891468
has text: I try your code but I got an error on `return list` "type missmatch : cannot convert from `List<String>` to `ListArray<String>`
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25010162
type: Comment

http://stackoverflow.com/comment/38740394
score: 0
type: AnswerComment
has text: I appreciate the help! I changed it to into(holder.url) and it works. The images do load up, but the overall view is terrible looking. To change this, I would have to alter the xml right? Or maybe look into picasso's features...
comment on: http://stackoverflow.com/a/24930532
type: Comment

http://stackoverflow.com/comment/38725788
type: QuestionComment
has text: There's no `remove` method for `String`s. If you want to delete one character from a `String`, and you know the position of the character you wnat to delete, you basically need to use `substring`, either once or twice.
comment on: http://stackoverflow.com/q/24922854
score: 0
type: Comment

http://stackoverflow.com/a/25003100
downvote count: 0
answers question: http://stackoverflow.com/q/25001677
type: Answer
upvote count: 1
has body: Make a custom implementation of InputStream to produce random data: import java.io.IOException; import java.io.InputStream; import java.util.Random; public class RandomInputStream extends InputStream { private int available; private Random random = new Random(); public RandomInputStream(final int totalSize) { this.available = totalSize; } @Override public int read() throws IOException { if(available == 0) return -1; --available; return random.nextInt(256); } @Override public int available() throws IOException { return available; } } And then just use it as usual: InputStream is = new RandomInputStream(1024*1024); stmt.setBinaryStream(1, is, is.available()); This would be the fastest solution possible.
score: 1

http://stackoverflow.com/q/25016366
downvote count: 0
tagged with: string
tagged with: unicode
favorite count: 0
linked to: http://stackoverflow.com/q/623861
type: AnsweredQuestion
score: 2
accepted answer: http://stackoverflow.com/a/25016460
upvote count: 2
tagged with: java
has comment: http://stackoverflow.com/comment/38901297
type: Question
tagged with: c#
tagged with: encoding
possible better answer: http://stackoverflow.com/a/25016519
has body: I am trying to send a POST request from a C# program to my java server. I send the request together with an json object. I recive the request on the server and can read what is sent using the following java code: BufferedReader reader = new BufferedReader(new InputStreamReader(conn.getInputStream())); OutputStream out = conn.getOutputStream(); String line = reader.readLine(); String contentLengthString = "Content-Length: "; int contentLength = 0; while(line.length() &gt; 0){ if(line.startsWith(contentLengthString)) contentLength = Integer.parseInt(line.substring(contentLengthString.length())); line = reader.readLine(); } char[] temp = new char[contentLength]; reader.read(temp); String s = new String(temp); The string s is now the representation of the json object that i sent from the C# client. However, some characters are now messed up. Original json object: {"key1":"value1","key2":"value2","key3":"value3"} recived string: %7b%22key1%22%3a%22value1%22%2c%22key2%22%3a%22value2%22%2c%22key3%22%3a%22value3%22%%7d So my question is: How do I convert the recived string so it looks like the original one?
has answer: http://stackoverflow.com/a/25016519
has title: Convert encoded string to readable string in java
has comment: http://stackoverflow.com/comment/38902581
answer count: 2
has answer: http://stackoverflow.com/a/25016460

http://stackoverflow.com/comment/38927139
comment on: http://stackoverflow.com/q/25029600
score: 0
has text: i dont want to fire that only on sunday. It should be based on the month for example for JAN & FEB 2015 it should run on last saturday and MAR it should run on last sunday
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24957456
type: Answer
answers question: http://stackoverflow.com/q/24955534
has body: From SpringBootServletInitializer javadoc : A handy opinionated WebApplicationInitializer for applications that only have one Spring servlet, and no more than a single filter (which itself is only enabled when Spring Security is detected). If your application is more complicated consider using one of the other WebApplicationInitializers So if you want to generate a war and you want to include a session listener, you should use directly a WebApplicationInitializer. Here is an example from the javadoc : public class MyWebAppInitializer implements WebApplicationInitializer { @Override public void onStartup(ServletContext container) { // Create the 'root' Spring application context AnnotationConfigWebApplicationContext rootContext = new AnnotationConfigWebApplicationContext(); rootContext.register(AppConfig.class); // Manage the lifecycle of the root application context container.addListener(new ContextLoaderListener(rootContext)); // Create the dispatcher servlet's Spring application context AnnotationConfigWebApplicationContext dispatcherContext = new AnnotationConfigWebApplicationContext(); dispatcherContext.register(DispatcherConfig.class); // Register and map the dispatcher servlet ServletRegistration.Dynamic dispatcher = container.addServlet("dispatcher", new DispatcherServlet(dispatcherContext)); dispatcher.setLoadOnStartup(1); dispatcher.addMapping("/"); } } As you have full control on the ServletContext before it is fully initialized, it is easy to add your listener : container.addListener(YourListener.class);
score: 0

http://stackoverflow.com/q/25002472
downvote count: 0
tagged with: java
type: Question
has body: This is like the first time im using Android Studio, and when I try to run the app It shows me the following error: Error:A problem occurred configuring root project 'PickApp'. &gt; Could not resolve all dependencies for configuration ':classpath'. &gt; Could not resolve com.android.tools.build:gradle:0.12.+. Required by: :PickApp:unspecified &gt; Failed to list versions for com.android.tools.build:gradle. &gt; Could not list versions using M2 pattern 'http://jcenter.bintray.com/[organisation]/[module]/[revision]/[artifact]-[revision](-[classifier]).[ext]'. &gt; Could not GET 'http://jcenter.bintray.com/com/android/tools/build/gradle/'. &gt; jcenter.bintray.com Build.grandle : buildscript { repositories { jcenter() } dependencies { classpath 'com.android.tools.build:gradle:0.12.+' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } } allprojects { repositories { jcenter() } }
score: 5
has comment: http://stackoverflow.com/comment/38883847
has comment: http://stackoverflow.com/comment/80915924
has comment: http://stackoverflow.com/comment/38975886
favorite count: 0
tagged with: android-studio
upvote count: 5
answer count: 0
has title: Android could not resolve all dependencies for configuration ' classpath'
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/38982029
has comment: http://stackoverflow.com/comment/42958235

http://stackoverflow.com/a/24959408
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24956245
answers question: http://stackoverflow.com/q/24956245
has comment: http://stackoverflow.com/comment/38824388
type: Answer
score: 2
has body: Take a look at SpringLayout (http://docs.oracle.com/javase/tutorial/uiswing/layout/spring.html). This layout manager lets you attach the edges (north, south, east, and west) of components to edges of other components. This also defines the resize behavior. For example, the following statement attaches the west edge of a combo box to the east edge of a label with 10 pixels between them: tfsLayout.putConstraint(SpringLayout.WEST, cb, 10, SpringLayout.EAST, labelFontName); Here is a sample program that implements your Table Properties and Font Style panels using SpringLayout: import javax.swing.BorderFactory; import javax.swing.JButton; import javax.swing.JCheckBox; import javax.swing.JComboBox; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.SpringLayout; import javax.swing.JFrame; import java.awt.Container; public class TableProps { private static void createAndShowGUI() { JFrame frame = new JFrame("Settings"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Container contentPane = frame.getContentPane(); SpringLayout layout = new SpringLayout(); contentPane.setLayout(layout); /* define Table Properties panel */ JPanel pTableProperties = new JPanel(); SpringLayout tpLayout = new SpringLayout(); pTableProperties.setLayout(tpLayout); pTableProperties.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder("Table Properties"), BorderFactory.createEmptyBorder(5,5,5,5))); contentPane.add(pTableProperties); layout.putConstraint(SpringLayout.WEST, pTableProperties, 10, SpringLayout.WEST, contentPane); layout.putConstraint(SpringLayout.NORTH, pTableProperties, 10, SpringLayout.NORTH, contentPane); layout.putConstraint(SpringLayout.SOUTH, pTableProperties, -50, SpringLayout.SOUTH, contentPane); layout.putConstraint(SpringLayout.EAST, pTableProperties, -10, SpringLayout.EAST, contentPane); JButton btnClose = new JButton("Close"); contentPane.add(btnClose); layout.putConstraint(SpringLayout.NORTH, btnClose, 10, SpringLayout.S…
has comment: http://stackoverflow.com/comment/38800179
upvote count: 2
type: AcceptedAnswer

http://stackoverflow.com/comment/38895886
has text: It must be a bug then. Use 19 until Android fixes it.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25013140
type: Comment

http://stackoverflow.com/q/25008310
downvote count: 0
score: 1
has body: I'm in a college summer class that is going super fast and I'm extremely new to programming in general (be nice haha). One of our assignments this week is to create a simple calculator. Here are a few of the instructions. "The Driver class is the only class with main(String[] args)method.Driver class should call a method in the Menu class to print the menu, and from that method there should be calls to methods in Actions class for respective functionality from the menu." My code is no where near completed I'm just trying to figure out what I'm doing wrong with calling the getInput method that's inside the Menu class. Per the instructions it seems like the method call needs to be in the Driver class. However, I'm getting a few errors when I try and compile. Driver.java:6: error: cannot find symbol String user = getInput("Enter: \n 1=Add \n 2=Subtract \n 3=Multiply \n 4=Divide"); ^ symbol: method getInput(String) location: class Driver Driver.java:11: error: cannot find symbol String s1 = getInput("Enter a numeric value: "); ^ symbol: method getInput(String) location: class Driver Driver.java:12: error: cannot find symbol String s2 = getInput("Enter a numeric value: "); ^ symbol: method getInput(String) location: class Driver Driver.java:14: error: non-static variable user cannot be referenced from a static context int userInt = Integer.parseInt(user); ^ Driver.java:70: error: Illegal static declaration in inner class Driver.Menu public static String getInput(String prompt) { ^ modifier 'static' is only allowed in constant variable declarations 5 errors ................ import java.util.Scanner; import java.io.*; public class Driver { String user = getInput("Enter: \n 1=Add \n 2=Subtract \n 3=Multiply \n 4=Divide"); public static void main(String[] args) { String s1 = getInput("Enter a numeric value: "); String s2 = getInput("Enter a numeric value: "); int userInt = Integer.parseInt(user); double result = 0; switch (userInt) { case 1: result = addValues(s1, s2); break…
tagged with: java
tagged with: methods
has title: Method call and a class inside a class
type: Question
has answer: http://stackoverflow.com/a/25008323
tagged with: class
answer count: 2
upvote count: 1
accepted answer: http://stackoverflow.com/a/25008379
favorite count: 0
possible better answer: http://stackoverflow.com/a/25008323
has answer: http://stackoverflow.com/a/25008379
type: AnsweredQuestion

http://stackoverflow.com/a/24964335
answers question: http://stackoverflow.com/q/24964242
type: Answer
score: 2
downvote count: 0
has body: But when I tried this out, my compiler is complaining that the value I'm using is too large, 2^31. You have an error because the literal 2147483648 is syntactically invalid. How exactly do I use an int/Integer to store unsigned value, such as 2^31? You can still perform unsigned arithmetic using the new methods of the Integer class, just don't use invalid literals: int n = 2147483647 + 1; // 2^31 System.out.println(Integer.toUnsignedString(n)); // treat int as unsigned System.out.println(Integer.toString(n)); // treat int as signed 2147483648 -2147483648 What I'm understanding from this quote is that I can now store up to 2^32-1 as an int as long as I use the Integer wrapper object rather than the int primitive data type. You can store the unsigned int using the primitive type int, but using the value as an unsigned type requires you to use the utility methods of Integer, as can be seen above.
upvote count: 2
accepted answer of: http://stackoverflow.com/q/24964242
type: AcceptedAnswer

http://stackoverflow.com/comment/38842282
comment on: http://stackoverflow.com/q/24983060
score: 0
type: QuestionComment
type: Comment
has text: @laune Right, and that's how I've built my simulation. My problem comes in trying to remove customers from the collection queue when they've completed their last event. They just don't leave that final queue (even though their associated event has left the priority queue).

http://stackoverflow.com/q/25053572
favorite count: 0
upvote count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38975414
has title: Connections to SSL ports using NIO stay established after disconnect
tagged with: java
type: Question
has body: In our application we need to check if certain ports of certain host are available for communication. At stage of this check we do not proceed with real communication - we need just to check if ports are open. As many ports has to be checked at once we originally used NIO approach (Selector + SocketChannel classes): package test; import java.io.IOException; import java.net.InetSocketAddress; import java.nio.channels.SelectionKey; import java.nio.channels.Selector; import java.nio.channels.SocketChannel; import java.util.ArrayList; import java.util.Arrays; import java.util.Iterator; import java.util.List; public class TestNIO { public static void main(final String... params) { final List&lt;String&gt; portsToCheck = Arrays.asList(new String[] {"443", "5989"}); final List&lt;String&gt; openPorts = new ArrayList&lt;String&gt;(); final String host = "&lt;SOME_IP&gt;"; final int timeout = 5000; Selector selector = null; if (!portsToCheck.isEmpty()) { try { selector = Selector.open(); for (final String port : portsToCheck) { final SocketChannel channel = SocketChannel.open(); channel.configureBlocking(false); channel.connect(new InetSocketAddress(host, Integer.valueOf(port))); channel.register(selector, SelectionKey.OP_CONNECT); } final int readyChannels = selector.select(timeout); if (readyChannels != 0) { final Iterator&lt;SelectionKey&gt; it = selector.selectedKeys().iterator(); while (it.hasNext()) { final SelectionKey selKey = it.next(); try { if (selKey.isValid() &amp;&amp; selKey.isConnectable()) { final SocketChannel channel = (SocketChannel) selKey.channel(); try { if (channel.finishConnect()) { openPorts.add(String.valueOf(channel.socket().getPort())); } } catch (final IOException ex) { ex.printStackTrace(); } finally { channel.close(); } } } catch (final Exception ex) { ex.printStackTrace(); } finally { selKey.cancel(); } it.remove(); } } } catch (final IOException ex) { ex.printStackTrace(); } finally { try { if (selector != null &amp;&amp; selector.isOpen()) …
answer count: 2
downvote count: 2
score: -2
tagged with: ssl
has answer: http://stackoverflow.com/a/25077517
tagged with: nio
has comment: http://stackoverflow.com/comment/38974765
has answer: http://stackoverflow.com/a/28317874
tagged with: connection

http://stackoverflow.com/q/24976181
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: gson
type: Question
accepted answer: http://stackoverflow.com/a/24977105
has comment: http://stackoverflow.com/comment/38830764
answer count: 2
has comment: http://stackoverflow.com/comment/38825515
possible better answer: http://stackoverflow.com/a/24976729
has answer: http://stackoverflow.com/a/24977105
has body: I am trying to implement a client-server in java and i made connection between in sockets and sending JSON objects as strings on streams if i have big object is there's a way to handle it so i don't have to regroup it because the limit size of tcp packet (cant know when the single object is fully transferred to me as client or not yet) note :am using G-son to convert objects to JSON objects
has comment: http://stackoverflow.com/comment/38844971
has comment: http://stackoverflow.com/comment/38825415
favorite count: 0
tagged with: sockets
downvote count: 1
has answer: http://stackoverflow.com/a/24976729
has title: How to handle big object sent on socket java?
has comment: http://stackoverflow.com/comment/38827038
type: AnsweredQuestion
score: 2
upvote count: 3

http://stackoverflow.com/comment/38802604
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24958156
has text: Thank you, that explains why. If I find some time I'll try with FILTERED and HUFFMAN_ONLY and post the results.

http://stackoverflow.com/a/24969266
has comment: http://stackoverflow.com/comment/38831058
has body: Make sure your sandbox account is not set up to automatically transfer money from bank account if balance is 0. This was a default setting for me. Your paypal balance might be 0, but by default paypal is hooking up fake bank account and fake credit card to your sandbox account. This allows transaction to go through, because even tho you have 0 balance it pulls the funds out of the fake bank or fake credit card.
answers question: http://stackoverflow.com/q/24969232
score: 0
accepted answer of: http://stackoverflow.com/q/24969232
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38813682
has comment: http://stackoverflow.com/comment/38831027
type: Answer
has comment: http://stackoverflow.com/comment/38813379
has comment: http://stackoverflow.com/comment/38822386
has comment: http://stackoverflow.com/comment/38813394

http://stackoverflow.com/comment/38712618
type: Comment
has text: we need to parse the query first by `&` and `=`, then decode the name and value. because the name/value could contain encoded `&` or `=`
score: 1
comment on: http://stackoverflow.com/a/24915819
type: AnswerComment

http://stackoverflow.com/comment/38720925
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24918798
has text: @user3870022: one of the best tools at your disposal is the Debugger. Learn how to use it, at least at a basic level. It can allow you to run your code line by line, view and change variables mid-run, and a bunch of other things. If you were to have used the debugger, you would have found that return null very quickly

http://stackoverflow.com/comment/38931913
has text: Hi Thomas, i don't want to use SSO i just want to know the username of the windows machine they have logged on. I don't want to use external tools, and the code you have given is out of my scope as i am new to java.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25031933

http://stackoverflow.com/a/25042680
has body: Suppose I have a value in int myvar whose bit representation is 10000000000000000000000000000000.... Now the question is whats the value of myvar &lt;&lt; 1? is it 000...000 because the '1' in the MSB gets shifted out? Also what will be myvar >> 1? will it be 110000....00000? Let's find out int myvar = Integer.MIN_VALUE; System.out.println(Integer.toBinaryString(myvar)); System.out.println(Integer.toBinaryString(myvar &lt;&lt; 1)); System.out.println(Integer.toBinaryString(myvar &gt;&gt; 1)); Outputs 10000000000000000000000000000000 0 11000000000000000000000000000000 do we have sizeOf(int) function in Java giving us 32 as the answer? Not exactly. There is however the SIZE field in the wrapper types, System.out.println("Integer: " + Integer.SIZE); System.out.println("Double: " + Double.SIZE); Output is Integer: 32 Double: 64
type: Answer
downvote count: 0
score: 3
accepted answer of: http://stackoverflow.com/q/25042530
answers question: http://stackoverflow.com/q/25042530
upvote count: 3
type: AcceptedAnswer

http://stackoverflow.com/a/25024574
has comment: http://stackoverflow.com/comment/38917335
answers question: http://stackoverflow.com/q/25024369
type: Answer
downvote count: 0
has body: This doesn't directly answer your question but is it possible to test that private fields state by exercising the public api of the parent class some how? If you can do that then no need for reflection and this may be more maintainable long term. If not then you must extend the class and use r election to get a handle on the private property. See this thread: Access to private inherited fields via reflection in Java
score: 1
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25024369

http://stackoverflow.com/a/25050300
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/25032926
type: Answer
downvote count: 0
has body: Despite what it says in the Javadoc, you can't increase the connect timeout beyond the platform default of about 60 seconds, and zero does not mean infinity: it means the platform timeout.

http://stackoverflow.com/q/24909523
has comment: http://stackoverflow.com/comment/38700582
has body: I have have a plain Java class in an Android apk as follows: public class AdjustResizeWorkaround { public static void assistActivity (Activity activity) { new AdjustResizeWorkaround(activity); } ...... } and private AdjustResizeWorkaround(Activity activity) { .... } I want to do the unit testing of above class but when I use AndroidTestCase I can't get an Activity reference in JUnit. How can I get an Activity reference in JUnit? As this class does not extends activity I cant use ActivityInstrumentattionTestCase in JUnit. How to get an Activity reference?
has comment: http://stackoverflow.com/comment/38700283
score: 0
has comment: http://stackoverflow.com/comment/38701185
has comment: http://stackoverflow.com/comment/38700494
tagged with: junit
has title: JUnit testing of a class that uses Activity Reference
tagged with: android-activity
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/38700584
answer count: 0
has comment: http://stackoverflow.com/comment/38700793
tagged with: java
type: Question

http://stackoverflow.com/comment/38928113
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25030647
has text: Should I elaborate more on how I will use them *together*?
score: 0

http://stackoverflow.com/a/29431378
score: 7
has comment: http://stackoverflow.com/comment/105745551
downvote count: 0
has comment: http://stackoverflow.com/comment/104288880
has comment: http://stackoverflow.com/comment/104287516
type: Answer
answers question: http://stackoverflow.com/q/24983925
has body: I had the same problem. It was because my .mp3 file was too short. Mine was 0.167 seconds long. I added 1.2 seconds of silence with Audacity, and it fixed the problem.
upvote count: 7

http://stackoverflow.com/a/24910643
has comment: http://stackoverflow.com/comment/38702688
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24910262
score: 1
answers question: http://stackoverflow.com/q/24910262
has comment: http://stackoverflow.com/comment/38702328
type: Answer
has comment: http://stackoverflow.com/comment/38701975
upvote count: 1
has body: You can replace all \n in your string with a space , then trim your string : String str="\\n command1\\n command2 \\n"; String formattedStr=str.replaceAll("\\\\n"," ").trim();// formattedStr='command1 command2'

ucanaccess
tag name: ucanaccess
type: Tag
tags question: http://stackoverflow.com/q/24975014

http://stackoverflow.com/a/25063600
downvote count: 0
upvote count: 2
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39013444
has comment: http://stackoverflow.com/comment/39017090
has body: Is it possible to disable automatic promotion of one data type to another No: as you already discovered the Java Language Specification mandates numeric promotion to occur, any compiler doing this would (by definition) not be a valid Java Compiler. How often does automatic promotion causing problem to you? Perhaps once a year (and I code in Java for a living)? Is it possible to tweak the IDE so that it shows a warning to me when automatic promotion occurs? (I am using NetBeans IDE 7.3.1 at the moment.) It is worth noting that such a warning would not detect all cases where an explicit promotion is needed. For instance, consider: boolean isNearOrigin(int x, int y, int r) { return x * x + y + y &lt; r * r; } Even though there is no automatic promotion, the multiplications may overflow, which can make the method return incorrect results, and one should probably write return (long) x * x + (long) y + y &lt; (long) r * r; instead. It's also worth noting that your proposed warning would also appear for correct code. For instance: int x = ...; foo(x); would warn about automatic promotion if foo is declared with parameter type long, even though that promotion can not have any adverse effects. Since such innocent situations are quite frequent, your warning would probably be so annoying that everybody would turn it off. I'd therefore by quite surprised to find any Java compiler emit such a warning. In general, the compiler can not detect that an operation will overflow, and even finding likely candidates for overflow is complex. Given the rarity of overflow-related problems, such an imperfect detection seems a dubious benefit, which is probably why Java compilers and IDEs do not implement it. It therefore remains the responsibility of the programmer to verify, for each arithmetic operation, that the value set afforded by the operand types is suitable. This includes specifying suitable type suffixes for any numeric literals used as operands. PS: Though I am impressed that you …
type: Answer
accepted answer of: http://stackoverflow.com/q/25058224
answers question: http://stackoverflow.com/q/25058224
has comment: http://stackoverflow.com/comment/39007973
score: 2

getparameter
tag name: getparameter
type: Tag
tags question: http://stackoverflow.com/q/25043564

http://stackoverflow.com/a/24939500
type: Answer
has body: You should consider creating the JavaFX application. It's included in modern Java distributions. Just look at the docs. For example, that would be something like package blahblah; import java.io.File; import javafx.application.Application; import javafx.event.ActionEvent; import javafx.event.EventHandler; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.layout.StackPane; import javafx.stage.FileChooser; import javafx.stage.Stage; public class BlahBlah extends Application { @Override public void start(Stage primaryStage) { StackPane root = new StackPane(); // add some elements to root FileChooser fileChooser = new FileChooser(); File file = fileChooser.showOpenDialog(primaryStage); //for example: System.out.println("File chosen: " + file.getAbsolutePath()); Scene scene = new Scene(root, 300, 250); primaryStage.setScene(scene); primaryStage.show(); } }
answers question: http://stackoverflow.com/q/24939418
has comment: http://stackoverflow.com/comment/38756913
score: 0
has comment: http://stackoverflow.com/comment/38761276

http://stackoverflow.com/comment/38904328
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25014355
type: Comment
has text: I found the problem. The problem comes from a `List` variable which is a parameter in its used function and defined as an **extend** parameter which I added this one in an object and the object added in another `List`. so because of my parameter status(`<? extends List<...`) there's happening an inconsistency.

http://stackoverflow.com/comment/52101408
has text: Not working, same error occurs. Android studio version 1.3.1
type: Comment
comment on: http://stackoverflow.com/a/25028216
score: 0
type: AnswerComment

http://stackoverflow.com/a/25048170
answers question: http://stackoverflow.com/q/25048010
downvote count: 0
has comment: http://stackoverflow.com/comment/67653748
has comment: http://stackoverflow.com/comment/51788633
type: Answer
has comment: http://stackoverflow.com/comment/38961613
has body: I hope I don't have any silly typos, but basically what you can do is : List&lt;Pair&gt; list = as .stream() .flatMap(a -&gt; bs.stream().map (b -&gt; new Pair(a,b))) .collect (Collectors.toList()); First you create a Stream&lt;A&gt; from as. For each a instance 2.1 Create a Stream&lt;B&gt; of bs 2.2 Map each b to a pair of (a,b) Flatten all the pairs to a single Stream. Finally I collected them to a List, though you can choose other collections.
score: 24
upvote count: 24

http://stackoverflow.com/comment/38798835
type: Comment
has text: I am trying to write an application with Angular as front end using Play framework in Java .Yeah my my controller name is TodoController. So when I call http://localhost:9000/todo it should show me my todo.html
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24960939

http://stackoverflow.com/comment/38994822
comment on: http://stackoverflow.com/q/25065906
type: QuestionComment
type: Comment
has text: If something like `PreparedStatement` was used then you'll most likely have to rewrite the section of code.
score: 0

http://stackoverflow.com/comment/38965878
comment on: http://stackoverflow.com/a/25050590
has text: This can be handled by HttpSessionListener sessionDestroyed, right?
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/38990957
score: 2
has text: @kolossus in all fairness, you can't use puntuation signs or things like `%` on Google.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25064019

http://stackoverflow.com/comment/67624202
type: QuestionComment
type: Comment
has text: Possible duplicate of [Find path to node in Tree?](http://stackoverflow.com/questions/20232858/find-path-to-node-in-tree)
comment on: http://stackoverflow.com/q/25022410
score: 0

http://stackoverflow.com/comment/39127137
has text: Please, could you add ` ` at the end of your JSP file and try again? The web browser may not be able to render the page without them. If it doesn't work, please right click on the page and select the option to view the generated html code. That may provide us more information about the error
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25007033
type: AnswerComment

http://stackoverflow.com/comment/38928692
type: Comment
comment on: http://stackoverflow.com/a/25030619
has text: This was copied from a project originally using Spring Data JPA - see http://www.petrikainulainen.net/spring-data-jpa-tutorial/
score: 0
type: AnswerComment

http://stackoverflow.com/a/24932445
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24932009
has comment: http://stackoverflow.com/comment/38742962
type: Answer
has body: You are using the wrong getKeyStroke method: final KeyStroke ks = KeyStroke.getKeyStroke('e', 0); Calls getKeyStroke(int keyCode, int modifiers), since a "char" is interpreted as a 16 bit value that can be autocast to a 32 bit int value. Autoboxing does only happen if there isn't a fitting method. use either final KeyStroke ks = KeyStroke.getKeyStroke(Character.valueOf('e'), 0); or: final KeyStroke ks = KeyStroke.getKeyStroke('e'); And remember for your own APIs: try to detect such clashes when overloading. ;-) Also, like MadProgrammer pointed out that won't resolve your problem. Have you tried using keyEvent.getKeyChar() instead?
answers question: http://stackoverflow.com/q/24932009
score: 0

http://stackoverflow.com/q/25002366
tagged with: servlets
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/25003267
has body: I have searched for the solution from similar question posted on this forum but could not get out of this problem. I am developing a website using Java and eclipse. My website reads a doc file and displays on one of the pages. So to read the file I used absolute path: (C:\\Documents and Settings\\Administrator\\Desktop\\wordfile.doc) during development and it worked correctly. But during hosting, which is on linux server, I tried to change it to Relative path (../docs/worfile.doc) and created a WAR file and hosted. But that is not working. I am confused in using relative path. The Java file to read the doc file is at: Java Resources\src\com.ssoft.util\readdocfile.java Here's my code: package com.ssoft.util; import org.apache.poi.poifs.filesystem.*; import org.apache.poi.hwpf.*; import org.apache.poi.hwpf.extractor.*; import java.io.*; import java.net.URL; public class readdocfile { /**This is the document that you want to read using Java. * @throws Exception **/ public int totalparas() throws Exception{ int totparas=0; POIFSFileSystem fs = null; String[] paragraphs=null; String fileName; fileName = "C:\\Documents and Settings\\Administrator\\Desktop\\wordfile.doc"; try { fs = new POIFSFileSystem(new FileInputStream(fileName)); HWPFDocument doc = new HWPFDocument(fs); /** Read the content **/ WordExtractor we = new WordExtractor(doc); /**Get the total number of paragraphs**/ paragraphs = we.getParagraphText(); totparas=paragraphs.length; we.close(); } catch (Exception e) { e.printStackTrace(); } return totparas; } public String[] readDocument() throws Exception{ POIFSFileSystem fs = null; String[] paragraphs=null; String fileName = "C:\\Documents and Settings\\Administrator\\Desktop\\wordfile.doc"; try { fs = new POIFSFileSystem(new FileInputStream(fileName)); HWPFDocument doc = new HWPFDocument(fs); /** Read the content **/ WordExtractor we = new WordExtractor(doc); /**Get the total number of paragraphs**/ paragraphs = we.getParagraphText(); we.close(); } catch (Exc…
type: UnansweredQuestion
has title: Unable to read doc file with relative path
tagged with: war
has answer: http://stackoverflow.com/a/25002544
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/39329027
tagged with: relative-path

http://stackoverflow.com/comment/38914154
score: 0
type: AnswerComment
has text: You're right, he must bind, but it doesn't explain this problem.
type: Comment
comment on: http://stackoverflow.com/a/25022889

http://stackoverflow.com/comment/38806263
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24965775
has text: @Gas, sorry but i read it before and didn't worked out for me, that's why i asked again...
score: 0

http://stackoverflow.com/q/25013488
tagged with: persistent
tagged with: object
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: hibernate
tagged with: orm
has comment: http://stackoverflow.com/comment/38895952
has answer: http://stackoverflow.com/a/25013588
type: Question
has comment: http://stackoverflow.com/comment/38896044
has body: Using Hibernate I need to update multiple objects by calling for eg. updateDetails() function shown below: function updateDetails(){ Session session = this.getSessionFactory().openSession(); Employee emp=(Employee )session.load(Employee.class, empId); emp.salary(2000); Account acc=(Account)session.load(Account.class, accId); account.setTotal(2000); Transaction tx=session.beginTransaction(); session.update(emp); session.update(acc); tx.commit(); result=true; session.close(); } what is the best way of doing this ? does Updating multiple objects of same or different type in same session will cause any problem in hibernate?
accepted answer: http://stackoverflow.com/a/25013588
downvote count: 0
answer count: 1
has title: Hibernate multiple object update in same session
favorite count: 0
upvote count: 1

http://stackoverflow.com/a/24914092
answers question: http://stackoverflow.com/q/24912157
type: Answer
has comment: http://stackoverflow.com/comment/38713938
has comment: http://stackoverflow.com/comment/38711141
has body: Another possible solution: In the main thread, you can wait immediately after having notified a thread (in the same synchronized block), like this: synchronized (threads[threadIndex]) { threads[threadIndex].notify(); threads[threadIndex].wait(); // try/catch here } And in the run method of the thread, you can use notifyAll to wake up the main thread after the thread finished its work: synchronized (this) { waitForSignal(); System.out.println(i); notifyAll(); } More sophisticated solutions would involve classes from the java.util.concurrent.locks package.
score: 0

http://stackoverflow.com/a/24958338
answers question: http://stackoverflow.com/q/24958214
has comment: http://stackoverflow.com/comment/38797156
score: 0
type: Answer
has body: Do you know what exactly is being sent to oracle db? I've seen something similar when Hibernate was sending very long sql command and it failed on JDBC driver. I would suggest starting from getting latest JDBC driver version.
has comment: http://stackoverflow.com/comment/38902233
has comment: http://stackoverflow.com/comment/38898907
has comment: http://stackoverflow.com/comment/38798582

http://stackoverflow.com/a/24997028
has body: Continue simply does what its name suggests, it immediately continues to the next execution of the loop without executing the rest of the code in the loop. So if you have a loop like this: int j=0; int i = 0; LABEL1 : for(;i &lt; 3; i++){ if (true) { continue; } someOtherMethod(); } The someOtherMethod part is never executed because you will always hit the continue. The reason your counter is never incremented has to do with labels, you can mark a loop with a label (in your case LABEL1 and LABEL2 and use that label to continue one of the outer loops of your inner loop. So with your code the loop of LABEL1 never gets a chance to increment its counter and thus i remains 0 because your continue statement immediately continues to the next iteration of the outer loop.
answers question: http://stackoverflow.com/q/24996852
type: Answer
upvote count: 6
score: 6
downvote count: 0

http://stackoverflow.com/q/25043720
tagged with: pdfbox
has comment: http://stackoverflow.com/comment/38953033
tagged with: ms-office
has comment: http://stackoverflow.com/comment/38955919
favorite count: 0
has comment: http://stackoverflow.com/comment/38956373
tagged with: apache-poi
has comment: http://stackoverflow.com/comment/38954489
type: UnansweredQuestion
has title: Using POI or Tika to extract text, stream-to-stream without loading the entire file in memory
score: 2
tagged with: apache-tika
downvote count: 0
tagged with: java
has body: I'm trying to use either Apache POI and PDFBox by themselves, or within the context of Apache Tika, to extract and process plain text from MASSIVE Microsoft Office and PDF files (i.e. hundreds of megs in some cases). Also, my application is multi-threaded, so I will be parsing many of these large files concurrently. At that scale, I MUST work with the files in a streaming manner. It's not an option to hold an entire file in main memory at any step along the way. I have seen many source code examples for loading files into Tika / POI / PDFBox via input streams. I have seen many examples for extracting plain text via output streams. However, I've performed some basic memory profiling experiments... and I haven't yet found a way with any of these libraries (Tika, POI, or PDFBox) to avoid loading an entire document into main memory. In between reading from a stream and writing to a stream, there is obviously conversion step in the middle... which I have not yet found a way to perform on a streaming basis. Am I missing something, or is this a known issue with extracting text from MS Office or PDF files using Tika / POI / PDFBox? Can I have true end-to-end streaming, without a file being fully loaded into main memory at any point along the way?
has answer: http://stackoverflow.com/a/25058658
type: Question
upvote count: 2
answer count: 1
has comment: http://stackoverflow.com/comment/38956996

http://stackoverflow.com/q/25022120
type: AnsweredQuestion
downvote count: 0
possible better answer: http://stackoverflow.com/a/25022227
score: 1
has body: I have a pattern like below Sentence = "@502348@502002662[000861@10"; Pattern = "^@(\\d{6})@*(\\d{9})\\[(\\d{6})@(\\d{2})"; Matcher regexMatcher = regexPattern.matcher(Sentence); if (regexMatcher.find()) str1= regexMatcher.group(1); str2 = regexMatcher.group(2); str3 = regexMatcher.group(3); str4 = regexMatcher.group(4); } The above one works fine if the sentence is appropriately matches. But my requirement is , the partial result should be returned in case the pattern is not matches appropriately. For example if Sentence = "@114142@000017000[" then i want to get the str1 and str2. Thanks
type: Question
tagged with: java
accepted answer: http://stackoverflow.com/a/25022159
answer count: 2
has answer: http://stackoverflow.com/a/25022227
upvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/25022159
tagged with: regex
has title: get the partial match string using java regex pattern

http://stackoverflow.com/comment/38873091
score: 1
type: AnswerComment
type: Comment
has text: that's exactly what I wrote in my comment.
comment on: http://stackoverflow.com/a/25001631

http://stackoverflow.com/q/24933868
favorite count: 0
has comment: http://stackoverflow.com/comment/38748085
tagged with: resultset
has comment: http://stackoverflow.com/comment/38745880
has comment: http://stackoverflow.com/comment/38746491
has title: Exporting Resultset from Java database to Excel using Apache Poi
has answer: http://stackoverflow.com/a/56110104
answer count: 4
type: AnsweredQuestion
tagged with: apache-poi
has comment: http://stackoverflow.com/comment/38746335
tagged with: java
possible better answer: http://stackoverflow.com/a/56847699
score: 6
accepted answer: http://stackoverflow.com/a/24934574
has answer: http://stackoverflow.com/a/56109562
has answer: http://stackoverflow.com/a/56847699
has comment: http://stackoverflow.com/comment/110094028
type: Question
has answer: http://stackoverflow.com/a/24934574
has body: Help am stucked on this project of exporting from result set to excel..previous solutions here haven't answered my questions but they have helped..here is my code so far it only displays a row in the database. My Code import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.util.logging.Level; import java.util.logging.Logger; import org.apache.poi.hssf.usermodel.HSSFSheet; import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.ss.usermodel.*; public class Plexada2 { public static void main(String[] args) { try { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); Connection conn = DriverManager.getConnection("jdbc:odbc:Storeway","root", ""); Statement st = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE); ResultSet rs = st.executeQuery("Select * from Storeway.order"); HSSFWorkbook workbook = new HSSFWorkbook(); HSSFSheet sheet = workbook.createSheet("lawix10"); Row row = sheet.createRow(0); int x=0; while (rs.next()){ String crate_id= rs.getString(2); String content=rs.getString(3); String Order_type= rs.getString(4); java.sql.Date date= rs.getDate(5); String datex= String.valueOf(date); row.createCell(0).setCellValue(crate_id); row.createCell(1).setCellValue(content); row.createCell(2).setCellValue(Order_type); row.createCell(3).setCellValue(datex); } x+=1; String yemi = "C:\\Users\\lawix10\\Desktop\\testlno9.xls"; FileOutputStream fileOut; try { fileOut = new FileOutputStream(yemi); workbook.write(fileOut); fileOut.close(); }
upvote count: 7
downvote count: 1

http://stackoverflow.com/comment/38827049
score: 0
type: Comment
type: QuestionComment
has text: Could you please show your OCL_Test code that is inside onClick() method?
comment on: http://stackoverflow.com/q/24973752

http://stackoverflow.com/a/25038647
has comment: http://stackoverflow.com/comment/39355849
has body: As discussed here: 14.10. Expressions We can use configuration setting: Booleans can be easily used in expressions by declaring HQL query substitutions in Hibernate configuration: true 1, false 0 This will replace the keywords true and false with the literals 1 and 0 in the translated SQL from this HQL: from Cat cat where cat.alive = true As far as I know one of these options should be: true 1, false 0, yes 'Y', no 'N' so you should try: true 1, false 0, yes 'J', no 'N'
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/39125388
has comment: http://stackoverflow.com/comment/39127921
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/25034894

http://stackoverflow.com/comment/57674204
type: Comment
type: QuestionComment
score: 1
has text: You need to write your custom Java code (with all your import statements) in a **routine** and then use functions defined in that routine either in tMap components directly (if possible) or use that in tJavaFlex components. For more details, see this https://help.talend.com/display/KB/Creating+a+user+routine+and+call+it+in+a+Job
comment on: http://stackoverflow.com/q/24934465

http://stackoverflow.com/comment/38936454
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25035211
has text: I think "the space" means the first char of the second to last line of the input.
score: 0

http://stackoverflow.com/comment/38801674
score: 2
has text: then you're just going to have to iterate through the array everytime before you print
comment on: http://stackoverflow.com/q/24963352
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25053364
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38970876
tagged with: swing
tagged with: jtextfield
downvote count: 1
tagged with: java
has body: I have seen code to fix number of characters in text field using MaskFormatter but that was for limited number i.e. 10 or 15 etc.. But for 300 characters do I need to put"#" 300 times? Is there any simple way of doing it. Please help
has title: To fix number of characters in JFormattedTextField to 300 usinf MaskFormatter
type: Question
has comment: http://stackoverflow.com/comment/38971066
upvote count: 0
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/25053917
score: -1
tagged with: jformattedtextfield

http://stackoverflow.com/a/25042372
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25042034
type: Answer
has body: It appears that you also need this jar: http://mvnrepository.com/artifact/org.apache.httpcomponents/httpcore/4.3.2 Please note that you may wish to consider using something like gradle or maven to manage your builds. This way you can simply say which dependency you want and maven or gradle will automatically download load it for you and make it available on your classpath within your IDE.
score: 0
accepted answer of: http://stackoverflow.com/q/25042034

http://stackoverflow.com/a/24948773
type: AcceptedAnswer
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/24948270
answers question: http://stackoverflow.com/q/24948270
type: Answer
upvote count: 1
has body: Option 1: When you run GWT in prod mode, WEB-INF/classes of the WAR is there on its classpath by default. Try putting your properties file right under the WEB-INF/classes. If your server still can't find the properties file, then use below code: InputStream is = this.getClass().getClassLoader().getResourceAsStream("Props.properties"); Properties myProps = new Properties(); myprops.load(is); Option 2: Externalize the location and put it outside your project strcture - e.g. under a properties directory somewhere on the filesystem. Then, you can add this properties directory to your classpath in your IDE (in Eclipse, you can do this by Build Path > Add Variable) and also add it in the classpath while running it in the server - refer to your server's documentation about how to add a classpath. E.g. to add a directory to classpath in tomcat, you have to do it like mentioned here Adding a directory to tomcat classpath
has comment: http://stackoverflow.com/comment/38963342
has comment: http://stackoverflow.com/comment/38777946

http://stackoverflow.com/q/24955072
has body: I've noticed that StringWriter uses internally a StringBuffer. But if you don't need that synchronisation overhead is there an equivalent to StringWriter that uses a StringBuilder inside?
tagged with: io
has comment: http://stackoverflow.com/comment/38785622
score: 8
has answer: http://stackoverflow.com/a/55349585
possible better answer: http://stackoverflow.com/a/24955215
downvote count: 1
has answer: http://stackoverflow.com/a/24955215
type: AnsweredQuestion
tagged with: performance
upvote count: 9
tagged with: java
has comment: http://stackoverflow.com/comment/38785772
has comment: http://stackoverflow.com/comment/38785620
accepted answer: http://stackoverflow.com/a/55349585
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/38785998
favorite count: 0
has title: Is there an equivalent to StringWriter but with StringBuilder internally in Java?

http://stackoverflow.com/a/25064843
has comment: http://stackoverflow.com/comment/38993710
downvote count: 0
upvote count: 2
type: Answer
answers question: http://stackoverflow.com/q/25064732
has comment: http://stackoverflow.com/comment/38993890
has body: You will need to put a for loop around the switch statement to parse each element of the list separately. If the list is an Iterable then it should look something like this: for (letterEnum : listOfLetterEnums) { switch(letterEnum) { ... } } For this to work, your list will need to implement the Iterator interface or extend a class which implements it. In this case you probably want to extend ArrayList. If the list is an array you can just parse each element of the array: for (int i = 0; i &lt; listOfLetterEnums.length; i++) { switch(listOfLetterEnums[i]) { ... } }
score: 2
has comment: http://stackoverflow.com/comment/38993163

http://stackoverflow.com/comment/38778473
comment on: http://stackoverflow.com/q/24950670
has text: I didn't get what your conversation is about ;) Anyway the code is added. Only the one which throws the exception. If I add only three items to the list, it won't throw it anymore.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25038117
score: 0
answer count: 1
tagged with: user-interface
has body: What is a good and friendly way to block access to a application while data entered by user is saved to server? I currently have a client application which retrieves and saves all data used from a server. When data is retrieved/saved from/to server i display a progressbar in the statusbar of the active window and block access to the active window by painting a transparent grey rectangle over the window. This way the user knows something is going on. But because retrieval and saving of data is fast, faster than the usual webapp, i'm wondering if i should paint a grey rectangle over the window, because it is quite distracting when the program is being used. In addition we don't usually block an entire webapp when data is submitted. Can i just count on that the user is smart enough not to click anything while data is retrieved/saved? Or is there maybe a better way to handle such a problem?
tagged with: progress
has comment: http://stackoverflow.com/comment/38941689
has comment: http://stackoverflow.com/comment/38941736
has title: Best practice to block access to application while saving data?
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25038815
has comment: http://stackoverflow.com/comment/38942930
tagged with: java
accepted answer: http://stackoverflow.com/a/25038815
type: Question
has comment: http://stackoverflow.com/comment/38941799

http://stackoverflow.com/q/24996509
favorite count: 0
has comment: http://stackoverflow.com/comment/38958432
has comment: http://stackoverflow.com/comment/38863534
type: UnansweredQuestion
score: -3
has comment: http://stackoverflow.com/comment/38995324
has title: Different byte code counts for same code
upvote count: 0
has comment: http://stackoverflow.com/comment/38995431
tagged with: java
has answer: http://stackoverflow.com/a/25002510
type: Question
tagged with: bytecode
has comment: http://stackoverflow.com/comment/38864351
has body: Hi I am trying to get the byte code count for some java codes using -XX:+CountBytecodes flag of Hotspot JVM. But this seems to give extremely dissimilar results when I perform parallel runs for the same code. Is this behavior expected? If yes, why? Is there any other profiler that would give constant byte code counts for the same code?
downvote count: 3
answer count: 1
tagged with: java-bytecode-asm
has comment: http://stackoverflow.com/comment/38967513
tagged with: jvm

http://stackoverflow.com/comment/38872026
type: QuestionComment
comment on: http://stackoverflow.com/q/24996776
type: Comment
has text: Great, I'll leave my comment but also make it an 'answer' then.
score: 0

faceted-search
tag name: faceted-search
type: Tag
tags question: http://stackoverflow.com/q/24999450

http://stackoverflow.com/a/25066733
answers question: http://stackoverflow.com/q/25066676
accepted answer of: http://stackoverflow.com/q/25066676
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38996434
upvote count: 3
has comment: http://stackoverflow.com/comment/38996542
has comment: http://stackoverflow.com/comment/39024474
type: Answer
has comment: http://stackoverflow.com/comment/38996277
downvote count: 0
has comment: http://stackoverflow.com/comment/38996275
score: 3
has body: If multiple constructors are annotated with @Inject, there will be ambiguity for the container to decide which to use to instantiate the type. Which would you choose @Inject public Foo (Bar bar) {} or @Inject public Foo (Zoom zoom) {} if there is absolutely no relation between Bar and Zoom.

http://stackoverflow.com/q/24950277
upvote count: 7
type: Question
tagged with: google-analytics
has answer: http://stackoverflow.com/a/55044762
has answer: http://stackoverflow.com/a/44061801
has title: How to automate test google analytics on every event fired using Selenium WebDriver
tagged with: javascript
has comment: http://stackoverflow.com/comment/38781836
has body: I am working on Google Analytics automation test with Selenium WebDriver java bindings. Our site has Google Analytics tracking events set on important elements on the site. I need to verify that on clicking a certain element under test, the Google Analytic event is in fact fired. I'm testing it on FireFox. When I click F12, I can see in the console that a Google Analytics is fired with message GET http://www.google-analytics.com/__utm.gif on each element click event. SampleCode :- WebDriver wd = new FirefoxDriver(); wd.get("http://www.dummyExample.com/"); wd.findElement(By.linkText("Document Referece")).click(); wd.findElement(By.id("Ex2vc2")).click(); How can I achieve this task? I have googled it but could not find good answers. If anyone can help me with some references or sample code I would be very Thankful.
has answer: http://stackoverflow.com/a/24960573
downvote count: 0
has comment: http://stackoverflow.com/comment/38784434
answer count: 4
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/30732161
tagged with: selenium-webdriver
score: 7
tagged with: java
tagged with: selenium

http://stackoverflow.com/comment/38924701
has text: Yes I am using tomcat 7.
comment on: http://stackoverflow.com/q/25028645
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38888317
type: QuestionComment
comment on: http://stackoverflow.com/q/25009579
score: 5
type: Comment
has text: @MarounMaroun My day on Stackoverflow starts with a String compare question.

collections
tags question: http://stackoverflow.com/q/24924689
tags question: http://stackoverflow.com/q/24973624
tags question: http://stackoverflow.com/q/24947530
tags question: http://stackoverflow.com/q/24940742
tags question: http://stackoverflow.com/q/24975111
tags question: http://stackoverflow.com/q/24955696
tags question: http://stackoverflow.com/q/25001992
tags question: http://stackoverflow.com/q/24992701
tags question: http://stackoverflow.com/q/24996093
tags question: http://stackoverflow.com/q/25041814
tags question: http://stackoverflow.com/q/25026181
type: Tag
tags question: http://stackoverflow.com/q/24931897
tags question: http://stackoverflow.com/q/24962521
tags question: http://stackoverflow.com/q/24943302
tags question: http://stackoverflow.com/q/24933564
tags question: http://stackoverflow.com/q/25058339
tags question: http://stackoverflow.com/q/24984787
tags question: http://stackoverflow.com/q/24940123
tag name: collections
tags question: http://stackoverflow.com/q/24998055
tags question: http://stackoverflow.com/q/24981551
tags question: http://stackoverflow.com/q/25007025
tags question: http://stackoverflow.com/q/25024600
tags question: http://stackoverflow.com/q/24976350

http://stackoverflow.com/q/25009164
tagged with: java
has comment: http://stackoverflow.com/comment/38887904
has comment: http://stackoverflow.com/comment/38887920
has comment: http://stackoverflow.com/comment/38887687
type: Question
answer count: 2
downvote count: 4
has comment: http://stackoverflow.com/comment/38887503
upvote count: 0
has comment: http://stackoverflow.com/comment/38887782
has comment: http://stackoverflow.com/comment/38887678
linked to: http://stackoverflow.com/q/4932282
has answer: http://stackoverflow.com/a/25009408
has body: This is my java class. I googled it up and it appear that my xml codes have errors, but i just dont know where. @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); button_pause = (ImageButton) findViewById(R.id.button_pause); button_play = (ImageButton) findViewById(R.id.button_play); button_refresh = (ImageButton) findViewById(R.id.button_refresh); button_replay = (ImageButton) findViewById(R.id.button_replay); volControl = (SeekBar)findViewById(R.id.volbar); txt_view = (TextView)findViewById(R.id.textView2); I tried to find the error from my xml codes, but it seems fine to me, can anyone help me please? My xml codes &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:background="@drawable/background" tools:context="${packageName}.${activityClass}" &gt; &lt;TextView android:id="@+id/textView2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_above="@+id/volbar" android:layout_centerHorizontal="true" android:text="Medium Text" android:textColor="#FFFFFF" android:textAppearance="?android:attr/textAppearanceMedium" /&gt; &lt;SeekBar android:id="@+id/volbar" android:layout_width="fill_parent" android:layout_height="wrap_content" android:max="100" android:progress="50" android:layout_alignParentBottom="true" android:layout_centerHorizontal="true" android:layout_margin="10dp" android:layout_marginBottom="21dp" /&gt; &lt;LinearLayout android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginTop="100dp"&gt; &lt;TextView android:id="@+id/textView1" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_alignBottom="@+id/button_play" android:layout_alignParentLeft="true" android:gravity="center" android…
has comment: http://stackoverflow.com/comment/38888117
has comment: http://stackoverflow.com/comment/38887543
has comment: http://stackoverflow.com/comment/38887583
has comment: http://stackoverflow.com/comment/38887720
favorite count: 0
has comment: http://stackoverflow.com/comment/38887680
has answer: http://stackoverflow.com/a/25009383
has comment: http://stackoverflow.com/comment/38887646
has title: Can anyone fix this? My R cannot be resolved to a variable
type: UnansweredQuestion
score: -4
tagged with: android
has comment: http://stackoverflow.com/comment/38887995
has comment: http://stackoverflow.com/comment/38887651
has comment: http://stackoverflow.com/comment/38887734
has comment: http://stackoverflow.com/comment/38887820

colors
tags question: http://stackoverflow.com/q/25031624
tags question: http://stackoverflow.com/q/25004621
tags question: http://stackoverflow.com/q/25059025
tags question: http://stackoverflow.com/q/24910276
tags question: http://stackoverflow.com/q/24985945
tags question: http://stackoverflow.com/q/24986640
tag name: colors
type: Tag

http://stackoverflow.com/comment/38924512
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25028190
score: 0
has text: @Rod_Algonquin its the company email address!, what different regex should I use? thanks

http://stackoverflow.com/comment/38800332
type: Comment
type: QuestionComment
has text: I edited because I had written the equals comparison wrong. it also return true when I use equals.
comment on: http://stackoverflow.com/q/24962630
score: 0

http://stackoverflow.com/comment/38864801
has text: Thanks for the reply..for the code, all the time the listeners point to firstly added table actions. So, if i add jTableNum3 first then that table keeps working fine and rest all with no changes...
comment on: http://stackoverflow.com/q/24995971
type: QuestionComment
type: Comment
score: 0

http://stackoverflow.com/comment/38717549
score: 2
has text: please share the code doing the import
comment on: http://stackoverflow.com/q/24917327
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25009140
type: AnsweredQuestion
downvote count: 0
score: 1
favorite count: 0
has body: Does anyone who is familiar with JADE knows how to create more than one jade agents at once using eclipse and send messages within them? If you are ok, if you give your email address i may be able to contact you whenever i get any doubt on JADE. Thanks in advance
type: Question
has title: Creating more than one JADE agent using Eclipse
tagged with: agents-jade
has comment: http://stackoverflow.com/comment/39642353
upvote count: 1
answer count: 1
has answer: http://stackoverflow.com/a/25683085
tagged with: java
tagged with: eclipse
accepted answer: http://stackoverflow.com/a/25683085

http://stackoverflow.com/q/25051278
has answer: http://stackoverflow.com/a/28139913
accepted answer: http://stackoverflow.com/a/26192986
has answer: http://stackoverflow.com/a/38111398
linked to: http://stackoverflow.com/q/28581211
type: Question
has comment: http://stackoverflow.com/comment/44385940
has answer: http://stackoverflow.com/a/59876726
has answer: http://stackoverflow.com/a/78899191
has comment: http://stackoverflow.com/comment/38967001
has answer: http://stackoverflow.com/a/57886371
possible better answer: http://stackoverflow.com/a/37693400
has answer: http://stackoverflow.com/a/42295517
has title: Unable to clean project in Android Studio
tagged with: ubuntu-14.04
has answer: http://stackoverflow.com/a/38755746
has answer: http://stackoverflow.com/a/26192986
has answer: http://stackoverflow.com/a/38963187
has answer: http://stackoverflow.com/a/42429423
upvote count: 41
has answer: http://stackoverflow.com/a/53129018
has answer: http://stackoverflow.com/a/48751421
has body: OS version: Ubuntu 14.04 LTE 64 Bit Java JRE/JDK version: Oracle JDK 1.8.0_11 Project directory is on a NTFS based drive. Whenever I try to clean my project I get something like below. :app:clean FAILED Error:Execution failed for task ':app:clean'. Unable to delete file: /media/DriveA/AndroidStudioWorkspace/DNA/app/build/intermediates/classes/debug/.../mechandising/MerchandizingActivity$3.class When I try to delete the build folder manually I get the following error. Error when getting information for file '/media/DriveA/AndroidStudioWorkspace/DNA/app/build/intermediates/pre-dexed': Input/output error I am unable to figure out whether its a Linux problem or a Studio problem. I don't face such a problem in Eclipse (Same Drive) so I am just considering it to be something wrong with my studio. Any Suggestions??
has answer: http://stackoverflow.com/a/49178047
has answer: http://stackoverflow.com/a/52151830
has answer: http://stackoverflow.com/a/56212732
favorite count: 0
has answer: http://stackoverflow.com/a/56054209
tagged with: linux
has answer: http://stackoverflow.com/a/29216934
has answer: http://stackoverflow.com/a/59420082
tagged with: android
has answer: http://stackoverflow.com/a/37693400
has comment: http://stackoverflow.com/comment/38967459
has answer: http://stackoverflow.com/a/65323834
answer count: 22
tagged with: android-studio
has answer: http://stackoverflow.com/a/39904628
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/71211738
score: 41
has answer: http://stackoverflow.com/a/46209728
downvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/38967135
has comment: http://stackoverflow.com/comment/69817335

http://stackoverflow.com/a/25062197
upvote count: 7
type: AcceptedAnswer
type: Answer
downvote count: 0
score: 7
has comment: http://stackoverflow.com/comment/38990165
has comment: http://stackoverflow.com/comment/38989527
accepted answer of: http://stackoverflow.com/q/25061895
answers question: http://stackoverflow.com/q/25061895
has body: The bytes are in UTF-8, and it is the Unicode line separator "\u2028". You are right. desc = desc.replace("\u2028", "");

http://stackoverflow.com/comment/38847046
type: Comment
score: 1
comment on: http://stackoverflow.com/q/24987535
has text: Is your document using UTF-8?
type: QuestionComment

http://stackoverflow.com/q/24988384
type: AnsweredQuestion
score: 2
upvote count: 2
tagged with: java
has answer: http://stackoverflow.com/a/24988446
type: Question
has body: How can I check the FileExtension of a URL which is sent from server in jsonResponce. I want to pass a method if my URL has ".flv" in the end. for example http://derana.lk/apps/apple/tvderana/iframe_video.php?file=SriGauthamaSambuddha_35_19673.flv Above link has ".flv" in the end.So i know that is a flv video. i want to know a method to check if my url has .flv in the end and if it has pass a method.
tagged with: fetch
tagged with: flv
accepted answer: http://stackoverflow.com/a/24988446
answer count: 1
downvote count: 0
tagged with: url
favorite count: 0
has title: Check File Extension in Java/Android
tagged with: android
has comment: http://stackoverflow.com/comment/38848687

http://stackoverflow.com/q/25030857
has comment: http://stackoverflow.com/comment/38928367
downvote count: 1
has body: I tried to simulate email validation without regular expression in java and wrote this code. I need help to improve efficiency of this code (or give me a better way to solve this issue please) regular expression: ^[(a-zA-Z-0-9-\\_\\+\\.)]+@[(a-z-A-z)]+\\.[(a-zA-z)]{2,3}$ public static boolean isValidEmailAddress(String email) { boolean flag1 = false; boolean flag2=false; boolean flag3=false; int j=0; char[] emailChars = email.toCharArray(); for (int i = 0; i &lt; emailChars.length;) { char c = emailChars[i]; if (Character.isLetterOrDigit(c)) { i++; if(flag1==true&amp;&amp;flag2==true){ j++; } } else if (c == '@' &amp;&amp; flag1==false&amp;&amp;flag2==false &amp;&amp; flag3==false) { i++; flag1=true; } else if(c=='.' &amp;&amp; flag1==true &amp;&amp; flag2==false&amp;&amp;flag3==false){ i++; flag2 = true; } if(j==2 || j==3){ flag3=true; } } return flag1&amp;&amp;flag2&amp;&amp;flag3; }
has answer: http://stackoverflow.com/a/25030947
score: 4
has answer: http://stackoverflow.com/a/25030990
favorite count: 0
linked to: http://stackoverflow.com/q/201323
upvote count: 5
has comment: http://stackoverflow.com/comment/38928371
tagged with: regex
has title: java code for regex of email validation
has comment: http://stackoverflow.com/comment/38948063
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38928382
type: Question
has comment: http://stackoverflow.com/comment/38945575
duplicate of: http://stackoverflow.com/q/201323
tagged with: java
answer count: 2

http://stackoverflow.com/a/24911184
upvote count: 1
has body: When you have the line that throws an NPE plugin.log.info("There is something wrong in the MySQLHandler: " + ex.toString()); // This gives me the nullpointerexception the following variables could be null: plugin plugin.log ex (this should not happen as an caucht exception is not null!) You could try the following to check what is null (just for debuggin purpose, not in your productive code): } catch (...) if (plugin == null) System.out.println("plugin is null"); if (plugin.log == null) System.out.println("plugin.log is null"); //... }
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/24910684
score: 1

http://stackoverflow.com/comment/38815180
type: Comment
score: 0
has text: I have updated my post. just set the flag and stop the swing timer.
type: AnswerComment
comment on: http://stackoverflow.com/a/24970755

http://stackoverflow.com/q/24948468
tagged with: java
has answer: http://stackoverflow.com/a/24968818
score: 0
answer count: 1
type: UnansweredQuestion
has title: How can we create dependency on several tests in testNg suite.xml
tagged with: http://stackoverflow.com/tag/xml
tagged with: testng
type: Question
has body: I am newbie to testNG and have created a suite.xml as below: <class name="tests.checkLogin"/> <class name="tests.fetchFromDB"/> All the tests are written in Java and here, checkLogin and fetchFromDB are classes in tests package.Now, my test1 gets failed due to some issue and I explicitly throw Runtime exception to fail it, this test gets successfully failed. However, test2 is called successfully after it. My requirement is that if test1 fails then test2 should not be invoked. Can anybody please help me how can this be achieved?

http://stackoverflow.com/comment/38881864
has text: I actually have this in an if statement so that if the String is longer than 4 characters, it will be truncated, else it is less than 4 characters and just set it equal to displayName.
comment on: http://stackoverflow.com/q/24989905
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24915700
tagged with: log4j
favorite count: 0
type: UnansweredQuestion
has title: Setting Up Log4J in IntelliJ IDEA 13
score: 3
downvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/24915766
type: Question
has comment: http://stackoverflow.com/comment/38711972
has body: I'm building a simple app in IntelliJ IDEA 13 and can't seem to figure out how to get log4j working. My app is a simple demo that I made to make sure I could build something functional, all it does is multiply two random numbers and uses apache tomcat to put it on a localhost that I can access via my browser. Here is the class code: package Sample; log4j-api-2.0.jar; log4j-core-2.0.jar; import org.apache.log4j.Logger; import org.apache.log4j.LogManager; public class HelloWorld { public static double getMessage() { return Math.random()* Math.random(); } private static Logger log = LogManager.getRootLogger(); log.debug("Debugging Message"); log.info("Informational message"); log.warn("Warning Message"); System.in.read(); } I'm getting the error "class or interface expected" at the import lines and jar file lines so I don't think I've placed the corresponding files in the right directory. That's also causing the rest of the logging lines (from private static Logger... on) to generate errors.
upvote count: 3
answer count: 1

http://stackoverflow.com/comment/38848983
has text: null properties on my representation objects are not serialized. But when I add the Link properties with Injectlink annotation, null properties of the Link object (specifically JerseyLink) are serialized.
score: 0
comment on: http://stackoverflow.com/q/24968448
type: QuestionComment
type: Comment

http://stackoverflow.com/a/24992024
has body: Use XmlAccessorType. I provide ReadingRecursive XMLref. Putcategory.xml` into classpath. category.xml <?xml version="1.0" encoding="UTF-8"?> Category.java import java.util.ArrayList; import java.util.List; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; @XmlRootElement(name="category") @XmlAccessorType(XmlAccessType.FIELD) public class Category { @XmlAttribute private String id; @XmlAttribute private String name; @XmlElement(name="category") private List subCategoryList; public String getId() { return id; } public void setId(String id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public List getSubCategoryList() { return subCategoryList; } public void setSubCategoryList(List subCategoryList) { this.subCategoryList = subCategoryList; } } Test.java import java.io.File; import javax.xml.bind.JAXBContext; import javax.xml.bind.Marshaller; import javax.xml.bind.Unmarshaller; public class Test { public static void main(String[] args) throws Exception { JAXBContext jc = JAXBContext.newInstance(Category.class); Unmarshaller unmarshaller = jc.createUnmarshaller(); Category category = (Category) unmarshaller.unmarshal(new File("category.xml")); System.out.println(category.getName()); System.out.println(category.getSubCategoryList().size()); System.out.println("-------------------------"); Marshaller marshaller = jc.createMarshaller(); marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); marshaller.marshal(category, System.out); } } Output Programming 2 ------------------------- <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
has comment: http://stackoverflow.com/comment/38855924
type: Answer
answers question: http://stackoverflow.com/q/24989976
score: 0

http://stackoverflow.com/comment/38706787
type: Comment
comment on: http://stackoverflow.com/q/24913090
has text: option 3 is related to 2, but the class should extent parcelable so not to cause memory leaks. Parcelables will essentially create a copy of them self. all these options are acceptable, but depends on your desired effect.. you could i suppose as sharedPreferences to the list
score: 0
type: QuestionComment

http://stackoverflow.com/comment/39008427
comment on: http://stackoverflow.com/a/25066217
type: Comment
has text: Good . now your are taking full control of your Code !
score: 0
type: AnswerComment

http://stackoverflow.com/comment/38984551
comment on: http://stackoverflow.com/q/25058315
type: Comment
type: QuestionComment
has text: Ok, as I understand, I cant .clear() the Stage right there, because if I click the button on the screen to get the changed()-method from the ChangeListener to execute, it triggers an 'old' version, not the one I add right after the .clear() ... I figured it out by simply not clearing the actors of the stage: when I clicked i got 'clicked actor 12 of 15' for example
score: 0

http://stackoverflow.com/a/25020555
downvote count: 0
upvote count: 55
type: AcceptedAnswer
score: 55
has comment: http://stackoverflow.com/comment/38909769
type: Answer
has body: The -y in your apt-get install commands is telling apt-get to "assume yes", which isn't the same as running in non-interactive mode. You're seeing the "unable to initialize frontend: Dialog" messages because Debian is running apt-get in interactive mode. To tell it to run in non-interactive mode, add this line to the start of your Dockerfile: ENV DEBIAN_FRONTEND noninteractive Now your commands will be running in non-interactive mode, so apt-get won't try and pop any dialogs up. As for your actual error, you're right, add-apt-repository is a part of the python-software-properties. Try putting your apt-get update -y command above your apt-get install python-software-properties command. RUN apt-get update -y && \ apt-get install python-software-properties -y && \ add-apt-repository ppa:webupd8team/java -y && \ apt-get update -y && \ apt-get install oracle-java7-installer -y && \ oracle-java7-set-default Note, you'll need to do two apt-get update -y commands, one before you start (always a good habit to get into) and one after you've added the oracle java PPA. apt-get manual Docker ENV docs
has comment: http://stackoverflow.com/comment/38909647
accepted answer of: http://stackoverflow.com/q/25019183
answers question: http://stackoverflow.com/q/25019183
has comment: http://stackoverflow.com/comment/55881813

http://stackoverflow.com/a/24914362
has comment: http://stackoverflow.com/comment/38709490
upvote count: 7
has body: Change if (x == 1); to if (x == 1) The semi-colon is wrong in this context. It causes the {...} block following it to always be executed. And you might want to replace the if statements with if-else if-...-else: if (x == 1) { ... } else if (...) { ... } else if (...) { ... else { ... } since if one of the conditions evaluates to true, non of the others can evaluate to true, and I'm assuming you wish the else clause to be executed only if all the conditions are false (and not just the last condition). Or better yet, use a switch statement.
has comment: http://stackoverflow.com/comment/38709324
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/38709378
score: 7
has comment: http://stackoverflow.com/comment/38709496
answers question: http://stackoverflow.com/q/24914354
has comment: http://stackoverflow.com/comment/38709253

http://stackoverflow.com/q/25012221
accepted answer: http://stackoverflow.com/a/25012433
has comment: http://stackoverflow.com/comment/38894161
type: Question
has comment: http://stackoverflow.com/comment/38894780
downvote count: 4
answer count: 2
has comment: http://stackoverflow.com/comment/38894435
has comment: http://stackoverflow.com/comment/38893686
has comment: http://stackoverflow.com/comment/38894384
has comment: http://stackoverflow.com/comment/38893762
linked to: http://stackoverflow.com/q/13366060
score: 4
favorite count: 0
has comment: http://stackoverflow.com/comment/38893807
upvote count: 8
has comment: http://stackoverflow.com/comment/38893843
has comment: http://stackoverflow.com/comment/38894820
has comment: http://stackoverflow.com/comment/38893891
possible better answer: http://stackoverflow.com/a/25012447
has comment: http://stackoverflow.com/comment/38893526
has comment: http://stackoverflow.com/comment/38893766
has answer: http://stackoverflow.com/a/25012447
has comment: http://stackoverflow.com/comment/38893683
has body: public class Short { public static void main(String[] args) { Set s = new HashSet(); for(short i = 0; i &lt; 100; i++) { s.add(i); s.remove(i-1); } System.out.print(s.size()); } } Can anyone tell me why it prints 100 instead of 1?
has comment: http://stackoverflow.com/comment/38893733
has answer: http://stackoverflow.com/a/25012433
has comment: http://stackoverflow.com/comment/38894211
has comment: http://stackoverflow.com/comment/38893796
has title: Why does this code print 100 instead of 1?
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38894268
tagged with: java
has comment: http://stackoverflow.com/comment/38895903

http://stackoverflow.com/comment/38975335
has text: since you are using netbeans easily you can drag jtable to the corners of jpanel. Netbeans will handle rest of the stuffs
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25055742

http://stackoverflow.com/a/24945522
downvote count: 0
type: Answer
score: 2
answers question: http://stackoverflow.com/q/24945420
has body: If each line of the file is an integer then: List&lt;Integer&gt; results = new ArrayList&lt;Integer&gt;(); try { File myFile = new File("./num.txt"); Scanner scanner = new Scanner(myFile); while (scanner.hasNextInt()) { results.add(scanner.nextInt()); } } catch (FileNotFoundException e) { // Error handling }
upvote count: 2

http://stackoverflow.com/q/24911604
answer count: 3
has answer: http://stackoverflow.com/a/24911933
favorite count: 0
linked to: http://stackoverflow.com/q/992019
has comment: http://stackoverflow.com/comment/38704490
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/49505684
tagged with: encryption
has title: AES-256 encryption: Generate 256bits(32bytes) key from my fixed string
tagged with: cryptography
tagged with: aes
score: 1
has comment: http://stackoverflow.com/comment/38704152
upvote count: 3
tagged with: java
downvote count: 2
has answer: http://stackoverflow.com/a/49508504
type: Question
has comment: http://stackoverflow.com/comment/38704671
has body: I would like to use AES256 to encrypt a text, I'd like to use my email test@gmail.com as the key to encrypt it. This is what I tried: String key = "test@gmail.com"; SecretKeySpec keySpec = new SecretKeySpec(key.getBytes("UTF-8"), "AES"); byte iv[] = SOME_RANDOM_32_BYTES; IvParameterSpec ivSpec = new IvParameterSpec(iv); Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding"); cipher.init(Cipher.DECRYPT_MODE, keySpec, ivSpec); byte[] encryptedResult = cipher.doFinal(text.getBytes("UTF-8")); When I run above code, I got InvalidKeyException: java.security.InvalidKeyException: Key length not 128/192/256 bits. I checked on internet, the reason is my key is not 128/192/256 bits. My question is, how can I generate a 256bits(32bytes) key from my email string test@gmail.com ?

http://stackoverflow.com/q/24920110
answer count: 1
favorite count: 0
tagged with: regex
has answer: http://stackoverflow.com/a/24920742
has title: use a fullname as a Java regex pattern to match first or last name
upvote count: 2
has comment: http://stackoverflow.com/comment/38720801
type: Question
has body: If a user can only enter a single string search term to find users by name, and users have names stored as First and Last name strings, then I would like to use the input string to search by either first name, last name, or both. While it's possible to conditionally split the input, and then match the first and second strings against both the first and last names, there's a lot of logic there, and I'm wondering if there's a cleaner way to turn the whole string into a regex pattern that will match For example: If the user enters "John Doe", I would like it to retrieve users with the first names "John" or "Doe", and the last names "John" or "Doe", as well as "John Doe". I would like "John" to also return users with first or last names "John". I am looking for the most efficient way to do this, preferably without having to split the input string by any possible white space. final String searchTerm = "John Doe"; pattern = Pattern.compile(/* some regex pattern */, Pattern.CASE_INSENSITIVE); results = usersCollection.find(new BasicDBObject("$or", new BasicDBList() { { add(new BasicDBObject("firstName", pattern)); add(new BasicDBObject("lastName", pattern)); } }) ); without the simple regex pattern for the whole search term, I would have to be final String searchTerm = "John Doe"; String[] parts = searchTerm.split(" "); firstPattern = Pattern.compile(parts[0], Pattern.CASE_INSENSITIVE); secondPattern = Pattern.compile(parts[1], Pattern.CASE_INSENSITIVE); results = usersCollection.find(new BasicDBObject("$or", new BasicDBList() { { add(new BasicDBObject("firstName", firstPattern)); add(new BasicDBObject("lastName", secondPattern)); /*AND*/ add(new BasicDBObject("firstName", secondPattern)); add(new BasicDBObject("lastName", firstPattern)); } }) ); and also there would need to be conditional logic to detect a string that is a single name, like "John", to eliminate the split and compare first and last name to a single string. This is all pretty tedious and if a single regex p…
type: AnsweredQuestion
tagged with: java
downvote count: 3
has comment: http://stackoverflow.com/comment/38720641
has comment: http://stackoverflow.com/comment/38721043
score: -1
accepted answer: http://stackoverflow.com/a/24920742
has comment: http://stackoverflow.com/comment/38720471

http://stackoverflow.com/q/24952437
answer count: 1
downvote count: 1
favorite count: 0
score: 0
tagged with: http://stackoverflow.com/tag/pdf
has body: I have an application which opens a pdf file with dimensions 1700pixels*2200pixels. I will get dimensions of a rectangle drawn over a pdf from it. When I am trying to create the same rectangle on a pdf, I am using PdfBox which creates a pdf page with dimensions. System.out.println(page.getMediaBox().getHeight()); System.out.println(page.getMediaBox().getWidth()); results in : 612 792 How to convert the pdf coordinates from 1700*2200 to 612*792?
tagged with: pdf-generation
has title: Create a pdf with dimensions 1700pixels*2200pixels in java using pdfBox
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24953138
tagged with: java
accepted answer: http://stackoverflow.com/a/24953138
tagged with: pdfbox
type: Question
upvote count: 1

http://stackoverflow.com/comment/38856330
type: QuestionComment
comment on: http://stackoverflow.com/q/24991803
score: 1
has text: Unlikely. In cmd.exe ^Z is treated as the end of input so if you do something like `type whatever.txt` it will break when it hits ^Z if the file happens to contain one, but this only applies to the Windows command line. io libraries for programming should happily parse it as just another character.
type: Comment

http://stackoverflow.com/comment/38931503
type: QuestionComment
has text: Do your own integer multiplication instead of using the library pow. It's easy to prove that neither of your functions is correct. `2^999999999 * 2 = 2^1000000000`, so `(fast_exp(2,999999999) * 2) % 1000000007` should be equal to `fast_exp(2, 1000000000)`.
score: 1
comment on: http://stackoverflow.com/q/25031414
type: Comment

otto
tag name: otto
type: Tag
tags question: http://stackoverflow.com/q/25004921

http://stackoverflow.com/comment/38953775
type: Comment
has text: @fmodos the reason I think it runs on a different port is because of this `start?path=/online OK - Started application at context path /online run-deploy: Browsing: http://localhost:8084/online`. thats from nedbeans console
score: 0
comment on: http://stackoverflow.com/q/25042763
type: QuestionComment

http://stackoverflow.com/q/24980333
has title: What is the purpose of using synchronized (Thread.currentThread())?
type: AnsweredQuestion
tagged with: java
linked to: http://stackoverflow.com/q/22981673
has answer: http://stackoverflow.com/a/24980410
type: Question
has comment: http://stackoverflow.com/comment/38833142
has body: Can any one please elaborate why the below code snippet gives IllegalMonitorStateException? I still can't able to find why and when this exception occurs and what is the purpose to lock on the current executing thread instead of object? void waitForSignal() { Object obj = new Object(); synchronized (Thread.currentThread()) { obj.wait(); obj.notify(); } }
has comment: http://stackoverflow.com/comment/38833891
score: 0
has answer: http://stackoverflow.com/a/24980360
has answer: http://stackoverflow.com/a/24980653
accepted answer: http://stackoverflow.com/a/24980653
possible better answer: http://stackoverflow.com/a/24980619
answer count: 4
has answer: http://stackoverflow.com/a/24980619
tagged with: multithreading

http://stackoverflow.com/comment/38715883
type: QuestionComment
comment on: http://stackoverflow.com/q/24917712
has text: What kind of client? Desktop web browser? Android app? Something else?
score: 0
type: Comment

http://stackoverflow.com/comment/39088825
comment on: http://stackoverflow.com/a/25053857
has text: Sorry for not getting back to you earlier. I'm trying to work out what you advised with the Listeners currently. The linked question didn't really help me. I left out the Layout in the example snippet but I will definitely keep it in mind for applications I work again. Thanks again for the answer!
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/24970913
type: AnsweredQuestion
tagged with: java
type: Question
tagged with: algorithm
score: 0
answer count: 2
has body: I am relatively new to Java but trying to get better of course. I can't solve a decently easy looking problem but here it is : Write a program that calculates n!/k! (factorial), take n and k as user input, check if n>k>0 and print an error if not so. Here is what I have so far. I know I haven't done the error part of the problem but I want to make it work for now. Computing one factorial is pretty straight forward but dividing the two seemed a challenge. Any help would be appreciated! Thanks in advance! import java.util.Scanner; public class nkFactorial { @SuppressWarnings({ "resource" }) public static void main(String[] args) { Scanner input = new Scanner(System.in); System.out.println("Enter n"); int n = input.nextInt(); System.out.println("Enter k"); int k = input.nextInt(); long nfactorial=1; long kfactorial=1; do { nfactorial *=n; n--; kfactorial *=k; k--; } while (n&gt;k &amp;&amp; k&gt;1); System.out.println("n!/k!=" + nfactorial/kfactorial ); } }
has answer: http://stackoverflow.com/a/24970930
accepted answer: http://stackoverflow.com/a/24970930
possible better answer: http://stackoverflow.com/a/24970984
has title: Dividing two factorials
has answer: http://stackoverflow.com/a/24970984

http://stackoverflow.com/a/25028139
type: Answer
accepted answer of: http://stackoverflow.com/q/25028057
answers question: http://stackoverflow.com/q/25028057
type: AcceptedAnswer
score: 0
has body: UDP is connection-less, and 'ServerSocket' is connection-oriented and TCP-only. Have a look at the Oracle docs on datagrams (UDP). UDP ports and TCP ports are in different namespaces; you can't get mixups from one to the other.

http://stackoverflow.com/comment/38809706
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24962242
has text: if i use a R.layout."the file name" the error pops up"yoyo cannot be resolved or is not a field"
score: 0

http://stackoverflow.com/q/24998830
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
tagged with: java
type: Question
has title: stub file in client class not recocgnised using soap
tagged with: apache-axis
has answer: http://stackoverflow.com/a/25385310
score: 0
accepted answer: http://stackoverflow.com/a/25385310
answer count: 1
tagged with: wsdl
has body: I followed this guide "http://wso2.com/library/1719/", I didn't modified nothig except in the part of java to wsdl where i setted the taget namespace as http ://ws and in schema target namespace http ://ws I used for this tutorial a service and a client. I generate correctly (the tomcat server doesn't give error in axis page) the.aar file and the wsdl from it. Service: ` import java.time.*; import java.time.format.DateTimeFormatter; public class ATMachine { //program begin public double deposita(double amount) { Deposit.deposit = amount; //= read.nextDouble(); BalanceInquiry.balance = Deposit.deposit + BalanceInquiry.getBalance(); LocalDateTime date1= LocalDateTime.now(); String md= "deposit"; DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd-MM-yyyy HH:mm:ss"); String date2= date1.format(formatter); BalanceInquiry.updateBalance(Deposit.deposit,BalanceInquiry.movement,md,date2); return Deposit.deposit; } public double preleva(double amount) { Withdraw.withdraw = amount; LocalDateTime date = LocalDateTime.now(); String mw= "withdraw"; DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd-MM-yyyy HH:mm:ss"); String date3= date.format(formatter); BalanceInquiry.updateBalance(Withdraw.withdraw,BalanceInquiry.movement,mw,date3); int erwithdraw=BalanceInquiry.withdrawMoney(); // risposta di withdraw return erwithdraw; } public String[] bilancio(){ double checkb=BalanceInquiry.getBalance(); String[] rbilancio= new String[12]; rbilancio[0]= Double.toHexString(checkb); for(int i1=1;i1&lt;=rbilancio.length;i1++){ for(int i=0;i&lt;= BalanceInquiry.movement.length-1; i++){ if(BalanceInquiry.movement[i]==null){ rbilancio[i1]=""; } else{rbilancio[i1]=BalanceInquiry.movement[i]; } } } return rbilancio; } } ` ATMClient ` package ws; import java.util.Scanner; import java.io.*; import java.util.Properties; import org.apache.axis2.client.ServiceClient; import org.apache.axis2.context.ConfigurationContext; import org.apache.axis2.context.ConfigurationContextFactory;…
tagged with: soap

http://stackoverflow.com/comment/38866140
score: 0
type: Comment
comment on: http://stackoverflow.com/q/24997927
type: QuestionComment
has text: The error is pretty clear.

http://stackoverflow.com/comment/38808665
has text: @DavidConrad, `\\s` will match any whitespace character. I thought it was OP's intention to exclude alpha-numeric characters and space characters, so I didn't touch it.
comment on: http://stackoverflow.com/a/24967120
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/24965561
type: Question
tagged with: chunked-encoding
has answer: http://stackoverflow.com/a/24965754
answer count: 1
downvote count: 0
tagged with: file-upload
favorite count: 0
tagged with: google-drive-api
has body: I am attempting to upload a large (~512 MB) file to Google Drive via the API. I would strongly prefer to use the Java SDK for its help with OAuth. I am generating this file and streaming to Drive without storing it anywhere. In particular, this means I do not know the length of the file before sending it. Java SDK I have looked in the Java SDK, but I see no way to go this. com.google.api.client.http.AbstractInputStreamContent requires implementations to support getLength(). HTTP I see a reference to chunked transfer (which is made for exactly this situation) on https://developers.google.com/drive/web/manage-uploads The most straightforward method for uploading a file is by making a simple upload request. This option is a good choice when: The file is small enough to upload again in its entirety if the connection fails. There is no metadata to send. This might be true if you plan to send metadata for this resource in a separate request, or if no metadata is supported or available. To use simple upload, make a POST or PUT request to the method's /upload URI and add the query parameter uploadType=media. For example: POST https://www.googleapis.com/upload/drive/v2/files?uploadType=media The HTTP headers to use when making a simple upload request include: Content-Type. Set to one of the method's accepted upload media data types, specified in the API reference. Content-Length. Set to the number of bytes you are uploading. Not required if you are using chunked transfer encoding. but it is only supposed to be used for "small" files. It seems to run counter to the point of chunked transfer encoding if it is only ever used for small files. Can I send large files to Google Drive without knowing their size ahead of time?
type: UnansweredQuestion
has title: Upload to Google Drive without knowing size
score: 1
tagged with: java
upvote count: 1

http://stackoverflow.com/comment/38859085
type: QuestionComment
has text: are you created API key with SHA-1 key + package name mentioned in the manifest file. i.e.,your SHA-1+com.example.googlemaps
comment on: http://stackoverflow.com/q/24993895
score: 0
type: Comment

http://stackoverflow.com/q/25007809
tagged with: java
score: 2
downvote count: 0
has body: In this JTabbedPane screenshot I am using DnD of Netbeans, and I've been tinkering around it just to put spaces between the tabs. So far I still can't get what I want. Is there a way to do it?
accepted answer: http://stackoverflow.com/a/25018701
type: Question
type: AnsweredQuestion
favorite count: 0
tagged with: netbeans
tagged with: jtabbedpane
tagged with: drag-and-drop
upvote count: 2
has title: Spacing Between JTabbedPane
tagged with: swing
answer count: 1
has answer: http://stackoverflow.com/a/25018701

http://stackoverflow.com/a/24988652
has body: It is really surprising - Check the openJDK 7 code of Throwable.java class. Implementation of getLocalizedMessage is - 390 public String getLocalizedMessage() { 391 return getMessage(); 392 } And implemenation of getMessage is - 376 public String getMessage() { 377 return detailMessage; 378 } And 130 private String detailMessage; There is no change in implemenation of both method but documentation.
has comment: http://stackoverflow.com/comment/138752702
upvote count: 11
score: 9
downvote count: 2
answers question: http://stackoverflow.com/q/24988491
has comment: http://stackoverflow.com/comment/52509785
type: Answer

http://stackoverflow.com/comment/38891287
score: 0
type: AnswerComment
type: Comment
has text: looks like it will fit just fine
comment on: http://stackoverflow.com/a/25004339

http://stackoverflow.com/comment/38959297
type: Comment
has text: Thanks I think it worked, I'll test with the console
comment on: http://stackoverflow.com/q/25046767
score: 0
type: QuestionComment

baseadapter
tags question: http://stackoverflow.com/q/25053134
type: Tag
tags question: http://stackoverflow.com/q/24987801
tags question: http://stackoverflow.com/q/24926998
tag name: baseadapter

http://stackoverflow.com/q/24986621
has comment: http://stackoverflow.com/comment/38845320
has answer: http://stackoverflow.com/a/24986681
tagged with: java
has body: I'm currently trying to have a background image scale down to fit into different window sizes. The image I'm using is 1080x1920 and I'm trying to have it scale down to a window that is 540x960 in the code below. I'm not having any luck. I'm using bg.draw(g) below to draw the background and, in the past, was able to write "(g, 0, 0, getWidth(), getHeight(), null);" or something similar to have it scale, but it doesn't seem to be working out with this method. Any help would be awesome! GameState Class: package GameState; import SpriteSheet.Background; import java.awt.*; import java.awt.event.KeyEvent; import java.awt.event.MouseEvent; public class MenuState extends GameState { private Background bg; private int currentChoice = 0; private String[] options = { "Start", "Help", "Quit" }; private Color titleColor; private Font titleFont; private Font font; public MenuState(GameStateManager gsm) { this.gsm = gsm; try { bg = new Background("/Images/LivingRoom.png", 0.5); titleColor = new Color(128, 0, 0); titleFont = new Font( "Century Gothic", Font.PLAIN, 28); font = new Font("Arial", Font.PLAIN, 12); } catch(Exception e) { e.printStackTrace(); } } public void init() {} public void update() { bg.update(); } public void draw(Graphics2D g) { // draw bg bg.draw(g); bg.resize(540, 960); // draw title g.setColor(titleColor); g.setFont(titleFont); g.drawString("Title", 80, 70); // draw menu options g.setFont(font); for(int i = 0; i &lt; options.length; i++) { if(i == currentChoice) { g.setColor(Color.BLACK); }else { g.setColor(Color.RED); } g.drawString(options[i], 145, 140 + i * 15); } } public void resize(){ bg.resize(540, 960); } private void select() { if(currentChoice == 0) { // start } if(currentChoice == 1) { // help } if(currentChoice == 2) { System.exit(0); } } public void keyPressed(int k) { if(k == KeyEvent.VK_ENTER){ select(); } if(k == KeyEvent.VK_UP) { currentChoice--; if(currentChoice == -1) { currentChoice = options.length - 1; } } if(k == KeyEvent.VK_DOWN) { cur…
tagged with: background
type: Question
has comment: http://stackoverflow.com/comment/38845284
answer count: 1
score: 0
tagged with: scale
tagged with: android
has title: Scaling background image to different window sizes? [JAVA]
type: UnansweredQuestion

http://stackoverflow.com/comment/38828360
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/24975601
type: Comment
has text: i did but how do i specify it in the programs code?

http://stackoverflow.com/q/24942674
has answer: http://stackoverflow.com/a/24942859
has comment: http://stackoverflow.com/comment/38763483
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/38763189
tagged with: java
has comment: http://stackoverflow.com/comment/38763226
has comment: http://stackoverflow.com/comment/38763125
type: Question
has comment: http://stackoverflow.com/comment/38785466
has title: Android notification intent creates new instance instead of opening existing instance
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/38763073
has body: If I click my notification while the app is minimized it opens the app and the UI is reset. I would like the notification to open the existing instance. I've been trying to make it use the existing instance. This is my notification code: mBuilder = new NotificationCompat.Builder(getApplicationContext()) .setSmallIcon(R.drawable.ic_launcher) .setContentTitle("Title") .setContentText("Tuned in to " + radiostation); Intent resultIntent = new Intent(getApplicationContext(), RadioChooser.class); resultIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_NEW_TASK); TaskStackBuilder stackBuilder = TaskStackBuilder.create(getApplicationContext()); stackBuilder.addParentStack(RadioChooser.class); stackBuilder.addNextIntent(resultIntent); PendingIntent resultPendingIntent = PendingIntent.getActivity( getApplicationContext(), 0, resultIntent, 0 ); mBuilder.setContentIntent(resultPendingIntent); mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); mBuilder.setOngoing(true); mNotificationManager.notify(1, mBuilder.build()); AndroidManifest.xml: <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> <service android:enabled="true" android:name=".MusicPlayer" />

http://stackoverflow.com/comment/38882495
type: AnswerComment
comment on: http://stackoverflow.com/a/25002907
score: 0
type: Comment
has text: @codeacode Do you really need to mix up the elements of the array, or do you need to pick one at random?

import
type: Tag
tag name: import
tags question: http://stackoverflow.com/q/25029327
tags question: http://stackoverflow.com/q/24999207
tags question: http://stackoverflow.com/q/24917839
tags question: http://stackoverflow.com/q/24964316
tags question: http://stackoverflow.com/q/24963830
tags question: http://stackoverflow.com/q/24921210

http://stackoverflow.com/comment/38813005
has text: I assume there is more code, a main/unit test or something. Can we see that?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24969599

http://stackoverflow.com/comment/38941953
type: QuestionComment
comment on: http://stackoverflow.com/q/25029906
has text: @java4fun using "magic" isn't always fun :-) Maybe what you want to do isn't good for just letting Spring handle the repositories. Maybe it's better to handle it yourself or find a way to extend the JPA repository? Look further down in the manual you linked to...
score: 1
type: Comment

http://stackoverflow.com/comment/38785797
comment on: http://stackoverflow.com/a/24932176
type: Comment
has text: Great. Please mark any of the answers provided to this question as "Accepted".
score: 0
type: AnswerComment

http://stackoverflow.com/comment/38790750
type: Comment
type: QuestionComment
has text: it says divide(int) (or divide(float)) method is undefinited for string type.
comment on: http://stackoverflow.com/q/24957396
score: 0

http://stackoverflow.com/q/24955655
has title: export: `C:/Java/jdk1.7.0_65': not a valid identifier
tagged with: java
has answer: http://stackoverflow.com/a/24955961
tagged with: hadoop
score: 0
answer count: 1
type: UnansweredQuestion
has body: I'm trying to install hadoop on my system but when I'm using the command " bin/hadoop namenode -format" in cygwin on windows the error comes: " /home/EMPAdmin/hadoop-0.19.1/bin/../conf/hadoop-env.sh: line 9: export: `c:\Java\jdk1.7.0_65': not a valid identifier Error: JAVA_HOME is not set." I have set environmental variable in my system and also have set JAVA_HOME in hadoop-env.sh file as: export JAVA_HOME="c:\Java\jdk1.7.0_65" I have tried the same file path with forward slashes too but no luck. Please someone help me out with this issue. Thanks!!
has comment: http://stackoverflow.com/comment/38808225
has comment: http://stackoverflow.com/comment/38786832
type: Question

http://stackoverflow.com/comment/38921497
score: 0
has text: *"So is there no way to encrypt the private key with a password like in the openssl command..."* - you need to be careful here. OpenSSL can encrypt the key using PEM Message Encryption of RFC 1421. Its an old format, and OpenSSL uses it by default. Unfortunately, OpenSSL uses a non standard derivation function when the key size is larger than 16 bytes. So Java *may* not be able to decrypt the key. With the `pkcs8` utility, you can strip the old format encryption and apply PKCS8 encryption to the key. Java should be able to decrypt the PKCS8 encrypted key.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25025271

http://stackoverflow.com/q/25020079
tagged with: tomcat
has title: Java Applet connecting to a wrong address
type: UnansweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/25020272
score: 0
has body: I have a web application consisting of a simple html page and an applet running on Tomcat 6. The structure of the application follows: tomcat\webapps\_salome_trs \saloment_trs\plugin\myapplication (the folder plug-in has other subdirectories for other applcations) \myapplication\lib\mylib.jar the applet is in tomcat\webapps\_salome_trs\myapplet.jar When I execute the applet from the webpage, it tries to connect to _salome_trs\classOne.class classOne is in mylib.jar, but unfortunately the webserver doesn't load this class in _salome_trs How can I fix it?
answer count: 1
tagged with: applet

http://stackoverflow.com/comment/38811901
has text: ok thank you, imma try this when i go back to work on tuesday, i'll let yall know
comment on: http://stackoverflow.com/a/24960427
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/38902788
type: Comment
has text: Thanks! I have some external libraries (in the form of jars) I need to import. They are located at ./libs. How can I package these with the JAR?
comment on: http://stackoverflow.com/a/25017120
score: 0
type: AnswerComment

http://stackoverflow.com/comment/38832804
score: 1
comment on: http://stackoverflow.com/q/24976319
type: Comment
type: QuestionComment
has text: Many templating languages have markup similar to the above with customizable tag characters (freemarker for example and handlebars.java). But if you need the AST that won't work.

http://stackoverflow.com/comment/38965225
has text: Generally, No. Is there different way needed? by situation?
comment on: http://stackoverflow.com/q/25050210
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25057130
type: Answer
has body: You can update the regular expression as follows to achieve this: original = original.replaceAll("\\.(\\s[A-Za-z0-9])", " .$1") The '\s' matches whitespace characters, so should be able to handle '\n'. See http://www.regular-expressions.info/shorthand.html. Tested using http://java-regex-tester.appspot.com/.
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/25056914
downvote count: 0

http://stackoverflow.com/comment/38717287
score: 0
comment on: http://stackoverflow.com/a/24917172
type: Comment
has text: Could you please add some explanation to your answer? Code-only answers are (sometimes) good, but code+explanation answers are (most times) better
type: AnswerComment

http://stackoverflow.com/comment/38918150
type: Comment
has text: I tried both right beside the code (eg src/test/java/com/jg/datasharing) as well as in the resouces (src/test/resources/com/jg/datasharing). IDE refactored the path for me so it appears to be actual config related rather than (strictly) human error.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25024694

http://stackoverflow.com/comment/38772613
has text: http://stackoverflow.com/questions/5032356/using-scanner-nextline
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24947751
score: 1

http://stackoverflow.com/comment/38967598
type: Comment
type: QuestionComment
has text: image 1,2,3 are mapped to more than one elements, that basically stops you from using a map implementation.
comment on: http://stackoverflow.com/q/25051585
score: 0

http://stackoverflow.com/comment/38829129
score: 0
comment on: http://stackoverflow.com/q/24978090
type: Comment
type: QuestionComment
has text: @MikeW Looking at the query I printed I guess there is no variable with `'` in its value.

spring-boot
tags question: http://stackoverflow.com/q/25037568
type: Tag
tags question: http://stackoverflow.com/q/25000434
tags question: http://stackoverflow.com/q/24936636
tags question: http://stackoverflow.com/q/25039249
tags question: http://stackoverflow.com/q/24952292
tags question: http://stackoverflow.com/q/25004905
tags question: http://stackoverflow.com/q/24947717
tags question: http://stackoverflow.com/q/25048199
tags question: http://stackoverflow.com/q/24950395
tags question: http://stackoverflow.com/q/24928673
tags question: http://stackoverflow.com/q/25041346
tag name: spring-boot
tags question: http://stackoverflow.com/q/24983046
tags question: http://stackoverflow.com/q/25063995
tags question: http://stackoverflow.com/q/24931248
tags question: http://stackoverflow.com/q/24917194

http://stackoverflow.com/a/25040175
upvote count: 10
downvote count: 0
has body: Use multiple <jvmarg> elements: <jvmarg value="-Xmx1024m"/> <jvmarg value="-Duser.timezone=GMT0"/>
type: Answer
score: 10
answers question: http://stackoverflow.com/q/25039864

http://stackoverflow.com/comment/38853484
type: AnswerComment
type: Comment
has text: line 37 is wre i'm calling my array: GridCellP1 [i][j] = button;
score: 0
comment on: http://stackoverflow.com/a/24990388

http://stackoverflow.com/comment/38765767
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24935962
has text: Could you also show your `import`s?

http://stackoverflow.com/q/24944380
has comment: http://stackoverflow.com/comment/38766430
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/38767836
score: 0
has title: Parallel 10 HTTP Request
has comment: http://stackoverflow.com/comment/38768191
answer count: 0
type: UnansweredQuestion
tagged with: php
has comment: http://stackoverflow.com/comment/38777924
has comment: http://stackoverflow.com/comment/38766502
has body: We have dynamics offer system and have to make 10 requests / per user and get result in 2000ms. (concurrent user 1k) I have tried parallel command, curl multi, java HttpURLConnection with thread and Apache connection management but couldn't work in 2000ms on dedicated server which have 32 core and 64gb RAM. My best stat is 130 concurrent user and average response time 4 seconds. We're using php and java but we can't find right way for it. Have you any idea for right way? Additional Information : I can reach 7k user with only 1 http request every user
has comment: http://stackoverflow.com/comment/38790059

http://stackoverflow.com/comment/38766979
comment on: http://stackoverflow.com/q/24944744
type: Comment
has text: what is a -Yahztee Full House ?
score: 0
type: QuestionComment

cryptography
tag name: cryptography
type: Tag
tags question: http://stackoverflow.com/q/24979557
tags question: http://stackoverflow.com/q/25064529
tags question: http://stackoverflow.com/q/24988787
tags question: http://stackoverflow.com/q/24985105
tags question: http://stackoverflow.com/q/24911604
tags question: http://stackoverflow.com/q/25025271
tags question: http://stackoverflow.com/q/25001500

http://stackoverflow.com/a/24963739
accepted answer of: http://stackoverflow.com/q/24963674
has body: You are decrementing size twice in pop -- once in your debugging print statement, and once when accessing your array. Because your size variable is meant to be one larger than the last valid index, decrement it only once, before you access the array. public char pop() { size--; System.out.println("class stack : " + stack[size]); return stack[size]; }
answers question: http://stackoverflow.com/q/24963674
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/comment/38818528
type: QuestionComment
comment on: http://stackoverflow.com/q/24972402
has text: http://www.caveofprogramming.com/frontpage/articles/java/java-file-reading-and-writing-files-in-java/ see this
score: 0
type: Comment

http://stackoverflow.com/a/25023447
score: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/38916515
has comment: http://stackoverflow.com/comment/38915626
upvote count: 3
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25023397
accepted answer of: http://stackoverflow.com/q/25023397
has comment: http://stackoverflow.com/comment/38916399
type: Answer
has comment: http://stackoverflow.com/comment/38915385
has body: Adding optional parameters changes the signature of the method, thus preventing the override. The @Override attribute in your code sample is not valid. You can find details on this in JLS section 8.4.2: The signature of a method m1 is a subsignature of the signature of a method m2 if either: m2 has the same signature as m1, or the signature of m1 is the same as the erasure (§4.6) of the signature of m2. Two method signatures m1 and m2 are override-equivalent iff either m1 is a subsignature of m2, or m2 is a subsignature of m1. You need to define a different method with the signature that takes an optional parameter, and call the base method through a reference to super.

http://stackoverflow.com/q/25052445
has title: SVG length of text throws NullPointerException
score: 3
tagged with: java
has comment: http://stackoverflow.com/comment/51128990
has comment: http://stackoverflow.com/comment/38969512
downvote count: 0
tagged with: batik
has body: I use Batik to create a SVG Document. I create a text element and want to get it's width. However I get a NPE: Element composite = container.getOwnerDocument().createElementNS(SVGUtility.SVG_NS, SVGConstants.SVG_G_TAG); SVGOMTextElement txt = (SVGOMTextElement) parent.getOwnerDocument().createElementNS(SVGUtility.SVG_NS, SVGConstants.SVG_TEXT_TAG); txt.setTextContent("lorem"); composite.appendChild(txt); txt.getComputedTextLength(); java.lang.NullPointerException at org.apache.batik.dom.svg.SVGTextContentSupport.getComputedTextLength(SVGTextContentSupport.java:240) at org.apache.batik.dom.svg.SVGOMTextContentElement.getComputedTextLength(SVGOMTextContentElement.java:186) the NPE is because the context is null here: final SVGTextContent context = (SVGTextContent)svgelt.getSVGContext(); Is there a way to assign the correct context before?
favorite count: 0
has comment: http://stackoverflow.com/comment/38969942
has comment: http://stackoverflow.com/comment/38971795
has comment: http://stackoverflow.com/comment/38977544
tagged with: http://stackoverflow.com/tag/svg
answer count: 0
upvote count: 3
type: UnansweredQuestion
type: Question

http://stackoverflow.com/comment/38989408
score: 0
comment on: http://stackoverflow.com/q/25062239
type: Comment
type: QuestionComment
has text: @Aditya Jain: Problem is not solved but probably you are right. I use interface so I should use ScopedProxyMode.INTERFACES, thanks.

http://stackoverflow.com/q/24924219
favorite count: 0
accepted answer: http://stackoverflow.com/a/24924508
type: AnsweredQuestion
score: 3
upvote count: 3
has body: I'm trying to use Uribuilder from: javax.ws.rs.core.UriBuilder; To update a URI. The issue is that the parameter name gets escaped when I use replaceQueryParam. so: UriBuilder uriBuilder = webResource.getUriBuilder(). replaceQueryParam("abcd!dcv, "wid"). replaceQueryParam("format", "json"); if there is already an existing "abcd!dcv" parameter in the Uribuilder, it will escape and add a new one. so it will become ?abcd!dcv=originalvalue&amp;abcd%21cdv=wid instead of ?abcd!dcv=wid How should I get around this? Thanks!
tagged with: java
type: Question
has title: Uribuilder encoding with exclamation mark
tagged with: url-encoding
has answer: http://stackoverflow.com/a/24924508
answer count: 1
downvote count: 0
tagged with: jax-rs

http://stackoverflow.com/a/42596077
has comment: http://stackoverflow.com/comment/74189386
has body: According to the initial question, "How do I install a JRE from an Inno script?", and taking as a starting solution the best proposed one, I propose a solution that I think works more coherently. I understand that the user wants to install a JRE for their application if the target computer does not have installed a Java runtime environment or its version is lower than the required one. Ok, what I propose is to use the AfterInstall parameter and reorder a bit the distribution files in a different way. We will first sort the files in the [Files] section in another way, putting first the redist install files. Source: "redist\jre-8u121-windows-i586.exe"; DestDir: "{tmp}"; DestName: "JREInstaller.exe";\ Flags: deleteafterinstall; AfterInstall: RunJavaInstaller(); \ Check: (NOT IsWin64) AND InstallJava(); Source: "redist\jre-8u121-windows-x64.exe"; DestDir: "{tmp}"; DestName: "JREInstaller.exe"; \ Flags: deleteafterinstall; AfterInstall: RunJavaInstaller(); \ Check: IsWin64 AND InstallJava(); Source: "Myprog.exe"; DestDir: "{app}"; Flags: ignoreversion The next step we must do is to modify the section [Run] as follows. [Run] Filename: "{app}\{#MyAppExeName}"; \ Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&amp;', '&amp;&amp;')}}"; \ Flags: nowait postinstall skipifsilent And last but not least, we implemented in the [Code] section the RunJavaInstaller() procedure as follows: [Code] procedure RunJavaInstaller(); var StatusText: string; ResultCode: Integer; Path, Parameters: string; begin Path := '{tmp}\JREInstaller.exe'; { http://docs.oracle.com/javase/8/docs/technotes/guides/install/config.html#table_config_file_options } Parameters := '/s INSTALL_SILENT=Enable REBOOT=Disable SPONSORS=Disable REMOVEOUTOFDATEJRES=1'; StatusText:= WizardForm.StatusLabel.Caption; WizardForm.StatusLabel.Caption:='Installing the java runtime environment. Wait a moment ...'; WizardForm.ProgressGauge.Style := npbstMarquee; try if not Exec(ExpandConstant(Path), Parameters, '', SW_SH…
has comment: http://stackoverflow.com/comment/74079036
score: 2
has comment: http://stackoverflow.com/comment/73952387
has comment: http://stackoverflow.com/comment/72506822
has comment: http://stackoverflow.com/comment/73214379
has comment: http://stackoverflow.com/comment/72325645
downvote count: 0
has comment: http://stackoverflow.com/comment/72507892
has comment: http://stackoverflow.com/comment/72774251
has comment: http://stackoverflow.com/comment/73926722
has comment: http://stackoverflow.com/comment/72508273
has comment: http://stackoverflow.com/comment/74078709
has comment: http://stackoverflow.com/comment/74206809
has comment: http://stackoverflow.com/comment/73328145
has comment: http://stackoverflow.com/comment/74189508
upvote count: 2
has comment: http://stackoverflow.com/comment/74078785
answers question: http://stackoverflow.com/q/24964393
has comment: http://stackoverflow.com/comment/73156563
has comment: http://stackoverflow.com/comment/73278924
has comment: http://stackoverflow.com/comment/72406705
has comment: http://stackoverflow.com/comment/74189106
type: Answer

http://stackoverflow.com/a/24942833
has body: Why not something like this: Use a relative path with sysprops, like ${user.home}/path-to-hsqldb. If the user runs tomcat as user "jim", it will look in c:\users\jim\path-to-hsqldb (Windows) or /usr/jim/path-to-hsqldb (Linux) You might need to use Spring's &lt;context:property-placeholder/&gt; to enable this.
answers question: http://stackoverflow.com/q/24925146
score: 0
type: Answer

http://stackoverflow.com/a/25097708
accepted answer of: http://stackoverflow.com/q/25017967
answers question: http://stackoverflow.com/q/25017967
type: Answer
score: 1
upvote count: 1
has body: after days searching and trying some solution, finally works ! here how I did @Entity @Table(name="aluno") public class Aluno implements Serializable{ private static final long serialVersionUID = 1L; @Id @GeneratedValue private Integer id; //informacoes gerais @NotNull private String nome; //historico de graduacao @OneToMany(mappedBy = "aluno", cascade = CascadeType.ALL, fetch = FetchType.LAZY) private List&lt;HistoricoDeGraduacao&gt; listaHistoricoGraduacao; public Aluno() { } public void addListaHistoricoGraduacao(HistoricoDeGraduacao hdg){ if(listaHistoricoGraduacao == null){ listaHistoricoGraduacao = new ArrayList&lt;HistoricoDeGraduacao&gt;(); } listaHistoricoGraduacao.add(hdg); } public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public String getNome() { return nome; } public void setNome(String nome) { this.nome = nome; } public List&lt;HistoricoDeGraduacao&gt; getListaHistoricoGraduacao() { return listaHistoricoGraduacao; } public void setListaHistoricoGraduacao(List&lt;HistoricoDeGraduacao&gt; listaHistoricoGraduacao) { this.listaHistoricoGraduacao = listaHistoricoGraduacao; } @Override public int hashCode() { int hash = 7; return hash; } @Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final Aluno other = (Aluno) obj; return true; } } @Entity @Table(name="graduacao") public class Graduacao implements Serializable{ private static final long serialVersionUID = 1L; @Id @GeneratedValue private Integer id; @NotNull @Column(unique = true) private String graduacao; @ElementCollection @CollectionTable(name="graus_graduacao", joinColumns=@JoinColumn(name="id_graduacao")) @Column(name="graus") private List&lt;String&gt; graus; @OneToMany(mappedBy = "graduacao", cascade = CascadeType.ALL, fetch = FetchType.LAZY) private List&lt;HistoricoDeGraduacao&gt; listaHistoricoGraduacao; public Graduacao() { } public Graduacao(Integer id, String graduacao, Lis…
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/25078117
upvote count: 3
downvote count: 1
has body: Yesterday I found at the end of introduction http://docs.opencv.org/2.4/doc/tutorials/introduction/clojure_dev_intro/clojure_dev_intro.html answer for my question: The OpenCV Java API does not wrap the highgui module functionalities depending on Qt (e.g. namedWindow and imshow. If you want to create windows and show images into them while interacting with OpenCV from the REPL, at the moment you’re left at your own. You could use Java Swing to fill the gap.
answers question: http://stackoverflow.com/q/25059576
type: Answer
score: 2

http://stackoverflow.com/a/25037698
upvote count: 1
answers question: http://stackoverflow.com/q/25033083
downvote count: 0
has body: I manage to do it as follows //function declaration FuncDecl assignUser = ctx.mkFuncDecl("assignUser", Task, User); FuncDecl TaskUser = ctx.mkFuncDecl("TaskUser", new Sort[] { Task, User }, ctx.mkBoolSort()); FuncDecl mustPrecede = ctx.mkFuncDecl("mustPrecede", new Sort[]{Task,Task}, ctx.mkBoolSort()); //task for using in quatifiers Expr task = ctx.mkConst("t", ctx.mkUninterpretedSort(ctx.mkSymbol("Task"))); // creating (assert(forall((t Task)) (not (mustPrecede t t)))) //just one task is needed Sort[] Tasks = new Sort[1]; Tasks[0] =ctx.mkUninterpretedSort(ctx.mkSymbol("Task")); //setting the name for the task Symbol[] namess = new Symbol[1]; namess[0] = ctx.mkSymbol("t"); //Creating a map between mustPrecede and its two parameters Expr mtt = ctx.mkApp(mustPrecede, task,task); //acreating not Expr body = ctx.mkNot((BoolExpr)mtt); Expr mustPrecedett = ctx.mkForall(Tasks, namess, body, 1, null, null, ctx.mkSymbol("Q1"), ctx.mkSymbol("skid1")); System.out.println("Quantifier mustPrecedett: " + mustPrecedett.toString());
has comment: http://stackoverflow.com/comment/38940990
type: Answer
score: 1

http://stackoverflow.com/q/25042763
favorite count: 0
tagged with: jdbc
has answer: http://stackoverflow.com/a/25057999
type: AnsweredQuestion
has title: Cannot deploy the JDBC driver
has comment: http://stackoverflow.com/comment/38951324
score: 1
has comment: http://stackoverflow.com/comment/38950916
tagged with: java
has comment: http://stackoverflow.com/comment/38971323
has comment: http://stackoverflow.com/comment/38954467
has comment: http://stackoverflow.com/comment/38952073
has comment: http://stackoverflow.com/comment/38953302
upvote count: 1
has comment: http://stackoverflow.com/comment/38950909
type: Question
has comment: http://stackoverflow.com/comment/38952948
has comment: http://stackoverflow.com/comment/38951055
accepted answer: http://stackoverflow.com/a/25057999
tagged with: sql-server
has body: I have this app that Inherited from another developer and I don't know much about java. This app was working just fine a few minutes ago, but now I get the following error: Cannot deploy the JDBC driver to C:\Program Files\Apache Software Foundation\Apache Tomcat 7.0.41\lib\jtds-1.2.jar. Check whether you have write access rights to the C:\Program Files\Apache Software Foundation\Apache Tomcat 7.0.41\lib folder. These are the additional errors I got from the apache log: Jul 30, 2014 4:10:21 PM org.apache.catalina.core.ApplicationDispatcher invoke SEVERE: Servlet.service() for servlet jsp threw exception tag 'select', field 'list', name 'country': The requested list key 'util.countries' could not be resolved as a collection/array/map/enumeration/iterator type. Example: people or people.{name} - [unknown location] at org.apache.struts2.components.Component.fieldError(Component.java:237) at org.apache.struts2.components.Component.findValue(Component.java:358) at org.apache.struts2.components.ListUIBean.evaluateExtraParams(ListUIBean.java:80) at org.apache.struts2.components.Select.evaluateExtraParams(Select.java:105) at org.apache.struts2.components.UIBean.evaluateParams(UIBean.java:856) at org.apache.struts2.components.UIBean.end(UIBean.java:510) at org.apache.struts2.views.jsp.ComponentTagSupport.doEndTag(ComponentTagSupport.java:42) at org.apache.jsp.user.register_jsp._jspx_meth_s_005fselect_005f0(register_jsp.java:938) at org.apache.jsp.user.register_jsp._jspx_meth_s_005fform_005f1(register_jsp.java:577) at org.apache.jsp.user.register_jsp._jspService(register_jsp.java:210) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) at javax.servlet.http.HttpServlet.service(HttpServlet.java:728) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334) at javax.servlet.http.HttpServlet.se…
has comment: http://stackoverflow.com/comment/38953775
has comment: http://stackoverflow.com/comment/38952599
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/38951062
tagged with: tomcat

http://stackoverflow.com/comment/38774853
type: Comment
comment on: http://stackoverflow.com/q/24948924
score: 0
has text: The factory pattern is your best choice there. Something like this http://alvinalexander.com/java/java-factory-pattern-example
type: QuestionComment

http://stackoverflow.com/comment/38802333
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/24955262
type: Comment
has text: I'd try this in a single transaction just like you've described in your comment.

http://stackoverflow.com/comment/38857015
score: 0
type: Comment
type: QuestionComment
has text: http://stackoverflow.com/questions/17868189/how-do-i-convert-this-curl-request-to-apache-httpclient-java-code
comment on: http://stackoverflow.com/q/24993023

http://stackoverflow.com/a/24946714
answers question: http://stackoverflow.com/q/24946514
downvote count: 0
has body: In this example I accumulate the list into a LinkedList. The LinkedList implements Deque (Double ended queue) which allows me to append the items in a last-in-first-out (LIFO) order. I perform the accumulation in the collect method using LinkedList::addFirst which places the items read off the stream at the head of the list. public static void main(final String... args) { final List&lt;String&gt; objList = Arrays.asList("1", "2", "3", "4", "5", "6", "7"); final List&lt;String&gt; reversed = objList.stream() .collect(LinkedList::new, LinkedList::addFirst, LinkedList::addAll); //[7, 6, 5, 4, 3, 2, 1] System.out.println(reversed); } The solution below is OK but I don't like having to close over the original list. public static void main(final String... args) { final List&lt;String&gt; objList = Arrays.asList("1", "2", "3", "4", "5", "6", "7"); final List&lt;String&gt; reversed = IntStream.range(-(objList.size() - 1), 1) .mapToObj(i -&gt; objList.get(-i)) .collect(Collectors.toList()); //[7, 6, 5, 4, 3, 2, 1] System.out.println(reversed); }
upvote count: 2
has comment: http://stackoverflow.com/comment/38770699
has comment: http://stackoverflow.com/comment/38966182
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38772481
has comment: http://stackoverflow.com/comment/38772063
type: Answer
accepted answer of: http://stackoverflow.com/q/24946514
score: 2

http://stackoverflow.com/comment/38895450
type: QuestionComment
has text: Not a problem, but it would have been simpler to edit your post ... What is the output of the command ?
comment on: http://stackoverflow.com/q/24990331
score: 0
type: Comment

http://stackoverflow.com/q/25016949
answer count: 3
has comment: http://stackoverflow.com/comment/38902299
has answer: http://stackoverflow.com/a/25017031
has answer: http://stackoverflow.com/a/25017086
linked to: http://stackoverflow.com/q/1484445
has body: Queue is an interface that implements many different classes. I am confused about why my text book gives this sample text using Queue. I have also found this in an example on the Princeton website. Is this a customary way to provide code so it can be edited later to the programmers preferred type of queue? This is code taken from an algorithm for a Binary Search Symbol Table. public Iterable&lt;Key&gt; keys(Key lo, Key hi) { Queue&lt;Key&gt; q = new Queue&lt;Key&gt;(); for (int i = rank(lo); i &lt; rank(hi); i++) { q.enqueue(keys[i]); } if (contains(hi)) { q.enqueue(keys[rank(hi)]); } return q; }
accepted answer: http://stackoverflow.com/a/25017009
has comment: http://stackoverflow.com/comment/38902393
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38902330
tagged with: java
has answer: http://stackoverflow.com/a/25017009
linked to: http://stackoverflow.com/q/383947
tagged with: queue
has comment: http://stackoverflow.com/comment/38902601
type: Question
has title: Interface versus implementing Queue
possible better answer: http://stackoverflow.com/a/25017031
score: 0

http://stackoverflow.com/q/25051658
has comment: http://stackoverflow.com/comment/38967789
accepted answer: http://stackoverflow.com/a/25051766
possible better answer: http://stackoverflow.com/a/25051730
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/38967843
tagged with: arrays
has answer: http://stackoverflow.com/a/25051766
downvote count: 1
has answer: http://stackoverflow.com/a/25051730
favorite count: 0
upvote count: 0
has body: I'm trying to create a program to count the frequency of 1 letter, 2 letter, etc. words in a given text file. However, it only appears to work with small files. I looked up some solutions(which I don't completely understand) involving arrays and incorporated them into the code. When I tested a file with a few words, it worked, but when given a large file, like the entirety of Romeo and Juliet, it gives the wrong results. (Also, what is "for(String str : strings)" doing?) import java.util.Scanner; import java.io.File; import java.io.FileNotFoundException; class Authorship { public static void main(String[] args) { try { System.out.print("Name of input file: "); Scanner in = new Scanner(System.in); String name = in.nextLine(); File text = new File(name); Scanner in2 = new Scanner(text); String line = in2.nextLine(); String[] strings = line.split(" "); int[] counts = new int[14]; for(String str : strings) { if (str.length() &lt; counts.length) counts [str.length()] += 1; } for (int i = 1; i &lt;= 13; i++) { System.out.print("Proportion of " + i + "-letter words: "); System.out.println("( " + counts[i] + " words )"); } } catch (Exception FileNotFoundException) { System.out.println("File not found"); } } } Thanks in advance
has comment: http://stackoverflow.com/comment/38967842
has comment: http://stackoverflow.com/comment/38967748
linked to: http://stackoverflow.com/q/22047855
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38967771
tagged with: java
has comment: http://stackoverflow.com/comment/38967725
score: -1
has title: Frequency of X letter words in text

http://stackoverflow.com/a/25073943
downvote count: 0
has comment: http://stackoverflow.com/comment/70337724
has comment: http://stackoverflow.com/comment/73720194
type: Answer
score: 23
has body: I found that there is not unmarshallers register as there is not initialization in the library: Important piece of code: // Initialize the library DefaultBootstrap.bootstrap();
upvote count: 23
accepted answer of: http://stackoverflow.com/q/25066183
answers question: http://stackoverflow.com/q/25066183
type: AcceptedAnswer

http://stackoverflow.com/comment/38867594
score: 0
comment on: http://stackoverflow.com/q/24998544
type: Comment
type: QuestionComment
has text: @Pshemo: I understand what you are saying: None of these links provide code to give the Desired result. As suggested by a couple other responses, it appears that the OP has not tried anything. The code in these links could point the way.

http://stackoverflow.com/comment/38881042
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25005595
score: 0
has text: Yes, do as John Entwistle says, and use Guava.

http://stackoverflow.com/a/25200752
has body: In order to remove dividers just from the child views and not between the parents in the expandable List: add android:childDivider="#00000000" in the ExapandableListView attributes in XML: &lt;ExpandableListView android:id="@+id/elv" android:layout_width="match_parent" android:layout_height="wrap_content" android:childDivider="#00000000" android:dividerHeight="0dp" /&gt; Refer http://qtcstation.com/2011/03/working-with-the-expandablelistview-part-1/
type: Answer
answers question: http://stackoverflow.com/q/24955173
downvote count: 2
has comment: http://stackoverflow.com/comment/39273037
score: 3
upvote count: 5
has comment: http://stackoverflow.com/comment/63541940
has comment: http://stackoverflow.com/comment/39255838

http://stackoverflow.com/q/25050210
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/25050238
type: Question
has comment: http://stackoverflow.com/comment/38965178
duplicate of: http://stackoverflow.com/q/6961356
has comment: http://stackoverflow.com/comment/38965291
downvote count: 0
has title: java replace list contents or to replace reference value itself
has answer: http://stackoverflow.com/a/25050261
accepted answer: http://stackoverflow.com/a/25050261
linked to: http://stackoverflow.com/q/6961356
answer count: 3
tagged with: android
possible better answer: http://stackoverflow.com/a/25050238
favorite count: 0
has comment: http://stackoverflow.com/comment/38965225
upvote count: 1
has body: I have a list that used for adapter for ListView in Android. Most time, the List is used for read but sometimes replace of all List contents is needed. which type of code below (replaceListA, replaceListB) is preferred? or another way to replace the list? thank you in advance. private ArrayList&lt;Model&gt; list = new ArrayList&lt;Model&gt;(); public synchronized void replaceListA(List newList) { list.clear(); list.addAll(newList); } public synchronized void replaceListB(List newList) { list = newList; }
has answer: http://stackoverflow.com/a/25050226
type: AnsweredQuestion

http://stackoverflow.com/comment/38986313
has text: And I think this question doesn't deserve so many downvotes. I guess that's why you should post a formatted question, because if it would be in this form from the beginning, it could get some upvotes, too.
comment on: http://stackoverflow.com/q/25061386
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25058339
has comment: http://stackoverflow.com/comment/38981873
has body: I am trying to get values from an excel sheet using apache-poi and than to enter those values into a mysql database.Using apache-poi I am able to get values by using XSSFSheet.rowIterator() xssfrow.cellIterator();This excel sheet provides me 10000 rows and 180 columns. Now I want to to enter those excelsheet provided values to a table using hibernate framework .so I have created a pojo in my java application which have 180 attributes in it ,So have 180 getters and 180 setters. Only way I can think setting these values to pojo attributes is to iterate column iterator and then call setter method of pojo. I am curious to know that can there be any smarter or more efficient way for doing it? Note : I have tried to normalize table but as there is no repetition of data so I don't think that table can be normalized
has comment: http://stackoverflow.com/comment/38979997
has answer: http://stackoverflow.com/a/25058772
accepted answer: http://stackoverflow.com/a/25058772
favorite count: 0
has comment: http://stackoverflow.com/comment/38982625
tagged with: apache-poi
tagged with: collections
has answer: http://stackoverflow.com/a/25059474
has comment: http://stackoverflow.com/comment/38980301
type: AnsweredQuestion
downvote count: 0
has comment: http://stackoverflow.com/comment/38980871
has title: How to set values from an excel sheet to Pojo object using apache-poi?
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/38980073
possible better answer: http://stackoverflow.com/a/25059474
type: Question
tagged with: jakarta-ee
has comment: http://stackoverflow.com/comment/38980332
answer count: 2
upvote count: 1
has comment: http://stackoverflow.com/comment/38982863
has comment: http://stackoverflow.com/comment/38980849
has comment: http://stackoverflow.com/comment/38980615

http://stackoverflow.com/q/25002618
has title: Arrangement-of-rectangles algorithm and investigating it on a per-coordinate basis
downvote count: 0
score: 1
has body: (I am not sure if this qualifies as CodeGolf, as I do actually have a use for this despite its abstract-sounding nature... xD If it does, let me know and I'll add it to the tags...) This problem consists out of two joined-at-the-hip parts: one about finding a suitable formula/algorithm, and the other about using that algorithm to deal with the basic needs that I am eventually interested in. Suppose you have a sufficiently large two-dimensional field that needs to be filled with rectangles. Pre-generating the locations of these non-overlapping rectangles (of various sizes, which are subject to a minimum and maximum size) is unfeasible due to memory constraints. These rectangles themselves are not subject to the 'grid' implied by the field; a random rectangle can be rotated to any degree: 30, 45 or 87 or whatever degree angle, it is fine as long as it does not overlap with any other rectangles. The 'density' of the rectangles would be rather low, thus leaving a lot of empty space between them. (If the algorithm could be easily tweaked for as far this density is concerned, that would be very interesting!) Generating the positions of the rectangles are the result of a single input 64-bit 'seed', of which varying inputs should lead to different results in the arranged layout of rectangles. Finally, the output should not be overly grid-like or recognizably regular; visually speaking, it should be a pretty chaotic arrangement if plotted. // Note: This algorithm would not actually generate or produce to start // off with. The logic is concentrated in the questions that follow below. // Please note: there is NO initialization phase of any sort. Visual aid: Now, given only the knowledge of a certain (x, y) coordinate and the generating 'seed', how can I determine whether this coordinate is inside of a rectangle? How do I determine the corners of said rectangle? And finally, how do I get the center coordinate of the nearest Rectangle? public Boolean isInsideRectangle(int x, in…
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/38878460
upvote count: 1
tagged with: math
tagged with: java
has comment: http://stackoverflow.com/comment/39042152
tagged with: algorithm
answer count: 0
has comment: http://stackoverflow.com/comment/38877561
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39034622

http://stackoverflow.com/q/25035466
has answer: http://stackoverflow.com/a/25035695
has answer: http://stackoverflow.com/a/25036916
has answer: http://stackoverflow.com/a/25035687
favorite count: 0
has body: Even through these reference Tri1, I am not able to return base value. public class Triangle { private double base; Triangle Tri1 = new Triangle(); public static double getBase() { return Tri1.base; } }
tagged with: static
upvote count: 3
answer count: 3
has title: How to return non-static variable from static method?
type: UnansweredQuestion
score: 1
tagged with: java
type: Question
downvote count: 2

http://stackoverflow.com/comment/38768216
has text: I would think they were just copying C's math.h.
type: Comment
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/24945356

http://stackoverflow.com/comment/38727410
has text: does it mean i have to increase the maxDepth above 5 and add a timer to cut off the search or is there any other ways to go about it?
type: Comment
comment on: http://stackoverflow.com/a/24923881
score: 0
type: AnswerComment

http://stackoverflow.com/a/24927288
has comment: http://stackoverflow.com/comment/131138883
upvote count: 3
answers question: http://stackoverflow.com/q/24926786
has body: It's not a good aproach to mix types like this (integers with doubles). Since you are using Object as a type, you won't be able to get both Integers and Doubles from the map. Gson decides which type is more apropriate for Object. In your case it is Double, because all values CAN BE doubles, but all values CAN'T BE integers. If you really need to mix types, try to use Number class instead of Object. Example: public static void main(String[] args){ String array = "[1, 2.5, 4, 5.66]"; Gson gson = new Gson(); Type type = new TypeToken&lt;ArrayList&lt;Number&gt;&gt;() {}.getType(); List&lt;Number&gt; obj = gson.fromJson(array, type); System.out.println(Arrays.toString(obj.toArray())); } Output: [1, 2.5, 4, 5.66] While this: public static void main(String[] args){ String array = "[1, 2.5, 4, 5.66]"; Gson gson = new Gson(); Type type = new TypeToken&lt;ArrayList&lt;Object&gt;&gt;() {}.getType(); List&lt;Object&gt; obj = gson.fromJson(array, type); System.out.println(Arrays.toString(obj.toArray())); } will give you output: [1.0, 2.5, 4.0, 5.66]
type: Answer
score: 1
has comment: http://stackoverflow.com/comment/38736494
downvote count: 2

http://stackoverflow.com/a/24985972
has body: If you're talking about the appcompat folders that are created with each project, then yes. They are re-created with each project. But if you delete the new one and reference the existing library, you shouldn't have a problem. I would back it up and try it before deleting.
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38847514
type: Answer
answers question: http://stackoverflow.com/q/24985878
has comment: http://stackoverflow.com/comment/38849080
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24985878
score: 1

http://stackoverflow.com/comment/38774262
has text: Take a look at [How to Use Tables](http://docs.oracle.com/javase/tutorial/uiswing/components/table.html) and [Using Custom Renderers](http://docs.oracle.com/javase/tutorial/uiswing/components/table.html#renderer) for details
score: 0
comment on: http://stackoverflow.com/q/24948435
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24938559
has comment: http://stackoverflow.com/comment/38756662
answer count: 0
tagged with: java
tagged with: hibernate
type: Question
tagged with: jpa
score: 0
has comment: http://stackoverflow.com/comment/38755654
has title: How can I inject a date provider into a JPA Entity class?
linked to: http://stackoverflow.com/q/19896870
has comment: http://stackoverflow.com/comment/38757185
has body: My JPA Entity classes have a @PrePersist method to set an INSERT_TIME column: @PrePersist protected void onCreate() { insertTime = new Date(); // TODO: inject time source? } For testing, I would like to replace new Date() so that entities are persisted with predictable data. My first thought was to have a data provider injected into the Entity class, but I don't control the creation of Entity classes, so it doesn't seem there is a way for me to inject dependencies. Any suggestions?
linked to: http://stackoverflow.com/q/24839484
type: UnansweredQuestion
tagged with: spring

http://stackoverflow.com/comment/70100384
has text: @AbhinavVutukuri To answer your questions I would need more than one comment. Could you post these examples as separate question (or questions)? Also it may be important to point out what version of Java you are using. Judging by your profile picture it may be Android which can be using Java 7 instead of Java 8 where you can get little different results.
score: 1
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25058091

http://stackoverflow.com/a/25034824
has comment: http://stackoverflow.com/comment/39010328
downvote count: 0
answers question: http://stackoverflow.com/q/25027835
has comment: http://stackoverflow.com/comment/39012380
score: 3
type: Answer
has comment: http://stackoverflow.com/comment/39006343
upvote count: 3
has body: Hej Channa, here is an example how you can "pause" your Service and after closing the Dialog resume it. Here is the FXML ;) &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;?import java.lang.*?&gt; &lt;?import java.util.*?&gt; &lt;?import javafx.scene.*?&gt; &lt;?import javafx.scene.control.*?&gt; &lt;?import javafx.scene.layout.*?&gt; &lt;AnchorPane id="AnchorPane" prefHeight="200" prefWidth="320" xmlns:fx="http://javafx.com/fxml" fx:controller="de.professional_webworkx.stopservice.FXMLController"&gt; &lt;children&gt; &lt;Button layoutX="126" layoutY="90" text="Click Me!" onAction="#handleButtonAction" fx:id="button" /&gt; &lt;Label layoutX="126" layoutY="120" minHeight="16" minWidth="69" fx:id="label" /&gt; &lt;/children&gt; &lt;/AnchorPane&gt; MainApplication import javafx.application.Application; import static javafx.application.Application.launch; import javafx.fxml.FXMLLoader; import javafx.scene.Parent; import javafx.scene.Scene; import javafx.stage.Stage; public class MainApp extends Application { @Override public void start(Stage stage) throws Exception { Parent root = FXMLLoader.load(getClass().getResource("/fxml/Scene.fxml")); Scene scene = new Scene(root); stage.setTitle("JavaFX and Concurrency"); stage.setScene(scene); stage.show(); } public static void main(String[] args) { launch(args); } } The Controller import java.net.URL; import java.util.ResourceBundle; import javafx.application.Platform; import javafx.concurrent.Worker; import javafx.event.ActionEvent; import javafx.fxml.FXML; import javafx.fxml.Initializable; import javafx.scene.Scene; import javafx.scene.control.Label; import javafx.stage.Stage; public class FXMLController implements Initializable { @FXML private Label label; private MyService ms; @FXML private void handleButtonAction(ActionEvent event) { onCancel(); } @Override public void initialize(URL url, ResourceBundle rb) { ms = new MyService(); Platform.runLater(() -&gt; { ms.start(); }); } public void onCancel() { if(ms.getState().equ…

selenium-webdriver
tags question: http://stackoverflow.com/q/25002039
tags question: http://stackoverflow.com/q/25042689
tags question: http://stackoverflow.com/q/25053616
tags question: http://stackoverflow.com/q/24982976
tags question: http://stackoverflow.com/q/25045365
tags question: http://stackoverflow.com/q/25034534
tags question: http://stackoverflow.com/q/24980481
tags question: http://stackoverflow.com/q/24936334
tags question: http://stackoverflow.com/q/24933786
tags question: http://stackoverflow.com/q/24950277
tags question: http://stackoverflow.com/q/25013177
tags question: http://stackoverflow.com/q/24920325
tags question: http://stackoverflow.com/q/24984648
tags question: http://stackoverflow.com/q/24954125
tags question: http://stackoverflow.com/q/25047437
tag name: selenium-webdriver
tags question: http://stackoverflow.com/q/24948688
tags question: http://stackoverflow.com/q/24911681
tags question: http://stackoverflow.com/q/25011639
tags question: http://stackoverflow.com/q/24929076
tags question: http://stackoverflow.com/q/24969514
tags question: http://stackoverflow.com/q/25016080
tags question: http://stackoverflow.com/q/24989178
tags question: http://stackoverflow.com/q/24990015
tags question: http://stackoverflow.com/q/24916977
tags question: http://stackoverflow.com/q/25041781
tags question: http://stackoverflow.com/q/25053067
tags question: http://stackoverflow.com/q/25060757
type: Tag
tags question: http://stackoverflow.com/q/24932763
tags question: http://stackoverflow.com/q/24990216
tags question: http://stackoverflow.com/q/24926526

http://stackoverflow.com/comment/38818217
type: Comment
type: QuestionComment
has text: @scorpion : T is my class declaration. Peter Lawrey : The datas in my inputStream is already of type MyClass
comment on: http://stackoverflow.com/q/24972005
score: 0

http://stackoverflow.com/comment/39103584
comment on: http://stackoverflow.com/q/24973616
has text: Ok, I will implement a example using OData4j.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25047996
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25047627
has body: Here's a small re-factoring to address at least part of your NPE problem. I have no idea if this functionally correct since I'm not looking at your entire application but it should point you in the right direction. For the play logic, I'm assuming that sometimes your initializePlayer() method fails to set player to a non-null value based on your bug reports. case R.id.play_button: if(isPlayingInstrument == false) { if(player == null) initializePlayer(); if(player != null) { isPlayingInstrument = true; player.start(); myChronometer.setBase(SystemClock.elapsedRealtime()); } } break; case R.id.pause_button: if(player != null) { player.pause(); isPlayingInstrument = false; } break; case R.id.stop_button: if(player != null) { player.stop(); player = null; isPlayingInstrument = false; play_thread_running = false; } break;
type: Answer
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/25047627
upvote count: 2

http://stackoverflow.com/comment/38772556
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24947347
has text: Because Its a callback method which is called when my download is sucessfull. normal jar file without proguard has ArrayList<customObject> in my method. so I believe its issue of proguard.
score: 0

http://stackoverflow.com/comment/38742889
type: QuestionComment
comment on: http://stackoverflow.com/q/24932009
has text: It means that the virtual key doesn't have any information to differentiate it from `E` or `e`
score: 1
type: Comment

recaptcha
tag name: recaptcha
tags question: http://stackoverflow.com/q/25009557
type: Tag

http://stackoverflow.com/q/25000930
linked to: http://stackoverflow.com/q/11547082
has comment: http://stackoverflow.com/comment/38873826
linked to: http://stackoverflow.com/q/434718
upvote count: 3
has title: Port scanning in Scala: Application hangs for a closed port on the remote host
tagged with: java
has comment: http://stackoverflow.com/comment/38892538
answer count: 2
has body: I've been trying to create an application which needs to scan open ports on a network (mostly LAN) as fast as possible. I searched around and one great method that I found uses the following code: (1 to 65536).par.map { case port ⇒ try { val socket = new java.net.Socket("127.0.0.1", port) socket.close() println(port) port } catch { case _: Throwable ⇒ -1 } }.toSet However, the problem with the code is that if I enter anything other than 127.0.0.1 or localhost as location (say 192.168.1.2), the application freezes. Any idea why this happens and how I can fix it? P.S. I also tried setting socket timeout with socket.setSoTimeout(1500), but no change.
downvote count: 1
possible better answer: http://stackoverflow.com/a/26313077
has answer: http://stackoverflow.com/a/26313077
has comment: http://stackoverflow.com/comment/38895389
has answer: http://stackoverflow.com/a/25014809
has comment: http://stackoverflow.com/comment/38897328
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39044802
score: 2
has comment: http://stackoverflow.com/comment/38892826
has comment: http://stackoverflow.com/comment/38894205
has comment: http://stackoverflow.com/comment/38896929
has comment: http://stackoverflow.com/comment/38887688
favorite count: 0
type: Question
tagged with: scala
accepted answer: http://stackoverflow.com/a/25014809
tagged with: port

http://stackoverflow.com/q/24989812
upvote count: 2
downvote count: 2
has title: Why do I have "private access" error even if I didn't return any field?
type: Question
has body: I am learning OOP in Java. When finishing coding and compiling it, the compiler shows that this Manager class has private access to the Photographer class. I've been working on for a whole night, but I still cannot find the problem. Anyone could tell me how to fix it? public class Manager { private ArrayList&lt;Assignment&gt; toDoList; private ArrayList&lt;Photographer&gt; employees; public Manager() { this.toDoList = new ArrayList&lt;Assignment&gt;(); this.employees = new ArrayList&lt;Photographer&gt;(); } public void hire(String photographer) { employees.add(new Photographer(photographer)); } public void giveOutAssignments() { int maxId; if(toDoList.size()!=0 &amp;&amp; employees.size()!=0){ for(Photographer p: employees){ maxId = 0; //get highest priority for(int i = 1; i&lt;toDoList.size();i++){ //just check the unfinished assigns if(!toDoList.get(i).getStatus()){ if(toDoList.get(i).getPriority()&gt;toDoList.get(maxId).getPriority()) maxId = i; } } //take the highest priority Assignment currentAssign = toDoList.get(maxId); //HERE IS THE PROBLEM p.takePicture(currentAssign.getDescription()); //set it as finished toDoList.get(maxId).setStatus(); } } } } Here is the Photographer class: public class Photographer { private Map photos; private String name; public Photographer(String name) { photos = new HashMap(); // An important line. Must go in the constructor. readPhotos(); // A very important line. this must go in the Photographer // constructor so that the photographer will be able to take Pictures. this.name = name; } private String takePicture(String description) { return photos.get(description); } private void readPhotos() { Pattern commentPattern = Pattern.compile("^//.*"); Pattern photoPattern = Pattern.compile("([a-zA-Z0-9\\.]+) (.*)"); try { Scanner in = new Scanner(new File("photos.txt")); while (in.hasNextLine()) { String line = in.nextLine(); Matcher commentMatcher = commentPattern.matcher(line); Matcher photoMatcher = photoPattern.matcher(line); if (co…
tagged with: oop
tagged with: java
has answer: http://stackoverflow.com/a/24989901
has comment: http://stackoverflow.com/comment/38851176
score: 0
answer count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/24989901
type: AnsweredQuestion

http://stackoverflow.com/comment/38784324
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24953978
has text: @Sanjeev This has nothing to do with CR. While this code is indeed working, I am asking a question on how to improve the workings of the code with respect to resources. If my intention was to get a full review of this code, then I would've posted this on CR. Please read the Help Center of CR.
score: 0

http://stackoverflow.com/comment/38736877
comment on: http://stackoverflow.com/a/24928398
score: 0
type: AnswerComment
has text: @Asher Well you always have the rectangle and the text, right? That's two figures already. As for the focus change: Didn't you notice that when you drag a figure over another that then the other one is dragged instead?
type: Comment

http://stackoverflow.com/comment/38734341
score: 0
type: QuestionComment
type: Comment
has text: The root problem is that there is only a single _Number_ type. [JSON](http://json.org/) does not have an int type - they're all floating point and decimal places are omitted where possible.
comment on: http://stackoverflow.com/q/24926786

http://stackoverflow.com/comment/38877262
score: 0
type: AnswerComment
type: Comment
has text: @Sid let me know if you still have any questions. Sorry I haven't responded, been at work all day
comment on: http://stackoverflow.com/a/24977016

http://stackoverflow.com/a/25047222
type: Answer
accepted answer of: http://stackoverflow.com/q/25047187
answers question: http://stackoverflow.com/q/25047187
has comment: http://stackoverflow.com/comment/38959901
has comment: http://stackoverflow.com/comment/38960042
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/38960430
has body: What version of JDK did you build the jar with and what version are you trying to run it on. I believe you compiled and built with JDK 7 and then are trying to run on JDK 6
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/38715010
has text: @VivinPaliath `List<Object>` is assignable to `List<?>`, which is all that matters.
type: Comment
comment on: http://stackoverflow.com/a/24917126
score: 0
type: AnswerComment

http://stackoverflow.com/a/24953485
accepted answer of: http://stackoverflow.com/q/24953370
answers question: http://stackoverflow.com/q/24953370
score: 5
has body: I think the Java team messed up the naming on this one. A static inner class (strictly speaking their correct name is "static nested class") is in no way different from an ordinary class except it has a fancy name (Something.MyClass instead of MyClass) and can be made private (i.e. not instantiable from other classes). In case of Map, it was solely chosen because the name Map.Entry makes it clear that Entry relates to Map. As you suggest, it would have been perfectly reasonable to just use an ordinary class for this. The only difference is you don't get to write Map.Entry. I think what they should have done is to use the syntax for "non-static" inner classes (i.e. just class in an enclosing class) for static nested classes, and instead invent a new keyword to create "non-static" inner classes, because it's these that behave different from normal classes. Maybe something like attached class. AFAIK the keyword static was chosen in order to avoid having too many reserved keywords, but I think it just encouraged confusion.
type: AcceptedAnswer
downvote count: 0
upvote count: 5
type: Answer
has comment: http://stackoverflow.com/comment/38783106

http://stackoverflow.com/q/24983046
type: AnsweredQuestion
tagged with: spring-boot
score: 1
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/24983077
has title: MethodSecurityInterceptor for multiple methods in spring boot
downvote count: 0
tagged with: spring-security
has body: This is related to the answer of this question by Mickael Marrache on how to secure services using an authorization logic that can be different across the methods. I liked better the response provided by Maciej Ziarko using Method Security AccessDecisionManager instead of the one accepted, since it uses the same annotation @Secured with diferente custom arguments. Since I'm using Spring-Boot with no XML config, took me a while to figure out how to do it. So, here is my answer. It just explains how to replace the xml config with the Java Config configuration.
answer count: 1
linked to: http://stackoverflow.com/q/13376202
accepted answer: http://stackoverflow.com/a/24983077
favorite count: 0
upvote count: 1
tagged with: spring

http://stackoverflow.com/q/25008252
type: AnsweredQuestion
score: -4
possible better answer: http://stackoverflow.com/a/25008271
accepted answer: http://stackoverflow.com/a/25008256
has comment: http://stackoverflow.com/comment/38885751
type: Question
tagged with: java
has body: I have my jsp file in the folder WEB-INF/ jsp. and i have my servlet file in the package src/com.apnt.mobilecontacts.StoreContacts .java so how to call servlet file from the jsp
has title: How to call servlet from jsp?
downvote count: 4
answer count: 2
upvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/25008256
has answer: http://stackoverflow.com/a/25008271
has comment: http://stackoverflow.com/comment/38885781
has comment: http://stackoverflow.com/comment/38885769

http://stackoverflow.com/a/24919249
answers question: http://stackoverflow.com/q/24917153
type: Answer
has body: You use static Main plugin; but it is never initialized, since you never instantiate a Storage object, only use its static functions. In your plugin class create a Storage object, and initialize it in the onEnable method, passing the plugin for its constructor. For example: public class Main extends JavaPlugin { Storage myStorage = null; public void onEnable() { final FileConfiguration config = this.getConfig(); config.options().copyDefaults(true); saveConfig(); myStorage = new Storage(this); } Later in your plugin class use this object instead - and best to make your static methods in Storage (as well as the plugin member) non-static, since you will always need to create an instance to use the plugin set in the constructor. I think this article gives a nice, basic overview about class members.
downvote count: 0
score: 1
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24917153

http://stackoverflow.com/a/25003096
has body: What about this: public JTable display = new JTable(model) { @Override public Component prepareRenderer(TableCellRenderer renderer, int row, int column) { Component c = super.prepareRenderer(renderer, row, column); if (row == getColumnCount()) { c.setBackground(Color.GREEN); } else { if (row % 2 == 0) { c.setBackground(UIManager.getColor("Table.background")); } else { c.setBackground(UIManager .getColor("Table.alternateRowColor")); } } return c; } };
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/25002050
score: 1
upvote count: 1

command-line-arguments
tags question: http://stackoverflow.com/q/25061649
tags question: http://stackoverflow.com/q/25016188
type: Tag
tags question: http://stackoverflow.com/q/25018205
tags question: http://stackoverflow.com/q/25064732
tags question: http://stackoverflow.com/q/25038986
tags question: http://stackoverflow.com/q/25001301
tag name: command-line-arguments

http://stackoverflow.com/comment/38968769
comment on: http://stackoverflow.com/q/25049171
type: QuestionComment
type: Comment
score: 0
has text: @user3105533 did u solve ur issue?

http://stackoverflow.com/q/25018772
has title: how to remove and a UnionClass in jena
has answer: http://stackoverflow.com/a/25020116
tagged with: java
tagged with: jena
has body: Currently I am using Jena to work around ontology file, but could not find a way to remove and change a UnionClass. Could anyone point out how to do this using Jena? the code for create a UnionClass: RDFNode[] elems = new RDFNode[] {(RDFNode)a,(RDFNode)b};//a&amp;b are 2 clas UnionClass res=model.createUnionClass(null,model.createList((com.hp.hpl.jena.rdf.model.RDFNode[])elems)); and the API for get a union class: UnionClass res=model.getUnionClass(uriForUnionClass); but how to change res? For example, how to add a class c into this UnionClass?How to remove (RDFNode)a?
accepted answer: http://stackoverflow.com/a/25020116
score: 2
type: AnsweredQuestion
downvote count: 0
favorite count: 0
tagged with: http://stackoverflow.com/tag/rdf
type: Question
upvote count: 2
tagged with: owl
answer count: 1

http://stackoverflow.com/comment/38976600
type: QuestionComment
comment on: http://stackoverflow.com/q/25055992
has text: @Deepanshu Bedi: Code added
score: 0
type: Comment

http://stackoverflow.com/q/24965509
favorite count: 0
has body: I am trying to understand dependency injection before learning how to use Spring. My question is that in the following example of Setter-based Dependency Injection, why is there no constructor for the TextEditor class? Do we not need a constructor here? Many thanks for your help!! ( code sourced from: http://www.tutorialspoint.com/spring/setter_based_dependency_injection.htm) package com.tutorialspoint; public class TextEditor { private SpellChecker spellChecker; //Q: Why not a constructor for TextEditor, but only a class variable? // a setter method to inject the dependency. public void setSpellChecker(SpellChecker spellChecker) { System.out.println("Inside setSpellChecker." ); this.spellChecker = spellChecker; } // a getter method to return spellChecker public SpellChecker getSpellChecker() { return spellChecker; } public void spellCheck() { spellChecker.checkSpelling(); } }
tagged with: getter-setter
has answer: http://stackoverflow.com/a/24965528
tagged with: constructor
accepted answer: http://stackoverflow.com/a/24965528
tagged with: spring
downvote count: 1
has title: java dependency injection (setter methods injection)
type: AnsweredQuestion
tagged with: dependency-injection
tagged with: java
score: -1
type: Question
upvote count: 0
answer count: 1

http://stackoverflow.com/comment/84076542
comment on: http://stackoverflow.com/a/24954279
has text: I'm aware this is a very old answer, but I'm seeing the issue described with the above forceLinkClasses, on libgdx 1.9.8/latest robovm. I wonder if something else is needed for HTTPS support now - will add another comment here if I find out in case anyone else stumbles across this.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/25035211
upvote count: 1
accepted answer: http://stackoverflow.com/a/25035415
has comment: http://stackoverflow.com/comment/38936294
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25035573
tagged with: java
downvote count: 3
type: Question
has title: How should I deal with space character when using split
has answer: http://stackoverflow.com/a/25035318
tagged with: split
has body: So apparently when I am using S.split(" ") and I have " " (space) in my code file, it gets ignored. I was wondering if there's a way to overcome that. What I had in mind and is written in the following code doesn't work however it works for every other character. String codeArr[] =code.split("\\r?\\n"); int k=0; while (k&lt;codeArr.length-1) { String[] tmpCode=codeArr[k].split(" "); if (tmpCode.length!=2) HuffCodeToCh.put(tmpCode[0]," "); else HuffCodeToCh.put(tmpCode[1],tmpCode[0]); k+=1; } My input is of the following type (in a file): i 000 r 001 e 01 s 100 n 101 . 110000 " 110001 E 1100100 k 11001010 H 11001011 f 110011 t 1101 1110 a 111100 I want to save the character as well as its binary code in a hashMap as shown in the code. However the code I have written above doesn't save " " in the hashmap. I am not sure how to fix it.
score: -2
has comment: http://stackoverflow.com/comment/38936367
possible better answer: http://stackoverflow.com/a/25035318
favorite count: 0
has answer: http://stackoverflow.com/a/25035415
answer count: 3
has comment: http://stackoverflow.com/comment/38936325
has comment: http://stackoverflow.com/comment/38936410
tagged with: regex
has comment: http://stackoverflow.com/comment/38936454
has comment: http://stackoverflow.com/comment/38937025
tagged with: file

http://stackoverflow.com/q/24943584
type: AnsweredQuestion
tagged with: java
answer count: 1
tagged with: jsp
tagged with: javabeans
score: 0
has title: Transferring collection object from one jsp to another
has answer: http://stackoverflow.com/a/24943780
accepted answer: http://stackoverflow.com/a/24943780
has body: I get the data from the database and store it in some collection object in one jsp(say One.jsp). I want this collection object to be available in another jsp(say Two.jsp). It might contain large data. So, I have used java bean for that in the following way. public class BeanClass implements Serializable{ private HashMap<String,List<String>> myMap; private int id; public int getId() { return id; } public void setId(int id) { this.id = id; } public HashMap<String,List<String>> getMyMap() { return myMap; } public void setData(HashMap<String,List<String>> myMap) { this.myMap = myMap; } } I am setting bean in One.jsp in the following way. <jsp:useBean id="dataObject" class="com.mypack.BeanClass" scope="session"/> <jsp:setProperty name="dataObject" property="myMap"/> <% dataObject.setData(myMapObj); %> But I get the following error: Can't find a method to write property 'dataMap' of type 'java.util.HashMap' in a bean of type 'com.mypack.BeanClass' Somewhere I found stating that we can't do the set for other things unless it is a string. Is there anyway that I can workaround it to make it work even for collection objects? So that I don't need to rollback lot of things that I have done. If not can someone please suggest how to transfer the collection object from one jsp to another? Example with snippet is appreciated. Or is it that I am missing some extra configuration to make beans work? Note: I might have used redirect() method, but here the navigation from One.jsp to Two.jsp is done by clicking on hyperlink(href) EDIT: Thanks to Alfreema. His solution worked after I had changed to setMyMap, but in Two.jsp I am facing issue. I try to display only some part of map like below. But it displays everything that is there in Map as if it shows when we use out.println(myMap); and it displays table at the very end of the page after printing the content of whole map. Two.jsp: <jsp:include page="header.jsp"/> <jsp:useBean id="dataObject" class="com.mypack.BeanClass" scope="session"/…
type: Question

http://stackoverflow.com/a/24950820
has body: All networking has to be in a separate thread by Android's design. It is very possible that the request will take some time and the user has to be bothered by waiting as little as possible. So, you will have to use an AsyncTask or similar.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/24950737

http://stackoverflow.com/comment/38834399
score: 0
comment on: http://stackoverflow.com/a/24978588
type: AnswerComment
has text: Adding and removing fields are benign in serialization.
type: Comment

http://stackoverflow.com/q/24978844
tagged with: eclipse
answer count: 2
score: 5
tagged with: eclipselink
has body: On a Windows 8 64bit machine, in Eclipse Luna, I use JPA (EclipseLink 2.5.x) and Apache Derby as JDBC connection. My persistence.xml so far: <?xml version="1.0" encoding="UTF-8"?> com.example.Clazz com.example.CommentBank com.example.CommentCategory com.example.CourseWork com.example.GradeModel com.example.Pupil com.example.PupilCoursework com.example.Report com.example.Year <property name="javax.persistence.jdbc.url" value="jdbc:derby:D:\rwdb.db"/> <property name="javax.persistence.jdbc.user" value="rwdbuser"/> <property name="javax.persistence.jdbc.password" value="rwdbpassword"/> <property name="javax.persistence.jdbc.driver" value="org.apache.derby.jdbc.EmbeddedDriver"/> <property name="eclipselink.jdbc.exclusive-connection.is-lazy" value="true"/> Using the wizard, I created a new database connection in Eclipse which works pretty well. When I want to do JPA Tools => Generate Tables From Entities, eclipse starts creating tables... and continues forever. There's no exception, no other message, it just blocks on this operation. I cannot even cancel it. If I try to do so, it just adds "Cancel requested" to the item and keeps going. Closing eclipse isn't possible either, as it's awaiting the finish of its current operations. .metadata\.log doesn't contain any new information about this. Oh and I chose "sql-script" as output, just in case. Any ideas?
tagged with: jpa
accepted answer: http://stackoverflow.com/a/25227175
favorite count: 0
possible better answer: http://stackoverflow.com/a/43827424
upvote count: 5
has answer: http://stackoverflow.com/a/25227175
type: AnsweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/43827424
type: Question
has title: JPA Eclipse "Generating Tables From Entities" hangs forever
tagged with: java

http://stackoverflow.com/comment/38752930
comment on: http://stackoverflow.com/a/24937482
score: 0
type: AnswerComment
type: Comment
has text: the submit method should be typed meaning that the return type and parameter type should match

http://stackoverflow.com/a/25020073
has comment: http://stackoverflow.com/comment/38908907
type: Answer
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/38908578
answers question: http://stackoverflow.com/q/25019986
has comment: http://stackoverflow.com/comment/38908547
has comment: http://stackoverflow.com/comment/38908759
has comment: http://stackoverflow.com/comment/38910943
has comment: http://stackoverflow.com/comment/38908492
has comment: http://stackoverflow.com/comment/38908808
has comment: http://stackoverflow.com/comment/38911146
has body: Song s = new Song(folder.getAbsolutePath()); this.addSong(new Song(folder.getAbsolutePath())); // Add the song // Clear s = null; System.gc(); This is asinine. The most memory efficient way to do this is simply: this.addSong(new Song(folder.getAbsolutePath())); // Add the song You never used s. You just created it, then set it to null, then GC'd it. Instead just add it directly. No need to do any premature optimization of this. There's no need to call the GC. It will run when it needs to. You generally never really need to call GC.
score: 0
has comment: http://stackoverflow.com/comment/38908637
has comment: http://stackoverflow.com/comment/38908446

http://stackoverflow.com/comment/38932494
score: 0
type: Comment
has text: hey, thanks for the answer, could you confirm that with real code?
comment on: http://stackoverflow.com/a/25032076
type: AnswerComment

http://stackoverflow.com/q/24992219
answer count: 2
has comment: http://stackoverflow.com/comment/57556869
has body: I can start Clojure REPL from directory when it was unpacked (C:\Program Files\clojure-1.6.0) by this command in command line: java -cp clojure-1.6.0.jar clojure.main but anytime I want to start REPL I have to enter directory C:\Program Files\clojure-1.6.0, so I create bat file with next content: java -cp C:\Program Files\clojure-1.6.0\clojure-1.6.0.jar clojure.main and put it to directory wich includes in PATH variable. I expect that it will run Clojure REPL, but instead of it I get an error Error: Could not find or load main class Files\clojure-1.6.0\clojure-1.6.0.jar And I don't find in internet how to fix it. Please help.
has answer: http://stackoverflow.com/a/25091472
downvote count: 0
possible better answer: http://stackoverflow.com/a/25091472
has answer: http://stackoverflow.com/a/24992570
tagged with: clojure
favorite count: 0
accepted answer: http://stackoverflow.com/a/24992570
has title: How to start Clojure REPL from anywhere?
tagged with: read-eval-print-loop
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
type: Question

filewriter
tag name: filewriter
tags question: http://stackoverflow.com/q/24969522
type: Tag
tags question: http://stackoverflow.com/q/24976977

http://stackoverflow.com/comment/38727084
score: 0
type: Comment
has text: Duly noted. I understand, but I'm still curious about object in particular.
type: QuestionComment
comment on: http://stackoverflow.com/q/24922452

http://stackoverflow.com/q/24993130
type: AnsweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/24998792
has body: I update the codenameone frequently but I have a problem I don't have some classes or functions for example I have only three classes in com.codename1.ui.geom such as: Dimension, Point and Rectangle classes but not the others or in graphics.class I don't have function named setTransform. what should I do? Thanks in advance. Updated:
answer count: 1
has title: How can i update my codenameone plugin and handed to the latest classes update
score: 0
tagged with: codenameone
accepted answer: http://stackoverflow.com/a/24998792

http://stackoverflow.com/a/25055561
has body: The fundamental difference between a field and a local variable is that the local variable is copied when JVM creates a lambda instance. On the other hand, fields can be changed freely, because the changes to them are propagated to the outside class instance as well (their scope is the whole outside class, as Boris pointed out below). The easiest way of thinking about anonymous classes, closures and labmdas is from the variable scope perspective; imagine a copy constructor added for all local variables you pass to a closure.
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 67
upvote count: 67
accepted answer of: http://stackoverflow.com/q/25055392
has comment: http://stackoverflow.com/comment/38975336
answers question: http://stackoverflow.com/q/25055392

http://stackoverflow.com/a/24955601
has comment: http://stackoverflow.com/comment/38787367
upvote count: 3
type: AcceptedAnswer
downvote count: 1
accepted answer of: http://stackoverflow.com/q/24955446
has comment: http://stackoverflow.com/comment/38787629
has body: I am going to guess that there is a null pointer somewhere in your onClick for your login activity. you should be able to figure this out by looking at your logcat which should tell you the exact line of code that is causing this crash. probably referencing an object that is not initialized / null Edit As stated you have a null reference on line 50 of LoginActivity: java.lang.NullPointerException 07-25 17:53:19.014: E/AndroidRuntime(1627): at com.satty002.swag.LoginActivity$2.onClick(LoginActivity.java:50 you misspelled the password field reference: mPassword = (EditText) findViewById(R.id.passwordFiled); should be mPassword = (EditText) findViewById(R.id.passwordField);
answers question: http://stackoverflow.com/q/24955446
has comment: http://stackoverflow.com/comment/38787483
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/38787641
has comment: http://stackoverflow.com/comment/38786999

http://stackoverflow.com/q/24981337
type: AnsweredQuestion
score: 3
has answer: http://stackoverflow.com/a/24981503
tagged with: playframework
answer count: 1
downvote count: 0
favorite count: 0
has body: I'm trying to use import guava library in SBT project (play framework), but can't compile my code import com.google.common.net.InternetDomainName class MyClass(link: String) { private val domains = { val host = new URL(link).getHost val domainName = InternetDomainName.from(host) domainName.topPrivateDomain().name() } } I get compilation error object google is not a member of package com Can anyone explain, what is the problem?
accepted answer: http://stackoverflow.com/a/24981503
has title: Import Java library to Scala sbt project
upvote count: 3
tagged with: scala
tagged with: java
type: Question

http://stackoverflow.com/comment/38922954
comment on: http://stackoverflow.com/q/25024335
score: 0
type: QuestionComment
type: Comment
has text: Holy crap this community is horrid. I ask a legitimate question and instead of trying to be useful or ask for any useful clarifications I have people attacking my question.

nexus
type: Tag
tags question: http://stackoverflow.com/q/25022189
tag name: nexus
tags question: http://stackoverflow.com/q/24984841

http://stackoverflow.com/comment/38888563
score: 0
comment on: http://stackoverflow.com/a/25009249
type: Comment
has text: Updated my answer to include content-disposition inline. Didn't think that'd be necessary, but just in case.
type: AnswerComment

http://stackoverflow.com/a/24925819
upvote count: 3
type: Answer
score: 3
downvote count: 0
has body: Set a click listener to the container layout. (RelativeLayout / LinearLayout ?) This click listener will execute whenever the user taps the screen.
answers question: http://stackoverflow.com/q/24925797

http://stackoverflow.com/comment/38737404
has text: *what i want that it(daemon) will exist even after the main thread exists!* - Thats not possible. The JVM shuts down when all threads running in it are *daemon* threads.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24929265

http://stackoverflow.com/a/24950664
has comment: http://stackoverflow.com/comment/38780611
score: 25
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/38782645
type: Answer
has body: If I've understood the question, it doesn't seem to have anything to do with YAML or SnakeYAML per se, but to do with how you write to a specific file in Java. Basically, what the second example you copied is showing is how to dump an object to an arbitrary java.io.Writer object (though they use a StringWriter as this will not write anything to disk). If you want to modify this example to write to a particular file, you can do so by making use of a FileWriter, like so: public void testDumpWriter() { Map&lt;String, Object&gt; data = new HashMap&lt;String, Object&gt;(); data.put("name", "Silenthand Olleander"); data.put("race", "Human"); data.put("traits", new String[] { "ONE_HAND", "ONE_EYE" }); Yaml yaml = new Yaml(); FileWriter writer = new FileWriter("/path/to/file.yaml"); yaml.dump(data, writer); } Which will dump the map data to a YAML file. Note that it is not normally necessary to create the file yourself before opening the FileWriter as the FileWriter will handle that for you.
accepted answer of: http://stackoverflow.com/q/24949505
has comment: http://stackoverflow.com/comment/38780171
upvote count: 25
answers question: http://stackoverflow.com/q/24949505
has comment: http://stackoverflow.com/comment/71602977

http://stackoverflow.com/comment/38711074
has text: Yes, that would work for this case. But there may be other cases that are even more complex. That's why I wanted to use regex. For example a query could be `ab[a-z]*b*a*b?b`...
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24913297
type: AnswerComment

http://stackoverflow.com/q/25018104
type: Question
tagged with: jersey
has answer: http://stackoverflow.com/a/25093765
accepted answer: http://stackoverflow.com/a/25093765
score: 4
has body: By using HK2's guice-bridge I managed to integrate Jersey 2.x with Guice 3.x. public class MyApp extends ResourceConfig { @Inject public MyApp(ServiceLocator serviceLocator) { packages("com.mycompany"); ... GuiceBridge.getGuiceBridge().initializeGuiceBridge(serviceLocator); GuiceIntoHK2Bridge guiceBridge = serviceLocator.getService(GuiceIntoHK2Bridge.class); guiceBridge.bridgeGuiceInjector(GuiceContext.INJECTOR); } } But now my Jersey tests don't work anymore. public abstract class AbstractJerseyTest extends JerseyTest { public AbstractJerseyTest() throws TestContainerException { super(new InMemoryTestContainerFactory()); } protected Application configure() { new MyApp(); // ERROR: missing 'ServiceLocator' } } So where do I get a ServiceLocator for my unit tests?
possible better answer: http://stackoverflow.com/a/28533406
tagged with: guice
has comment: http://stackoverflow.com/comment/44271253
tagged with: jersey-2.0
has answer: http://stackoverflow.com/a/25087996
favorite count: 0
has title: How to unit test Jersey + Guice: ServiceLocator?
tagged with: guice-3
upvote count: 4
answer count: 4
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/32469706
downvote count: 0
has answer: http://stackoverflow.com/a/28533406
tagged with: java

http://stackoverflow.com/comment/38968830
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25050624
has text: Thanks for the answer, I actually didn't see that :D, it didn't change the result which kind of confuses me but thanks for the fix

http://stackoverflow.com/comment/38758229
type: Comment
comment on: http://stackoverflow.com/q/24940205
type: QuestionComment
score: 0
has text: Are you using Swing? Are you taking about standalone an application?

auto-increment
type: Tag
tag name: auto-increment
tags question: http://stackoverflow.com/q/25014712

http://stackoverflow.com/comment/38814547
score: 0
comment on: http://stackoverflow.com/q/24969977
has text: @TurboJ> Yes,exactly. It says it's not allowed in my country.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38975595
type: Comment
type: QuestionComment
has text: I tried a lot to understand your problem, but its like hitting my head on hard rock. Could be you more specific to your problem?
score: 0
comment on: http://stackoverflow.com/q/25054915

http://stackoverflow.com/comment/38872563
comment on: http://stackoverflow.com/a/25000720
score: 0
type: Comment
has text: Hmm... Maybe I should put all setVisibility-methods directly in the main thread class and let the SurfaceView-class call them from there?
type: AnswerComment

http://stackoverflow.com/q/24924986
has comment: http://stackoverflow.com/comment/38729348
accepted answer: http://stackoverflow.com/a/24925134
has title: How to update time elapsed
answer count: 2
possible better answer: http://stackoverflow.com/a/24925099
score: 2
has body: I'm developing a program which will count the time until the button is clicked I'm having trouble with using Timer. I wanted to have something like 00:00:00 -> 00:00:01 -> 00:00:02 ... etc my problem is that it is stuck in 00:00:01 here's my code Timer timer=new Timer(1000,null); JLabel time=new JLabel("00:00:00"); timer.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { DecimalFormat df=new DecimalFormat("00"); int h=0; int m=0; int s=0; s++; if(s==60) { m++; if(m==60) { h++; } } time.setText(df.format(h)+":"+df.format(m)+":"+df.format(s)); revalidate(); repaint(); } }); timer.start();
downvote count: 0
has comment: http://stackoverflow.com/comment/38729401
favorite count: 0
tagged with: timer
has comment: http://stackoverflow.com/comment/38729336
upvote count: 2
has comment: http://stackoverflow.com/comment/38729291
has comment: http://stackoverflow.com/comment/38729303
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24925134
has comment: http://stackoverflow.com/comment/38729290
has comment: http://stackoverflow.com/comment/38729325
tagged with: java
has comment: http://stackoverflow.com/comment/38729360
type: Question
has answer: http://stackoverflow.com/a/24925099

http://stackoverflow.com/comment/38821010
type: AnswerComment
has text: *You use toString on the list, so the whole content will be printed* `System.out.println` will internally call `List#toString`. The problem is the way the array is printed. OP should use `Arrays#toString(arr)` instead.
type: Comment
comment on: http://stackoverflow.com/a/24973617
score: 0

http://stackoverflow.com/q/25060835
accepted answer: http://stackoverflow.com/a/25061100
has body: I'm trying to create a lucene search index for a bunch of names. I want to be able to search the names neglecting the case, umlauts, special chars, whitespaces and so on. Ideally, querying for Robert or Rober Roberts should match R'obert Röbertson. Which Analyzers or Filters to I have to apply in apache lucene to achieve this? So far I'm using new StandardAnalyzer(Version.LUCENE_4_9), but that is tied to exact matches. And moreover: how can I chain analyzers? Because an IndexWriter only takes a single analyzer: Analyzer analyzer = new StandardAnalyzer(Version.LUCENE_4_9); new IndexWriterConfig(Version.LUCENE_4_9, analyzer);
tagged with: java
tagged with: lucene
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/25061100
type: AnsweredQuestion
score: 2
has title: Ignore special characters with lucene?
upvote count: 2
type: Question

http://stackoverflow.com/comment/38721408
comment on: http://stackoverflow.com/a/24920576
type: AnswerComment
has text: This is the correct way to solve this problem. There's no way that user-entered data should show up as method names or field names.
score: 2
type: Comment

http://stackoverflow.com/comment/38735769
has text: @robermann i'm using hamcrest-core-1.3.jar
type: Comment
comment on: http://stackoverflow.com/q/24926320
score: 0
type: QuestionComment

http://stackoverflow.com/comment/38836553
type: Comment
has text: @user3865063 that would mean that a condition can never be fulfilled or a method is always exited before certain code is reach and thus the code in question will never get executed. As I did not get this message I would assume that you have a typo and don't assign 1 and 2 in turns to activePlayer
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24981796

http://stackoverflow.com/comment/38802155
has text: Can confirm that this method works just fine, will test it multiple times and confirm the answer :)
type: Comment
comment on: http://stackoverflow.com/a/24962667
score: 0
type: AnswerComment

http://stackoverflow.com/comment/39008139
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25056629
type: Comment
has text: nice work @mkl but pdf page is employee details it may contain 1 or 2 or 3. can it possible change header using page

http://stackoverflow.com/comment/38737173
type: QuestionComment
score: 1
has text: You are invoking your web server incorrectly on your code. Add details on how you currently work.
comment on: http://stackoverflow.com/q/24929072
type: Comment

http://stackoverflow.com/a/25028907
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/38925873
has comment: http://stackoverflow.com/comment/38925145
upvote count: 2
accepted answer of: http://stackoverflow.com/q/25028868
has body: The complexity of Array.copyOf is O(n). Internally it uses System.arraycopy whose complexity is O(n).
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25028868
has comment: http://stackoverflow.com/comment/38925073
type: Answer

http://stackoverflow.com/a/24969682
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/38813159
answers question: http://stackoverflow.com/q/24969599
type: Answer
has comment: http://stackoverflow.com/comment/38813179
has body: try this method code: public List&lt;Integer&gt; preorderTraversal(TreeNode root) { if(root == null){ return new ArrayList&lt;Integer&gt;(); } res.add(root.val); if(root.left != null){ res = preorderTraversal(root.left); } if(root.right != null){ res = preorderTraversal(root.right); } return res; } btw, you were doing res.add in the recursion. You should rather do res= in it.
has comment: http://stackoverflow.com/comment/38813187
downvote count: 0

http://stackoverflow.com/comment/38732883
type: Comment
has text: sorry I haven't put the code right but copy paste it and say if it's what you want (not sure to understand...)
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/24926541

http://stackoverflow.com/q/24970060
has comment: http://stackoverflow.com/comment/38816055
tagged with: entitymanager
has answer: http://stackoverflow.com/a/24973976
has comment: http://stackoverflow.com/comment/38815606
tagged with: spring
has comment: http://stackoverflow.com/comment/38814427
type: AnsweredQuestion
downvote count: 0
has comment: http://stackoverflow.com/comment/38816256
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/38817994
has comment: http://stackoverflow.com/comment/38814033
type: Question
has comment: http://stackoverflow.com/comment/38815860
has comment: http://stackoverflow.com/comment/38816169
has comment: http://stackoverflow.com/comment/38817816
upvote count: 1
tagged with: jpa
answer count: 1
has comment: http://stackoverflow.com/comment/38814811
has comment: http://stackoverflow.com/comment/38817694
has title: Mapping two entities via @OneToMany relationship fails in Struts2 action
favorite count: 0
tagged with: struts2
has body: Assume a product can have a list of accounts, the relationship between product and account is @OneToMany. In product class, I have created a Set interface to store accounts. Next, I have made a method using Struts 2 to add accounts to a product. Each time I run this method, the HashSet is reset and objects are removed from it. Below, you can find the DefaultProduct class. @Entity public class DefaultProduct { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "ID", nullable = false) Long id; @OneToMany(fetch = FetchType.LAZY, mappedBy = "product", targetEntity = DefaultAccount.class) private final Set&lt;Account&gt; accounts = new HashSet&lt;Account&gt;(); public DefaultProduct(Long id, Set&lt;Account&gt; accounts) { Assert.notEmpty(accounts); this.accounts.addAll(accounts); } // Getters } The Struts 2 action method calls editProduct() method from the service class, which is Dependency Injected using Spring framework. The service class does not have any issues as this has been accurately tested. Below you can find methods from service class and Struts 2. Service: @Transactional public void editProduct(Product product) { entityManager.merge(product); } Struts 2: public String addAccount(){ Set&lt;Account&gt; accounts = new HashSet&lt;Account&gt;(); accounts.add(coreService.findAccountById(accountId)); coreService.editProduct(new DefaultProduct(id, accounts)); System.out.println(coreService.findProductById(id).getAccounts().size()); //Size-check return SUCCESS; } Note: Product is an interface implemented by DefaultProduct class. Many thanks
accepted answer: http://stackoverflow.com/a/24973976
has comment: http://stackoverflow.com/comment/38818730

http://stackoverflow.com/q/25010843
has comment: http://stackoverflow.com/comment/38890798
has comment: http://stackoverflow.com/comment/38891003
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38891000
score: 2
has comment: http://stackoverflow.com/comment/38891189
tagged with: performance
answer count: 0
downvote count: 0
has comment: http://stackoverflow.com/comment/38890880
has comment: http://stackoverflow.com/comment/38890700
tagged with: java
has comment: http://stackoverflow.com/comment/38891319
has comment: http://stackoverflow.com/comment/38890975
has title: Why is java considered a high performance language?
has comment: http://stackoverflow.com/comment/38890878
type: Question
upvote count: 2
has body: Being a Java Developer, I've often read and heard that Java is considered a high-performance language[1]. So far for me as a programer, I have never had to worry about the performance of my Java applications simply because they did little tasks that just don't take long on modern computer hardware. As user, however, I've had to worry about the performance of Java. For instance, Minecraft (a pix game that looks old school) and RuneScape (a game that doesn't have good graphics, either) run significantly slower on my hardware [2] than any C(++) game with better graphics. Even HTML5 Games are way quicker than Java. So why is Java considered a high-performance language (along with C) if end users experience worse performance? I know the seed depends on quality of the code but I think both games I've mentioned above are popular, well maintained games that are owned by profit orientated organizations that put a lot of effort in improving performance. [1]: For instance: "Take for example Smalltalk, Lisp, Java and C++. All of them are, or have at one point been, the language of choice for high-performance code. All of them have huge amounts of engineering and research man-centuries expended on them to make them fast." https://stackoverflow.com/a/2200486/1493365 [2]: I have to note that my PC doesn't have a GPU, it's included in my CPU. But Java is know by all end-user I know as a "slow" language.
tagged with: http://stackoverflow.com/tag/c
favorite count: 0
linked to: http://stackoverflow.com/q/2198684
has comment: http://stackoverflow.com/comment/38891309
has comment: http://stackoverflow.com/comment/38890699

cxf
tags question: http://stackoverflow.com/q/25050073
tags question: http://stackoverflow.com/q/24910286
type: Tag
tags question: http://stackoverflow.com/q/24969501
tags question: http://stackoverflow.com/q/24992452
tags question: http://stackoverflow.com/q/24995358
tag name: cxf
tags question: http://stackoverflow.com/q/24974380
tags question: http://stackoverflow.com/q/24931576
tags question: http://stackoverflow.com/q/24953829
tags question: http://stackoverflow.com/q/24927437

http://stackoverflow.com/comment/38967865
type: QuestionComment
has text: either *bits* or *data* is null.
score: 3
comment on: http://stackoverflow.com/q/25051727
type: Comment

http://stackoverflow.com/comment/38965800
has text: The book says to avoid the deadlock, use the defensive copying
comment on: http://stackoverflow.com/q/25050574
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38774998
score: 0
has text: @Gabriel Negut The directory is not empty, also when I debug the code FilesInFolder contains all the file names in the directory.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24948817

http://stackoverflow.com/comment/38748714
type: Comment
type: QuestionComment
score: 0
has text: The image file is in /My_Project_Name/WebContent/images/pikachu.jpg
comment on: http://stackoverflow.com/q/24934642

http://stackoverflow.com/a/24962801
type: Answer
answers question: http://stackoverflow.com/q/24962793
upvote count: 3
accepted answer of: http://stackoverflow.com/q/24962793
score: 3
has body: Yes it is possible, with Swing it is called a JMenuBar. And Another link here.
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/38828874
type: QuestionComment
has text: thanks for the previous help,sorry to disturb,but I have a new problem ... java.lang.ArrayIndexOutOfBoundsException this is showing now,will you please take a look at the code .
score: 0
comment on: http://stackoverflow.com/q/24977933
type: Comment

http://stackoverflow.com/comment/38822590
score: 0
has text: What is your lock variable?
type: Comment
comment on: http://stackoverflow.com/q/24974586
type: QuestionComment

http://stackoverflow.com/comment/38892005
has text: Tomcat recognizes and handles jspx as jsp. Look into tomcat_dir/conf/web.xml (jsp servlet mapping).
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25010620

http://stackoverflow.com/comment/38950695
has text: That is exactly what I mean. Maybe you should ask the question, why would I ever need to draw 5000 shapes at one time? Maybe there is a better way.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25042187
score: 0

http://stackoverflow.com/q/24975813
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/24979182
tagged with: java-8
type: AnsweredQuestion
score: 21
tagged with: java
has comment: http://stackoverflow.com/comment/116422277
tagged with: hibernate
tagged with: orm
upvote count: 21
type: Question
accepted answer: http://stackoverflow.com/a/24979182
tagged with: jpa
has body: I'm trying to use java.util.Optional in some Persistent classes. Is there any workaround to make it work? I have tried using UserType, but its not possible to handle something like Optional without mapping it to SQL types by hand (not acceptable) I also tried to use JPA Converter, but it doesn't support Parameterized Types. I could use wrapping getters and setters like, but it's more like a hack than a solution public class MyClass { private MyOtherClass other; public Optional&lt;MyOtherClass&gt; getOther() { return Optional.ofNullable(other); } public voud setOther(Optional&lt;MyOtherClass&gt; other) { this.other = other.orElse(null); } } Thanks!
linked to: http://stackoverflow.com/q/10604865
has title: Hibernate ORM - supporting Java 1.8 Optional for entity properties

memory-management
tags question: http://stackoverflow.com/q/25067915
tags question: http://stackoverflow.com/q/24968525
tags question: http://stackoverflow.com/q/25055375
tags question: http://stackoverflow.com/q/25033458
type: Tag
tag name: memory-management

http://stackoverflow.com/comment/38917422
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25024280
score: 0
has text: May bis could help you: http://stackoverflow.com/questions/5960554/maximum-line-length-for-bufferedreader-readline-in-java

http://stackoverflow.com/comment/38760453
type: Comment
type: QuestionComment
score: 1
has text: It is probably a good to ask the system administrator, yes. If you are using that server for your own e-mail, you may be able to find the port in your own mail client's account settings (Thunderbird, Outlook, etc.).
comment on: http://stackoverflow.com/q/24940883

http://stackoverflow.com/comment/38994779
type: QuestionComment
score: 0
has text: Sorry, I'm new to Jenkins. How do I check permissions?
comment on: http://stackoverflow.com/q/25047740
type: Comment

http://stackoverflow.com/comment/38868281
score: 0
type: AnswerComment
type: Comment
has text: Gary, one question, isn't the deadlock produced by the Reaper as other threads are waiting for them to work?
comment on: http://stackoverflow.com/a/24938941

treemap
tags question: http://stackoverflow.com/q/24943329
tag name: treemap
type: Tag
tags question: http://stackoverflow.com/q/24922303

http://stackoverflow.com/comment/38763737
type: QuestionComment
has text: Also feel free to move this to a chat of if you're on freednode IRC join #wildfly and ping me (jamezp)
score: 0
type: Comment
comment on: http://stackoverflow.com/q/24939212

http://stackoverflow.com/comment/38848107
comment on: http://stackoverflow.com/a/24987798
score: 0
has text: Do you want to use the support library versions or not? If not, then you should just be able to delete the two imports and replace them with the non support library versions (i.e., `android.app.Fragment` and `android.app.LoaderManager.LoaderCallbacks`).
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/38713010
comment on: http://stackoverflow.com/a/24916211
type: AnswerComment
score: 0
type: Comment
has text: Yes. That's the one! Thank you!! I'll give a check in your answer later. :)

http://stackoverflow.com/q/24920916
has title: Integer to base 16 conversion
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24921514
upvote count: 3
has comment: http://stackoverflow.com/comment/38722798
has comment: http://stackoverflow.com/comment/38722536
has body: So far I have a method that can convert to different bases to 2, 8, but I can't seem to figure out how to do 16. The thing about 16 is when it hits 9, it should print out letters like: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F but I'm struggling to understand how to get this answer if I'm dealing with ints. We are not allowed to use any arrays. public static void conversion(int integer, int base) { if (integer &gt; 0 &amp;&amp; base &gt; 0) { System.out.println(integer + " in binary -&gt; "+ Integer.toString(integer, base)); } }
has comment: http://stackoverflow.com/comment/38723486
score: -2
tagged with: java
downvote count: 5
has comment: http://stackoverflow.com/comment/38723260
has comment: http://stackoverflow.com/comment/38722920
has comment: http://stackoverflow.com/comment/38722300
type: Question
answer count: 3
has answer: http://stackoverflow.com/a/26580219
has comment: http://stackoverflow.com/comment/38722479
favorite count: 0
tagged with: radix
has comment: http://stackoverflow.com/comment/38722214
has comment: http://stackoverflow.com/comment/38723138
has comment: http://stackoverflow.com/comment/38722498
has comment: http://stackoverflow.com/comment/38722411
has answer: http://stackoverflow.com/a/24921093
has comment: http://stackoverflow.com/comment/38723359
has comment: http://stackoverflow.com/comment/38722850

http://stackoverflow.com/comment/38907176
type: QuestionComment
comment on: http://stackoverflow.com/q/25017600
score: 0
has text: your java code would like to open port 80 at the server. netstat will return the ip-address:port that are trying to connect.
type: Comment

http://stackoverflow.com/comment/38728532
type: Comment
has text: You might even want to add findWithBills() and findWithReceipts(), in which you only JOIN in the bills and receipts data, respectively, thereby limiting the data that you pull back. Elsewhere in your code, you call the "find" method that best suits your needs
comment on: http://stackoverflow.com/a/24924446
score: 0
type: AnswerComment

http://stackoverflow.com/comment/38943289
comment on: http://stackoverflow.com/a/25036654
has text: @20Cents addView() expects a View and not a simple String. Instead of "ID" you create a TextView, set its text to "ID" and then add the TextView to the header row. It's basically the same thing you've done below when you add the TextViews in the for loop, there's no special header row just an ordinary row to which you add your headers.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/25029106
answers question: http://stackoverflow.com/q/25028860
upvote count: 2
has body: No but you could shorten it if you're using Java 7 or higher. The compiler can infer the type parameters from the left side of the assignment and you can skip them altogether while creating the object HashMap&lt;String, HashMap&lt;String, Child&gt;&gt; parentMap = new HashMap&lt;&gt;(); In older versions of Java, you could resord to Guava's Maps class and its newHashMap method. HashMap&lt;String, HashMap&lt;String, Child&gt;&gt; parentMap = Maps.newHashMap(); Another thing you could possibly do is create a type that implements a certain specification of the generic HashMap. public class HashMapStringChild extends HashMap&lt;String, Child&gt; { } and then use it as a type parameter HashMap&lt;String, HashMapStringChild&gt; parent2 = new HashMap&lt;&gt;(); but personally, I find this a bit of a stretch. I certainly wouldn't overuse it and I'd be careful extending the collection classes. Addendum You should also note that you're effectively binding your API to a specific implementation of the Map interface (HashMap), or even worse, in case of introducing the new class (HashMapStringChild), to a specific, non-standard implementation. What if at some point, you decide to keep your Child objects sorted at all times? You could do this by switching to a TreeMap but that would mean a big deal of refactoring. You would be better off basing your API on a more general interface. This way you could switch from Map&lt;String, Map&lt;String, Child&gt;&gt; map = new HashMap&lt;String, HashMap&lt;String, Child&gt;&gt;(); to Map&lt;String, Map&lt;String, Child&gt;&gt; map = new HashMap&lt;String, TreeMap&lt;String, Child&gt;&gt;(); or Map&lt;String, Map&lt;String, Child&gt;&gt; map = new TreeMap&lt;String, TreeMap&lt;String, Child&gt;&gt;(); or any other implementation without a hassle. If you really want to make the map of String to Child a specific type, you could introduce an interface public interface MapStringToChild extends Map&lt;String, Child&gt; { } Then you could keep your …
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25028860
downvote count: 0
type: Answer
score: 2

http://stackoverflow.com/comment/39042201
comment on: http://stackoverflow.com/q/25043194
has text: A JSON array is deserialized as a List. You can index through it like any other List.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38844062
type: QuestionComment
comment on: http://stackoverflow.com/q/24984971
has text: Also, there's no need to put tag names ([tag:jena] and [tag:sparql]) in the question title; that's what the tags are for.
score: 0
type: Comment

http://stackoverflow.com/q/24910524
tagged with: eclipse
has comment: http://stackoverflow.com/comment/38777714
type: Question
tagged with: debugging
has comment: http://stackoverflow.com/comment/38777509
answer count: 1
accepted answer: http://stackoverflow.com/a/24955095
downvote count: 0
linked to: http://stackoverflow.com/q/10261039
favorite count: 0
linked to: http://stackoverflow.com/q/6737105
has body: I'm debugging a JUnit test for code deployed on JBoss 7 AS via Arquillian. The debugger stops at breakpoints, but executes the old version of the code (e.g. it goes through empty lines) while I see the new version on my screen. I have found this question: I deleted my old remote debug configuration and created a new one, removed the default sources and attached the new ones (Source --&gt; Add --&gt; Java Project, and selected my projects). This didn't solve my problem. This answer suggest cleaning the projects. My projects are managed by maven, so I run mvn clean install from the console. This didn't help. Since the JBoss is started by Arquillian, I don't think it matters if I have the automatic publishing turned on (Window --&gt; Preferences --&gt; Server --&gt; Launching), but it's turned on anyways. I'm having this issue quite often right now, at seemingly random moments - I run the same (working) remote debug configuration over and over and suddenly I'm experiencing this issue even though I haven't changed the sources in debug configuration. What is the cause of this issue? What is the quickest way to fix it?
has comment: http://stackoverflow.com/comment/38779557
tagged with: maven
upvote count: 1
has answer: http://stackoverflow.com/a/24955095
has title: Eclipse debugger doesn't see changes in code
linked to: http://stackoverflow.com/q/9851652
linked to: http://stackoverflow.com/q/8695070
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: jboss

http://stackoverflow.com/comment/38913192
score: 1
has text: @schil227 Why not creating an abstraction of the unique objects since they follow the same implementation pattern (1-create connection 2-...) and leverage polymorphism?
comment on: http://stackoverflow.com/q/25021879
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25056994
has comment: http://stackoverflow.com/comment/38978401
has comment: http://stackoverflow.com/comment/38977434
has comment: http://stackoverflow.com/comment/38979659
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/25056669
downvote count: 0
score: 1
has body: It has come in handy for me before, in the creation of masks that were then used in '&amp;' or '|' operators when manipulating bit fields, either for bitwise data packing or bitwise graphics. I don't have a handy code sample, but I do recall using that technique many years ago in black-and-white graphics to zoom in (by extending a bit, either 1 or 0). For a 3x zoom, '0' would become '000' and '1' would become '111' without having to know the initial value of the bit. The bit to be expanded would be placed in the high order position, then an arithmetic right shift would extend it, regardless of whether it was 0 or 1. A logical shift, either left or right, always brings in zeros to fill vacated bit positions. In this case the sign bit was the key to the solution.
has comment: http://stackoverflow.com/comment/38978856

http://stackoverflow.com/comment/38744797
comment on: http://stackoverflow.com/a/24933150
score: 0
type: AnswerComment
type: Comment
has text: sorry I meant I put the right extension. By the way , when I put `Log.d("TAG", Arrays.toString(getAssets().list(".")));` I get an empty array

http://stackoverflow.com/comment/38886520
has text: Please read "Time Zone != Offset" in [the timezone tag wiki](http://stackoverflow.com/tags/timezone/info)
comment on: http://stackoverflow.com/q/25005754
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/comment/38828119
type: Comment
has text: Awesome I will check it out. I really appreciate you guys spelling all that out for me. It all makes sense but what is the more professional way to go about it? Sam's interface or one of your other examples?
comment on: http://stackoverflow.com/a/24977533
score: 0
type: AnswerComment

http://stackoverflow.com/a/25048599
score: 10
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25041346
type: Answer
has body: Expose an instance of your Endpoint class as a bean; Spring Boot's actuator auto-configuration will discover it automatically. For example: package demo; import org.springframework.boot.SpringApplication; import org.springframework.boot.actuate.endpoint.Endpoint; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; @Configuration @ComponentScan @EnableAutoConfiguration public class Application { public static void main(String[] args) { SpringApplication.run(Application.class, args); } @Bean public static Endpoint exampleEndpoint() { return new Endpoint&lt;String&gt;() { @Override public String getId() { return "example"; } @Override public boolean isEnabled() { return true; } @Override public boolean isSensitive() { return false; } @Override public String invoke() { return "example"; } }; } }
upvote count: 10
answers question: http://stackoverflow.com/q/25041346
has comment: http://stackoverflow.com/comment/85492305

http://stackoverflow.com/q/25062749
has title: Best practice to hide rows in JavaFX TableView
tagged with: java
tagged with: javafx
has body: I looking for best way to hide rows in table based on some criteria. Right now I have table with dynamically updated rows(with relatively high frequency). Based on user input, rows, which do not meet certain criteria, should be hided. So I was thinking about having two models with data - first, which hold all available items, and second, linked to TableView. When data in first model meet criteria, it will be added to second list, if not - removed. Maybe there are some more ideas how to solve this problem more elegant?
type: Question
tagged with: tableview
upvote count: 3
favorite count: 0
type: UnansweredQuestion
score: 3
answer count: 0
downvote count: 0

http://stackoverflow.com/comment/39017194
score: 0
has text: @berak yes, you are right.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25059576

http://stackoverflow.com/comment/38928021
score: 0
comment on: http://stackoverflow.com/q/25030650
type: Comment
type: QuestionComment
has text: Please tell us, what is happening?

http://stackoverflow.com/comment/38751690
type: Comment
comment on: http://stackoverflow.com/a/24936775
score: 1
type: AnswerComment
has text: @arturojain Yes, that's the best for jsp/servlet application. But if you want to make it programming language independent, e.g. provide API to php, you might like config file based approch.

http://stackoverflow.com/q/25025018
has comment: http://stackoverflow.com/comment/38917997
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25025394
accepted answer: http://stackoverflow.com/a/25025394
has body: Environment: Windows 7, Java 6. Trying to compile a .java file with -cp option. The file uses a single jar file that's in the current directory ALONG WITH some other jar files in the current directory. javac -cp ./*.jar MyFile.java doesn't work. javac -cp ./* MyFile.java doesn't work javac -cp ./MyJar.jar MyFile.java works First two cases, I get a invalid flag error. Can someone explain this behavior? And I checked if it is spaces issue, there are no spaces anywhere in my full file paths.
downvote count: 0
has answer: http://stackoverflow.com/a/25025509
linked to: http://stackoverflow.com/q/9195073
type: Question
linked to: http://stackoverflow.com/q/10847850
linked to: http://stackoverflow.com/q/219585
tagged with: java
score: 9
answer count: 2
possible better answer: http://stackoverflow.com/a/25025509
favorite count: 0
upvote count: 9
has comment: http://stackoverflow.com/comment/38917987
has title: javac classpath option with multiple jar files in current directory causing error
tagged with: javac

multi-touch
tags question: http://stackoverflow.com/q/25053014
type: Tag
tag name: multi-touch

http://stackoverflow.com/q/24913004
downvote count: 1
linked to: http://stackoverflow.com/q/6009767
tagged with: java
has body: When I run my html file, it gives me this error: noclassdefFoundError, applet(wrong name:testapplet/applet) details Java Plug-in 10.65.2.20 Using JRE version 1.7.0_65-b20 Java HotSpot(TM) Client VM applet.class and applet.html are in the same folder: \testapplet\bin\testapplet. Applet code: package testapplet; import java.awt.Graphics; import javax.swing.*; public class applet extends JApplet { public void paint(Graphics g) { g.drawString("Acesta este un applet",320,180); } } Html code: Applet app
type: Question
duplicate of: http://stackoverflow.com/q/6009767
tagged with: applet
has answer: http://stackoverflow.com/a/24913353
score: 0
has title: Applet error in html5
answer count: 1
favorite count: 0
type: UnansweredQuestion
upvote count: 1

http://stackoverflow.com/a/25035538
downvote count: 0
type: Answer
has body: Only numeric types can be compared using the ordering operators in Java. T can be not numeric, so compiler doesn't allow this. Use Comparator to compare objects.
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/25035413

http://stackoverflow.com/comment/38974508
type: QuestionComment
has text: You have a race condition due to the use of i as the lock, change synchronized(i) to Increment.class
type: Comment
comment on: http://stackoverflow.com/q/25055290
score: 0

http://stackoverflow.com/comment/38843051
type: Comment
score: 0
has text: here http://docs.oracle.com/javase/7/docs/api/overview-summary.html i have found it but its hard to get any information out of it ..
comment on: http://stackoverflow.com/q/24985385
type: QuestionComment

http://stackoverflow.com/comment/38849668
type: Comment
comment on: http://stackoverflow.com/q/24988885
score: 0
type: QuestionComment
has text: Think about what the compiler thinks you mean when you call `println()` on your custom class. It can't possibly guess what output you want, so it prints the Class name and a hash code. So that's ugly. But you can change what it prints by overriding the `Object` classes' (remember that all your classes extend `Object` at least) `toString()` method.

http://stackoverflow.com/q/25061459
has body: I tried many combination the resolve this exception but in vain: This line is throwing the exception: aXsl = processor.newXSLStylesheet(xmlDocument); oracle.xml.xslt.XSLException: XML-22009: (Error) Attribute '{http://www.w3.org/1999/XSL/Transform}:version' not found in 'Address'. at oracle.xml.xslt.XSLStylesheet.flushErrors(XSLStylesheet.java:1845) at oracle.xml.xslt.XSLStylesheet.endContent(XSLStylesheet.java:394) at oracle.xml.xslt.XSLBuilder.endDocument(XSLBuilder.java:304) at oracle.xml.parser.v2.XMLDocument.reportSAXEvents(XMLDocument.java:1541) at oracle.xml.xslt.XSLProcessor.newXSLStylesheet(XSLProcessor.java:628) at oracle.xml.parser.v2.XSLProcessor.newXSLStylesheet(XSLProcessor.java:355) at com.ei.commons.transformers.infoarchitect.IAXsltHandler.buildAddressXslt(IAXsltHandler.java:124) at com.ei.commons.transformers.infoarchitect.TestFieldsAtRuntime.main(TestFieldsAtRuntime.java:818) here is the xml sample, my objective is to get an XSLT: <?xml version="1.0" encoding="UTF-16"?> <Address> 2 Queen St MF Shopping Centre
tagged with: java
type: Question
score: 0
has comment: http://stackoverflow.com/comment/38986476
has title: oracle xmlparser v2 - exception while transforming an xmlDocument to xls stylesheet
has comment: http://stackoverflow.com/comment/39083672
tagged with: oracle-database
has comment: http://stackoverflow.com/comment/38986152
tagged with: http://stackoverflow.com/tag/xml
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39084298
has comment: http://stackoverflow.com/comment/39083447
has comment: http://stackoverflow.com/comment/39083467
tagged with: xslt

http://stackoverflow.com/comment/38807177
score: 0
has text: Well, i just added the folder to the tomcat8 server, everything i did went out ok (simple stuffs), it's just when i tap the "gravar" button that i get this error... Basically, everything is ok, until i make the request to save the information in the database. I'm following some online-lessons and followed step by step perfectly, i could put the link here but it's portuguese... How i do to add port in my JDBC url ?
comment on: http://stackoverflow.com/q/24965775
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38827365
score: 0
comment on: http://stackoverflow.com/a/24975563
has text: You'll need to write a JPA query that fetches the rows in `Aluno` for the selected `Graduacao` and `Graus`; sorry, I don't understand your data model well enough to be more specific.
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/38895451
type: AnswerComment
has text: I am working on eclipse, and it doesn't know the third line, send me back an error message.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25004648

http://stackoverflow.com/comment/38766502
comment on: http://stackoverflow.com/q/24944380
has text: @Tsanyo average is 100ms. thanks
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25060184
upvote count: 1
answers question: http://stackoverflow.com/q/25059725
type: AcceptedAnswer
downvote count: 0
has body: Use character streams to read text files. Do not forget to specify encodings in you use them. Otherwise, use byte streams.
type: Answer
accepted answer of: http://stackoverflow.com/q/25059725
score: 1

http://stackoverflow.com/q/25007932
has title: Find a regular expression not preceded by and not followed by
has body: I'm trying to find the right regular expression, but nothing works exactly as I expect. In Java I'm using the String's function split(String regex). I have a list of strings (which are in fact names of music albums). What I want is to split the strings by the the character '-' and use only the first two strings of the resulting array. For example, I have the following strings: Beyonce-BDay-2006-RNS Big_Sean-Finally_Famous-2011-CR Black_Eyed_Peas-The_E.N.D-2009-H3X Bob_Sinclar-Soundz_Of_Freedom-CD-2007-OBC Britney_Spears-Femme_Fatale-2011-H3X Chris_Brown-F.A.M.E.-2011-H3X David_Guetta_-_One_Love-2009-MOD Jay-Z-Blueprint_2.1-2003-RNS Jennifer_Lopez-Love-2011-CaHeSo Kanye_West-808s_And_Heartbreaks-2008-H3X Katy_Perry-Teenage_Dream-2010-CR Ne-Yo-Year_Of_The_Gentleman-2008-FLM Pitbull-Rebelution-2009-NOiR I use the following code: for (int i = 0; i &lt; strings.length; i++) { str = strings[i]; String[] parts = str.split("-"); System.out.println(parts[0].replace('_', ' ').trim() + " - " + parts[1].replace('_', ' ').trim()); } And as a result I get: Beyonce - BDay Big Sean - Finally Famous Black Eyed Peas - The E.N.D Bob Sinclar - Soundz Of Freedom Britney Spears - Femme Fatale Chris Brown - F.A.M.E. David Guetta - One Love Jay - Z Jennifer Lopez - Love Kanye West - 808s And Heartbreaks Katy Perry - Teenage Dream Ne - Yo Pitbull - Rebelution Everything is fine except of two strings: Jay-Z-Blueprint_2.1-2003-RNS Ne-Yo-Year_Of_The_Gentleman-2008-FLM The problem there is that the first hyphen ('-') is, of-course, a part of the artist's name. So, my regex have to be something else that will exclude those exceptions. I tried this regex: (?&lt;!Jay)(?&lt;!Ne)(?!Z)(?!Yo)- Which works fine, but if I add the following strings to the list: Jay-Good-1996-RNS Ne-Alright-2000-RNS I get: Jay-Good - 1996 Ne-Alright - 2000 Instead of: Jay - Good Ne - Alright I tried a lot of other expressions but nothing works. I would very appreciate if someone could help me. Thanks a lot.
has answer: http://stackoverflow.com/a/25009238
has comment: http://stackoverflow.com/comment/38885676
downvote count: 1
has comment: http://stackoverflow.com/comment/38885301
tagged with: expression
tagged with: java
linked to: http://stackoverflow.com/q/15874162
has answer: http://stackoverflow.com/a/25008051
score: -1
has answer: http://stackoverflow.com/a/25008011
type: Question
has comment: http://stackoverflow.com/comment/38885367
duplicate of: http://stackoverflow.com/q/15874162
has answer: http://stackoverflow.com/a/25009009
upvote count: 0
has comment: http://stackoverflow.com/comment/38885249
tagged with: string
has answer: http://stackoverflow.com/a/25008127
favorite count: 0
answer count: 5
tagged with: regex
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38885233

http://stackoverflow.com/comment/38898344
has text: I haven't tried to capture everything yet, I'll try and do that if nobody can answer this. The API does not seem to mention PG UP/PG DOWN anyway.
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25014937

http://stackoverflow.com/comment/38986120
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25058682
has text: @MarkRotteveel Sorry, yes of course, I actually do this:-) I think I misunderstood your comment somehow. I've had a bad day.
score: 0

http://stackoverflow.com/q/25027946
has comment: http://stackoverflow.com/comment/38923542
upvote count: 1
has answer: http://stackoverflow.com/a/25028685
answer count: 1
favorite count: 0
tagged with: android
has comment: http://stackoverflow.com/comment/38923556
has body: I need to access a random string array. The problem is that this gives me an exception. "Invalid int." wordArray = getResources().getStringArray(Integer.valueOf("R.array" + array[new Random().nextInt(array.length)])); Any other way to do this? I can't seem to find one. Please help me. Thanks in advance.
type: AnsweredQuestion
downvote count: 0
score: 1
has title: Invalid Int, R.array.name
has comment: http://stackoverflow.com/comment/38923537
has comment: http://stackoverflow.com/comment/38923498
has comment: http://stackoverflow.com/comment/38923570
has comment: http://stackoverflow.com/comment/38923553
type: Question
linked to: http://stackoverflow.com/q/12139015
accepted answer: http://stackoverflow.com/a/25028685
has comment: http://stackoverflow.com/comment/38923456
tagged with: java
has comment: http://stackoverflow.com/comment/38923508

http://stackoverflow.com/q/25028352
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25030803
tagged with: java
type: Question
score: 0
has comment: http://stackoverflow.com/comment/38933618
has body: The auto insertion of parenthesis can get very annoying. Say I was typing object.get and it suggested object.getName, I'd select it and it inserts object.getName() and then by habit I type () and I end up with object.getName()(); And with object.setName it inserts object.setName(, so I end up with object.setName(("object name); Is there a way to disable this annoying feature?
tagged with: intellij-idea
has title: Disable parenthesis insertion in intellij IDEA
answer count: 1
has comment: http://stackoverflow.com/comment/38925098

http://stackoverflow.com/comment/38876241
has text: Before you can make progress you must understand more clearly why _"sometimes firewall block communication between Machine & Mail Server"_. You will have to update your post to include the specific error messages you are seeing. Sending mail directly from your localhost will almost surely not work.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25003001
type: QuestionComment

http://stackoverflow.com/comment/38719827
comment on: http://stackoverflow.com/q/24919624
has text: I am very new to Maven and all. Any helpful tips on what topic/tutorials to study would be very appreciated. Thanks.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38911034
type: Comment
comment on: http://stackoverflow.com/a/25020778
has text: You have to declare the activity into the manifest and the start it
score: 0
type: AnswerComment

http://stackoverflow.com/comment/38893813
comment on: http://stackoverflow.com/a/25011631
has text: If so accept user entered password as arg in encrypt and decrypt, and use fixed salt. Then use that password in `new PBEKeySpec()`.
type: AnswerComment
type: Comment
score: 0

http://stackoverflow.com/a/24940435
has comment: http://stackoverflow.com/comment/38814050
score: 3
type: Answer
has body: 1) Bean2 is session scoped. Which scope does Bean2.object have? Well, Bean2.object is just an object inside a Bean2 instance and thus doesn't have any CDI scope. 2) Why does the injection in someClass not work? Thanks. There are at least two reasons: someClass (btw, check the naming conventions) is not a CDI managed bean The object referenced by Bean2.object is not created by CDI and thus CDI doesn't even know that instance exists. To fix that, make someClass a managed bean and let CDI inject an instance into Bean2.object.
accepted answer of: http://stackoverflow.com/q/24940345
has comment: http://stackoverflow.com/comment/38852455
answers question: http://stackoverflow.com/q/24940345
upvote count: 3
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/38887254
comment on: http://stackoverflow.com/q/25008793
score: 0
type: Comment
type: QuestionComment
has text: The data is text. Data coverts to binary. as above

http://stackoverflow.com/comment/39003088
score: 0
comment on: http://stackoverflow.com/a/25068215
type: AnswerComment
type: Comment
has text: Don't care about the first second one now.. I have changed the bean names and column names at first just for security... but I am using the same names.

http://stackoverflow.com/q/25051403
answer count: 2
score: 0
linked to: http://stackoverflow.com/q/24019868
has answer: http://stackoverflow.com/a/25066491
tagged with: elasticsearch
has body: I am getting the following exception while trying bulk api in Elasticsearch using java : Caused by: java.lang.IllegalArgumentException: Document contains atleast one immense term in field="msg_properties" (whose UTF8 encoding is longer than the max length 32766), all of which were skipped. Please correct the analyzer to not produce such terms. The prefix of the first immense term is: '[7b 4a 4d 53 43 6f 72 72 65 6c 61 74 69 6f 6e 49 44 3d 6e 75 6c 6c 2c 20 4a 4d 53 4d 65 73]...' I searched with above exception, it lead to the following stackoverflow link and tried to update to the field property from index:not_analyzed to index:no. But its not updating in the index and getting the same exception again. Can anyone say how to solve this and how to update the property? It would be helpful if anyone could provide an example... Thanks in Advance.....
type: UnansweredQuestion
has title: How to change a field property in Elasticsearch index from Index : not_analyzed to index:no?
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/25052815

http://stackoverflow.com/comment/38882408
has text: I don't discount the idea of only creating a single instance of `Random` though, rather than recreating each time...
type: Comment
comment on: http://stackoverflow.com/a/25006425
score: 0
type: AnswerComment

http://stackoverflow.com/a/27967134
type: Answer
has comment: http://stackoverflow.com/comment/44496403
has body: Are settings maybe ignored due to an (unsolicited) existence of parameters both in domain.xml and Eclipse? Would this post help? Glassfish 4.0 won&#39;t start from Eclipse Or this (seem also to affect 4.0): https://java.net/jira/browse/GLASSFISH-6582 https://community.jaspersoft.com/documentation/jasperreports-server-install-guide/v56/setting-jvm-options-application-servers#additional_646152231_1160916 Can't you just ditch the plugin/use another application server? Used JBoss AS and it was ok...
has comment: http://stackoverflow.com/comment/44482577
answers question: http://stackoverflow.com/q/25056809
score: 0

http://stackoverflow.com/comment/38746467
type: Comment
comment on: http://stackoverflow.com/a/24934039
score: 0
type: AnswerComment
has text: @Braj: Yeah got it! I thought if actionPerformed is called before paint method, it is not required. I don't know japlets. so forgive me if I am blatantly wrong :D

activity-lifecycle
tags question: http://stackoverflow.com/q/25039741
tag name: activity-lifecycle
type: Tag

self-signed
type: Tag
tags question: http://stackoverflow.com/q/25000332
tag name: self-signed

http://stackoverflow.com/q/25054112
has body: I want to split a text. I can do it when I use String.split(). For example I split "Hello world." And I get "Hello" and "world" as an output. When I do the same but with toLowerCase I get "hello" and "world." But I don't want this dot after "world". I tried to split with different parameters and put a toLowerCase separately from .split. And I tried to split first and then toLowerCase. Nothing works. What should I do to fade away all these , . ! ? etc. ? Here is how I split: predlog = main.toLowerCase().split("\\s+");
has comment: http://stackoverflow.com/comment/38972287
tagged with: java
score: -1
tagged with: split
has answer: http://stackoverflow.com/a/25054299
upvote count: 0
has comment: http://stackoverflow.com/comment/38972285
favorite count: 0
linked to: http://stackoverflow.com/q/5601451
has answer: http://stackoverflow.com/a/25054893
answer count: 4
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25054354
has title: Java .split doesn't work well with toLowerCase
downvote count: 1
has answer: http://stackoverflow.com/a/25054209
type: Question

http://stackoverflow.com/q/24912988
has comment: http://stackoverflow.com/comment/38706574
has comment: http://stackoverflow.com/comment/38706478
type: Question
has answer: http://stackoverflow.com/a/24913423
score: -2
downvote count: 2
answer count: 3
has body: I created a random array called "array". The amount of random integers and the range in which the random numbers are allowed to be generated from are both decided by whatever the user enters. At the end of the program it should say the maximum and minimum numbers in the array and some other things. So my teacher is having us use methods to accomplish this. I have a method called getMax and this is what is written in that method: public static int getMax(int[] array){ int max = 0; for(int i=0; i&lt;array.length; i++){ if(array[i] &gt; max) max = array[i]; return max; } } So my question is in MAIN. I need to return the max value to main so that it can display that. I understand that I need an integer variable that will accept it. So in main, I have a variable called biggest, so I wrote: biggest = getMax(); What do I have to write in those parentheses above to make this work? What does the argument have to be? THANKS!
favorite count: 0
has title: What does my argument need to be in my java program?
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24913113
has comment: http://stackoverflow.com/comment/38706552
has comment: http://stackoverflow.com/comment/38706579
has answer: http://stackoverflow.com/a/24913105
upvote count: 0
tagged with: java

http://stackoverflow.com/comment/38890801
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25010728
score: 0
has text: The format you provided obviously doesn't match the date, as Scary Wombat already said. You'd need to change the format to include the day-of-week, the month name in abreviated form, the time as well as the time zone and the year moved to the end of the date.

http://stackoverflow.com/a/24993678
accepted answer of: http://stackoverflow.com/q/24989279
type: Answer
answers question: http://stackoverflow.com/q/24989279
upvote count: 2
score: 2
has body: DB_PATH is the path to your graph database. If your Neo4j database is located at c:\graphs\helloDb then DB_PATH=c:\graphs\helloDb If there is no existing Neo4j database in that location, then one will be created for you when you run the program. Running it Eclipse is the same as running any Java program from Eclipse.
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/38717172
type: Comment
score: 2
comment on: http://stackoverflow.com/a/24918163
has text: Edited with background color of dropdown list. I figured it out from a combination of the [source code for the default style sheet, modena](http://hg.openjdk.java.net/openjfx/8/master/rt/file/f89b7dc932af/modules/controls/src/main/resources/com/sun/javafx/scene/control/skin/modena/modena.css), using [ScenicView](http://fxexperience.com/scenic-view/), and, for the background of the dropdown list a little bit of guesswork.
type: AnswerComment

http://stackoverflow.com/comment/38996194
has text: Are you sure your are sending an XML to `direct:marshal` or you have a file in `resources`? Should it be `src/main/resources`?
comment on: http://stackoverflow.com/q/25060938
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25062082
tagged with: java
has comment: http://stackoverflow.com/comment/39020393
type: Question
has answer: http://stackoverflow.com/a/53282694
has answer: http://stackoverflow.com/a/68727391
tagged with: mocking
accepted answer: http://stackoverflow.com/a/25082622
tagged with: mockito
has answer: http://stackoverflow.com/a/44104552
has comment: http://stackoverflow.com/comment/39001897
downvote count: 0
upvote count: 45
answer count: 7
favorite count: 0
score: 45
has comment: http://stackoverflow.com/comment/39002118
has title: cannot resolve symbol PowerMockRunner
has answer: http://stackoverflow.com/a/39471053
has answer: http://stackoverflow.com/a/25990825
has answer: http://stackoverflow.com/a/49666920
tagged with: powermock
has answer: http://stackoverflow.com/a/25082622
has body: I'm trying to use Powermock for the first time I use build.gradle and added: dependencies { ... testCompile 'org.mockito:mockito-all:1.9.5' testCompile 'org.powermock:powermock-api-mockito:1.5.5' } now I look at my test class which has: import org.junit.Before; import org.junit.runner.RunWith; import org.mockito.Matchers; import org.powermock.core.classloader.annotations.PrepareForTest; @RunWith(PowerMockRunner.class) @PrepareForTest(GeoUtils.class) and get this error: @RunWith(PowerMockRunner.class) ^ cannot resolve symbol PowerMockRunner how come it resolves PrepareForTest and not PowerMockRunner ?
possible better answer: http://stackoverflow.com/a/25990825
tagged with: unit-testing
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38988473

http://stackoverflow.com/comment/38958432
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24996509
has text: Can you be more specific about 'Perform parallel runs for the same code' ? Are you running two JVM instances on a single machine (or) your using threads to run the code in a single VM ? You can always view your bytecode generated using javp command or anyother bytecode visualizer.
score: 0

http://stackoverflow.com/q/25042531
type: AnsweredQuestion
has body: Below is the regex I am have: Pattern ddpat = Pattern.compile( "(\\d{1,2}/\\d{1,2}/\\d{4})" ); For an invalid date pattern 02/29/1975 (Since it is not a leap year), when I try the above REGEX on this invalid date, I don't want my REGEX to match this invalid date. Please suggest is there some way to achieve this.
has comment: http://stackoverflow.com/comment/38950857
tagged with: java
has comment: http://stackoverflow.com/comment/38950664
type: Question
has comment: http://stackoverflow.com/comment/38950579
has comment: http://stackoverflow.com/comment/38950492
has answer: http://stackoverflow.com/a/25042607
linked to: http://stackoverflow.com/q/8647893
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/38950385
has title: Regex and Date pattern matching
accepted answer: http://stackoverflow.com/a/25042607
tagged with: regex
has comment: http://stackoverflow.com/comment/38950563

http://stackoverflow.com/comment/137976889
type: Comment
comment on: http://stackoverflow.com/a/78263727
type: AnswerComment
has text: use following attributes produces = {"application/json;charset=UTF-8"}, consumes = {"application/json;charset=UTF-8"
score: 0

http://stackoverflow.com/q/25062434
type: Question
accepted answer: http://stackoverflow.com/a/25062539
possible better answer: http://stackoverflow.com/a/25062740
has answer: http://stackoverflow.com/a/25062740
tagged with: java
tagged with: concurrency
has comment: http://stackoverflow.com/comment/38988041
has body: I am trying to create a variable to return which indicates whether a thread was successful in doing its job or not - however, it requires the variable be final which means it cannot be re assigned. What is needed in order to facilitate something such as this public static void sendFeedbackEmail(final String user, final FeedbackRating rating, final String feedbackText, final EmailAddress emailToSendTo) { if (rating != null &amp;&amp; !StringUtilities.stringEmptyOrNull(user)) { boolean result = false; Thread emailSender = new Thread(new Runnable() { @Override public void run() { feedbackText = (StringUtilities.stringEmptyOrNull(feedbackText)) ? "N/A" : feedbackText; String message = FEEDBACK_MESSAGE.replace("?", rating.getValue()) + user + " Text: " + feedbackText; String emailAddress = (emailToSendTo == null) ? USER_FEEDBACK_EMAIL_ADDRESS : emailToSendTo.getValue(); try { sendVimbaMessage(user, emailAddress, message); } catch (MessagingException e) { result = false; } result = false; } }); emailSender.setDaemon(true); emailSender.start(); } return false; } Thanks
score: 0
answer count: 3
tagged with: runnable
has title: How to Assign Variable from Thread
has answer: http://stackoverflow.com/a/25062836
has answer: http://stackoverflow.com/a/25062539
type: AnsweredQuestion
tagged with: multithreading
linked to: http://stackoverflow.com/q/5516383

http://stackoverflow.com/q/24937540
favorite count: 0
has body: I'm using ant command line to build an android project with an external library. (For some reason, I can't make it into a jar to put in libs/) After completing all the steps of android update and reference link for the project and the lib project, the error of "invalid resource directory name: ./bin/res\crunch" pops out when running "ant release". I know it is a common error but failed to solve it after doing intensive research and trying out all the solutions, including 1) project->clean 2) delete ../bin/res/crunch. (it will re-appear and create the trouble) 3) change android version or SDK version to higher one Any suggestion? Thanks!
possible better answer: http://stackoverflow.com/a/27348878
tagged with: android
type: AnsweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/24968495
score: 5
upvote count: 5
tagged with: ant
accepted answer: http://stackoverflow.com/a/24968495
answer count: 2
has title: android ant error: invalid resource directory name: ./bin/res\crunch
downvote count: 0
has answer: http://stackoverflow.com/a/27348878

http://stackoverflow.com/comment/38765245
comment on: http://stackoverflow.com/q/24943739
score: 0
type: Comment
type: QuestionComment
has text: I get different results on Java 8 http://pastebin.com/wHfvMz01.

http://stackoverflow.com/comment/38822113
type: QuestionComment
has text: You installed `USB Driver`. but have you installed `Android ADB Interface Driver`?
comment on: http://stackoverflow.com/q/24974329
score: 1
type: Comment

http://stackoverflow.com/a/24985481
has comment: http://stackoverflow.com/comment/38842984
type: Answer
has body: The regular expression .*\\d.* does the following: .*: Matches zero or more (*) of any character (.) \\d: \d matches a number but you have to add an extra '\' because in java two back slashes (\\) becomes one. This is called escaping. .*: same as mentioned previously So all in all it will match any string that has zero or more characters one number then zero or more characters after that. Some examples: abasdfadsf7asdga foo87980890bar this is a str1ng that matches! 7
answers question: http://stackoverflow.com/q/24985385
has comment: http://stackoverflow.com/comment/38842955
score: 0

http://stackoverflow.com/a/25025201
accepted answer of: http://stackoverflow.com/q/25024721
score: 1
has body: Double-click on the Eclipse Tomcat server instance and have a look at the configuration. If you are using the option "Use workspace metadata" then the app is deployed in a path like &lt;workspace&gt;/.metadata/.plugins/org.eclipse.wst.server.core/tmpX/wtpwebapps/&lt;context&gt;
upvote count: 1
answers question: http://stackoverflow.com/q/25024721
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/comment/38730095
type: QuestionComment
type: Comment
has text: My mistake, I mixed up the links for class A and B, A is ProximityManager, and B is BleProfileServiceReadyActivity.
comment on: http://stackoverflow.com/q/24925204
score: 0

hsqldb
tags question: http://stackoverflow.com/q/24984016
tags question: http://stackoverflow.com/q/25054977
tags question: http://stackoverflow.com/q/24947447
tag name: hsqldb
type: Tag

http://stackoverflow.com/comment/38894062
score: 0
comment on: http://stackoverflow.com/q/25012509
type: Comment
type: QuestionComment
has text: SparseMatrix matrix = new SparseMatrix<Double>(new Size(3, 2));

http://stackoverflow.com/comment/38971260
score: 0
has text: No, `class` can be omitted because there is the `parent` attribute.
type: AnswerComment
comment on: http://stackoverflow.com/a/25053335
type: Comment

http://stackoverflow.com/comment/38947577
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25041089
has text: Looks like the connection failed and `con = null` but you still call `con.close()` so it will throw the `NullPointerException`.
score: 0

http://stackoverflow.com/comment/38980212
type: Comment
score: 13
comment on: http://stackoverflow.com/a/25056821
type: AnswerComment
has text: The Javadoc of the one-argument split method says: "This method works as if by invoking the two-argument split method with the given expression and a limit argument of zero. **Trailing empty strings are therefore not included in the resulting array.**" That's the correct explanation of the second result. Two trailing empty strings get excluded.

clojure
tags question: http://stackoverflow.com/q/24992219
type: Tag
tags question: http://stackoverflow.com/q/25005429
tags question: http://stackoverflow.com/q/24956310
tags question: http://stackoverflow.com/q/24976711
tags question: http://stackoverflow.com/q/24975100
tags question: http://stackoverflow.com/q/25059576
tag name: clojure
tags question: http://stackoverflow.com/q/24963702

http://stackoverflow.com/comment/38772846
comment on: http://stackoverflow.com/q/24947876
score: 0
has text: Since it is on a webpage there is no way to control what user is entering. Want to validate the input and show a error message if the entered value is not correct.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39027468
score: 1
type: QuestionComment
has text: For the first issue you can use hidden text box and once the user selects any check box put the value like comma separated `1,5,7,9`. So once you are submitting you can receive this as string and convert this into array. For second one instead of using two submit buttons, use one field either radio button or dropdown ask the user to choose the operation(restart/shutdown) they want.
type: Comment
comment on: http://stackoverflow.com/q/25067867

http://stackoverflow.com/q/24994889
type: Question
has answer: http://stackoverflow.com/a/24994992
upvote count: 0
answer count: 1
favorite count: 0
has title: Java Application Auto Update
type: UnansweredQuestion
score: -3
has body: We have an java application hello.jar and a server where the application updates resides. We have implemented an mechanism in the application hellow.jar which downloads the latest jar in the updates folder. so I run the hello.jar hello.jar downloads the updates.zip inside updates Then hello.jar extracts the updates.zip file and extracts the updater.jar and latest hello.jar Next using process builder it launch the update.jar and hello.jar exists itself using system.exit(0) Now updater.jar copies the original hello.jar to backup Then updater.jar copies the latest application from update/hello.jar to current directory Then updater.jar removes the /backup directory Next update .jar deletes the /updates directory Finally updater.jar launches the hello.jar again and exits itself Please let me know if there is any better alternative approach.
tagged with: java
downvote count: 3

http://stackoverflow.com/a/25066875
type: Answer
has body: Perhaps like this: List&lt;Number&gt; listofNumbers = new ArrayList&lt;&gt;(); for( String s: listOfStrings ){ try { Number number = Enum.valueOf( Number.class, s ); // or shorter: Number.valueOf( s ); listOfNumbers.add( number ); } catch( IllegalArgumentException iae ){ // handle exception } }
accepted answer of: http://stackoverflow.com/q/25066508
answers question: http://stackoverflow.com/q/25066508
type: AcceptedAnswer
score: 0
has comment: http://stackoverflow.com/comment/38996707
has comment: http://stackoverflow.com/comment/39013035

named-query
type: Tag
tags question: http://stackoverflow.com/q/25003009
tag name: named-query

http://stackoverflow.com/comment/38904825
has text: @DaveDoknjas Yes, delegates could be somewhat derisively called a poor man's Observer Pattern. They are an effective solution for UI-event handling(inside one UI element), but for anything more intricate you end up using more complex solutions.
type: Comment
comment on: http://stackoverflow.com/a/25012761
score: 0
type: AnswerComment

http://stackoverflow.com/comment/38748543
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24934803
type: Comment
has text: Folder WebContent containing two subFolders - images and jsps, images folder contains the jpg, jsps folder contains the .jsp file

http://stackoverflow.com/q/24929575
has body: I use org.springframework.data.mongodb.core.MongoTemplate to save data to MongoDB. My sample data is following bean: public class SampleBean{ private Date date; private List&lt;Date&gt; datesList; private TreeMap&lt;Date, Integer&gt; datesMap; // setters and getters } I am calling following instructions. SampleBean bean = new SampleBean(); MongoTemplate mongo = new MongoTemplate(); List&lt;Date&gt; dateList = new ArrayList&lt;Date&gt;(); dateList.add(new Date()); TreeMap&lt;Date,Integer&gt; dateMap = new TreeMap&lt;Date, Integer&gt;(); dateMap.put(new Date(), new Integer(1)); bean.setDate(new Date()); bean.setDateList(dateList); bean.setDateMap(dateMap); mongo.save(bean, "SampleBean"); And this is what i get in mongo: { "_id" : ObjectId("53d028eeb71a1523582b1b1c"), "_class" : "example.SampleBean", "date" : ISODate("2014-07-23T21:28:14.869Z"), "datesList" : [ ISODate("2014-07-23T21:28:14.876Z") ], "datesMap" : { "Wed Jul 23 23:28:14 CEST 2014" : 1 } } Because of way it's stored I am not able to load bean from MongoDB I get Handler execution resulted in exception - forwarding to resolved error view org.springframework.core.convert.ConversionFailedException: Failed to convert from type java.lang.String to type java.util.Date for value 'Wed Jul 23 23:28:14 CEST 2014'; nested exception is java.lang.IllegalArgumentException Why Date from TreeMap is not stored as ISODate? Am I doing anything wrong?
downvote count: 0
has title: Spring saves Date as String in MongoDB - Failed to convert from type String to type Date
tagged with: spring
type: Question
type: AnsweredQuestion
tagged with: java
tagged with: http://stackoverflow.com/tag/json
upvote count: 2
tagged with: mongodb
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/24929800
accepted answer: http://stackoverflow.com/a/24929800
score: 2

http://stackoverflow.com/comment/38816038
comment on: http://stackoverflow.com/a/24970928
score: 0
type: AnswerComment
has text: I mean to say that is your Libraries folder being utilized by the application?
type: Comment

http://stackoverflow.com/comment/86023430
comment on: http://stackoverflow.com/a/24911933
has text: This is bad advice! The proper way to do this is to derive a key using a Key Derivation Function.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/38864550
has text: Hi maddy,But am not understading where you are getting from mainmenu and submenu can paste that piece of code
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24996436
type: AnswerComment

http://stackoverflow.com/a/24995092
type: Answer
score: 2
has body: Add a Velocity config to your dispatcher servlet: <property name="resourceLoaderPath" value="/WEB-INF/velocity/"/>
downvote count: 0
has comment: http://stackoverflow.com/comment/38861096
answers question: http://stackoverflow.com/q/24994351
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24994351
has comment: http://stackoverflow.com/comment/38861343
has comment: http://stackoverflow.com/comment/38860966
upvote count: 2
has comment: http://stackoverflow.com/comment/38860903

http://stackoverflow.com/comment/38904075
score: 0
type: Comment
has text: Seems like a rehash of this: http://stackoverflow.com/questions/24825958/java-serialization-eofexception-issue
type: QuestionComment
comment on: http://stackoverflow.com/q/25016172

http://stackoverflow.com/comment/38978358
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25056876
score: 0
has text: Please elaborate on your answer. Specify what is different and how to solve the question.

http://stackoverflow.com/a/25068796
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25066282
has body: Found solution, in google chrome rest client, i didnot select content type in the header.
type: Answer
accepted answer of: http://stackoverflow.com/q/25066282
score: 0

http://stackoverflow.com/q/24953797
has title: Send GET request with 443 userid password prompt authentication using Java HttpClient
favorite count: 0
has answer: http://stackoverflow.com/a/24956920
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/38783311
accepted answer: http://stackoverflow.com/a/24956920
has body: I want to get the response from a url by sending url parameters(GET parameters) eg. https://ebctest.cybersource.com/ebctest/DownloadReport/2014/07/23/$MerchantId/ConversionDetailReport.xml When I hit the server I am prompted by a userid, password dialog box. I can get the response by manually entering the id,password. How can I achieve this programatically using java. Below is the code which I have tried till now. final HttpClient httpClient = new HttpClient(); httpClient.getState().setCredentials(new AuthScope(null, 443), new UsernamePasswordCredentials(userName, password)); httpClient.getParams().setParameter("http.socket.timeout", Integer.valueOf(10000)); httpClient.getState().setAuthenticationPreemptive(true); final GetMethod method = new GetMethod("https://ebctest.cybersource.com/ebctest/DownloadReport/2014/07/23/$merchantId/ConversionDetailReport.xml"); final InputSource is = new InputSource(new ByteArrayInputStream(method.getResponseBody())); When I do method.getResponseBody I get empty. I should be getting a proper response as I am getting when sending the request manually.
has comment: http://stackoverflow.com/comment/38783663
answer count: 1
downvote count: 0
tagged with: apache-commons-httpclient

http://stackoverflow.com/a/25058236
has comment: http://stackoverflow.com/comment/39048935
type: Answer
answers question: http://stackoverflow.com/q/25058187
has comment: http://stackoverflow.com/comment/39047404
has comment: http://stackoverflow.com/comment/39049013
has body: to write at first position i.e. prepend then u need to use this private void writeToFile(Context context,String data){ try{ String path=context.getFilesDir().getAbsolutePath(); File file = new File(path + File.separator + fileName); RandomAccessFile rf = new RandomAccessFile(file,"rws"); file.getParentFile().mkdirs(); Log.d("creating file path",path); byte[] text = new byte[(int) file.length()]; rf.readFully(text); rf.seek(0); rf.writeBytes(data); rf.write(text); Log.d("write","writing file..."); rf.close(); }catch(Exception e){e.printStackTrace(); Log.d("caught", "data wititng fail");} } and if u want to append use this private void writeToFile(Context context,String data){ try{ String path=context.getFilesDir().getAbsolutePath(); File file = new File(path + File.separator + fileName); RandomAccessFile rf = new RandomAccessFile(file,"rws"); file.getParentFile().mkdirs(); Log.d("creating file path",path); byte[] text = new byte[(int) file.length()]; rf.readFully(text); rf.seek(0); rf.write(text); rf.writeBytes(data); Log.d("write","writing file..."); rf.close(); }catch(Exception e){e.printStackTrace(); Log.d("caught", "data wititng fail");} } or u can open file in MODE_APPEND mode.. to open file in append mode change to this OutputStreamWriter out=new OutputStreamWriter(openFileOutput(fileName,true));
has comment: http://stackoverflow.com/comment/39047356
score: 0
has comment: http://stackoverflow.com/comment/39051700

http://stackoverflow.com/comment/38746968
score: 0
type: Comment
comment on: http://stackoverflow.com/q/24910942
type: QuestionComment
has text: I actually just found out why I'm having this problem with ssl. http://stackoverflow.com/questions/18746565/godaddy-ssl-cert-not-working-with-java

http://stackoverflow.com/q/25055988
has answer: http://stackoverflow.com/a/36081565
answer count: 1
downvote count: 0
favorite count: 0
tagged with: jeromq
type: UnansweredQuestion
has title: Zcontext.destroy() hangs instead of terminating all open sockets
has body: I have a server written in Java - (that uses ZeroMQ in REQ-REP and PUB-SUB patterns.) I am wrapping it as a Windows services using the Apache Commons Daemon (prunsrv/procrun) Sometimes the call to ZContext.destroy hangs. I have managed to get stack traces when the context is not destroyed. If I understand correctly, ZContext.destroy() should manage the termination of all sockets. What could be the problem? I have pasted the stack trace received when the context does not get destroyed - but we must end the process. import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.zeromq.ZContext; import org.zeromq.ZMQ; /** * This is the driver for starting and stopping the PowerLoggerService * */ public class PowerLoggerService { static PreferenceManager prefMgr; static ModuleServer moduleServer; static DiscoveryServer discoveryServer; static LoggerRequestServer loggerRequestServer; static NotificationServer notificationServer; static ScheduledExecutorService scheduler; static ZContext zContext; private static final Logger log = LoggerFactory.getLogger("PowerLoggerService"); private volatile static boolean shouldStop; private volatile static boolean contextWasDestroyed = false; public static void start(String [] args) { zContext = new ZContext(); zContext.setLinger(0); scheduler = Executors.newScheduledThreadPool(1); log.trace("Entered startPMServer"); notificationServer = new NotificationServer(zContext); notificationServer.publishStatus(MessageType.STARTED, "Server started"); if(prefMgr.ensureValidDBPrefs()) { moduleServer = new ModuleServer(); moduleServer.start(); discoveryServer = new DiscoveryServer(); discoveryServer.start(); loggerRequestServer = new LoggerRequestServer(zContext); loggerRequestServer.start(); scheduler.scheduleAtFixedRate(notificationServer,…
tagged with: java
tagged with: multithreading
type: Question
tagged with: procrun
score: 4
upvote count: 4

http://stackoverflow.com/a/25007080
type: Answer
score: 2
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25007057
answers question: http://stackoverflow.com/q/25007057
has comment: http://stackoverflow.com/comment/38883632
upvote count: 2
type: AcceptedAnswer
has body: I'm not aware of a way to open it with a specific color format, but you can create a new BufferedImage of the desired format and draw the old image on to it: BufferedImage img2 = new BufferedImage(img.getWidth(), img.getHeight(), BufferedImage.TYPE_INT_RGB); Graphics2D g = img2.createGraphics(); g.drawImage(img, 0, 0, null); g.dispose(); Any transparent parts in the original image will be drawn over a black background in the new image. If you'd prefer a different background, you can insert these lines before the drawImage call: g.setColor(Color.white); // or whichever g.fillRect(0, 0, img.getWidth(), img.getHeight());

http://stackoverflow.com/q/24924112
has comment: http://stackoverflow.com/comment/38727769
tagged with: java
tagged with: hibernate
type: Question
has answer: http://stackoverflow.com/a/24924173
has answer: http://stackoverflow.com/a/24924280
accepted answer: http://stackoverflow.com/a/24924255
downvote count: 0
upvote count: 2
linked to: http://stackoverflow.com/q/8126589
answer count: 3
has answer: http://stackoverflow.com/a/24924255
has body: I'm using org.hibernate.criterion.Example.create to create my query from my Entity object. Everything is fine, but using this method the SQL is only created with AND clause between the restrictions. Is it possible to use org.hibernate.criterion.Example.create but with OR clause?
favorite count: 0
tagged with: query-by-example
possible better answer: http://stackoverflow.com/a/24924173
has title: Hibernate org.hibernate.criterion.Example.create OR clause
tagged with: hibernate-criteria
type: AnsweredQuestion
score: 2

http://stackoverflow.com/comment/38796581
comment on: http://stackoverflow.com/a/24960454
type: AnswerComment
score: 0
type: Comment
has text: If I choose the theme and then open another subJFrame, which is created on the volley (if not already created, otherwise it would be set to visible) (1) is this new subJFrame going to be affected by the call to SwingUtilities.updateComponentTreeUI(mainJFrame) called previously on the "Themes" subJFrame??? (2) Or I have explicitly to set to it the new theme, since this another subJframe wasn't created before setting the theme, (3) and if it was already created?

http://stackoverflow.com/a/24925217
answers question: http://stackoverflow.com/q/24923882
type: AcceptedAnswer
type: Answer
score: 3
downvote count: 0
has body: For the ones out there... Here is the process to get it done: stmt.execute ("INSERT INTO my_blob_table VALUES ('row1', empty_blob())"); BLOB blob; cmd = "SELECT * FROM my_blob_table WHERE X='row1' FOR UPDATE"; ResultSet rset = stmt.executeQuery(cmd); rset.next(); BLOB blob = ((OracleResultSet)rset).getBLOB(2); File binaryFile = new File("john.gif"); System.out.println("john.gif length = " + binaryFile.length()); FileInputStream instream = new FileInputStream(binaryFile); OutputStream outstream = blob.setBinaryStream(1L); int size = blob.getBufferSize(); byte[] buffer = new byte[size]; int length = -1; Source: http://docs.oracle.com/cd/B19306_01/java.102/b14355/oralob.htm#CHDFHHHG
accepted answer of: http://stackoverflow.com/q/24923882
upvote count: 3

http://stackoverflow.com/a/25023474
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/25022955
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25022955
score: 1
has body: I'm not sure what you're trying to do in your method endElement(...) but if you want to get a readable excel file, just transform the encoded base64 to a byte array (NOT TO ANOTHER STRING) i. e. change your endElement(...) like this: @Override public void endElement(String uri, String localName, String qName) throws SAXException { if ("fileContent".equalsIgnoreCase(qName)) { try { Files.write(Paths.get("temp.xls"), DatatypeConverter.parseBase64Binary(value.toString())); } catch (IOException ex) { Logger.getLogger(SaxSample.class.getName()).log(Level.SEVERE, null, ex); } } else { // I'm still not sure why you're printing this ... debugging? System.out.println(qName + " = " + value); } } The only thing you need to do is: get the content of the element fileContent (you're already doing that) decode this content into a byte array save this byte array in a file (no need to do further conversions)
upvote count: 1

http://stackoverflow.com/q/24947159
has answer: http://stackoverflow.com/a/24947387
favorite count: 0
upvote count: 5
has comment: http://stackoverflow.com/comment/38789869
tagged with: android
has comment: http://stackoverflow.com/comment/38791326
type: AnsweredQuestion
downvote count: 0
tagged with: java
possible better answer: http://stackoverflow.com/a/24947387
tagged with: gson
has comment: http://stackoverflow.com/comment/38771942
type: Question
score: 5
has comment: http://stackoverflow.com/comment/38795011
has title: Using Gson to elegantly handle nested json objects?
has answer: http://stackoverflow.com/a/25044666
accepted answer: http://stackoverflow.com/a/25044666
has body: I'm using Gson to parse responses from a server on Android. Each response has some useless (to me) data on it that complicates my Gson models. Here is the general hierarchy of json returned: response: { date: 1406253006807, otherUselessData1: "This is some useless data", otherUselessData2: "This is some useless data", usefulJsonObject: { &lt;---- This is really the object that I care about } } Everything above or at the same level as usefulJsonObject I could really do without. The useless data is returned for every request, and the actual response is embedded beneath as the usefulJsonObject. This wouldn't be a big problem but it's really cluttering up my gson model objects. For example: Let's say I have 3 requests I can make: A, B, and C. For each response it seems I need to make a minimum of 3 custom classes. public class ResponseA { @SerializedName("response") ResponseObjectA responseObject; public static class ResponseObjectA { @SerializedName("usefulJsonObject") UsefulObjectA usefulObject; } public static class UsefulObjectA { } } I've tried a few solutions, but I haven't found anything elegant that wouldn't add an extra step to my process. I'm using retrofit to do my http requests and it's really nice that it just returns the fully parsed gson object to me. I've thought of other solutions like having the useful object just be a JsonElement and then doing a 2nd gson call after the first comes back. Again, not ideal. I just wanted to know if I was missing something. Surely I'm not the only one who's encountered something like this, and so I thought I'd ask how other people would handle something like this.
answer count: 2
tagged with: retrofit

http://stackoverflow.com/comment/38977451
type: AnswerComment
type: Comment
has text: Thanks for your answer, but the code you posted is Groovy, I'm looking for something equivalent for Java.
comment on: http://stackoverflow.com/a/25055836
score: 0

http://stackoverflow.com/a/24909963
upvote count: 1
downvote count: 0
type: Answer
has body: Use BigDecimal instead of double. Documentation Solution: Here You can set the precision at the MathContext('precision' , ..) final static int LASTITER = 17; public static void main(String[] args) { MathContext mc = new MathContext(20, RoundingMode.HALF_UP); BigDecimal result = BigDecimal.ZERO; for (int i = 0; i &lt;= LASTITER; i++) { BigDecimal factorial = factorial(new BigDecimal(i)); BigDecimal res = BigDecimal.ONE.divide(factorial, mc); result = result.add(res); } System.out.println(result); } public static BigDecimal factorial(BigDecimal n) { if (n.equals(BigDecimal.ZERO)) return BigDecimal.ONE; else return n.multiply(factorial(n.subtract(BigDecimal.ONE))); } Source: math
answers question: http://stackoverflow.com/q/24909794
score: 1

http://stackoverflow.com/q/24983603
has answer: http://stackoverflow.com/a/24983748
accepted answer: http://stackoverflow.com/a/24983748
tagged with: generics
type: AnsweredQuestion
upvote count: 2
score: 1
possible better answer: http://stackoverflow.com/a/24983850
downvote count: 1
type: Question
tagged with: java
has body: Despite the fact that Java does not have generics [@ runtime], lately I have been caught up in some kind of a generic hell. Situation (simplified &amp; useless context removed): There is a library A, which provides an interface IA. There is a library B, which provides an interface IB. Both libraries are 3rd party libraries, which I have absolutely no control over. (In reality, there are more than 2, but let's not this make too complex just yet.) There is an engine, developed by my company, which both defines and makes heavy use of objects that are/implement both IA and IB. Because our engine must deal with all implementations, we could not simply define some interface IAB implements IA, IB and let all our classes implement it. Therefore, in order to attain compile-time type-safety &amp; method exposure, it was decided to use generic methods. So, whenever an 'IAB' would be required, we would have &lt;IAB extends IA &amp; IB&gt; void doThis(IAB someObjectWithBothAPIs). This works very well, as a matter of fact. However, it is not possible to do something as simple as &lt;IAB extends IA &amp; IB&gt; IAB fieldWithBothAPIs; (neither IA &amp; IB fieldWithBothAPIs;). Which brings us to the question: Why not? Basically, what are the (design-level?) reasons to allow arbitrary TypeParams(opt), while instance fields are restricted to a concrete Type? JLS §8.3 FieldDeclaration: FieldModifiers(opt) Type VariableDeclarators ; JLS §8.4 MethodDeclaration: MethodHeader MethodBody MethodHeader: MethodModifiers(opt) TypeParameters(opt) Result MethodDeclarator Throws(opt)
has title: Java supports generic types and methods. Why not generic fields?
answer count: 2
has answer: http://stackoverflow.com/a/24983850
favorite count: 0
has comment: http://stackoverflow.com/comment/38839803

http://stackoverflow.com/comment/38858818
type: QuestionComment
has text: Yes I want it to be endlessly invoked; == for this reason is there loop, but calling loop(); from public void paintComponent(Graphics g) multiply this crazy idea :-)
score: 0
comment on: http://stackoverflow.com/q/24993711
type: Comment

http://stackoverflow.com/comment/46515447
score: 0
comment on: http://stackoverflow.com/a/29143328
type: AnswerComment
has text: In all the methods (I had to update the code) if you check the main post, you'll see the new updated code.
type: Comment

http://stackoverflow.com/comment/38908446
score: 1
type: Comment
has text: Actually, it would be significantly more "optimal" to assign `folder.getAbsolutePath()` to a temp prior to the `if`, and use that temp in both the `if` and the `new Song` call.
comment on: http://stackoverflow.com/a/25020073
type: AnswerComment

http://stackoverflow.com/comment/38834775
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24981188
score: 0
has text: @user1613360 i have posted an answer tell me if it is not you are looking for..i will delete it.

http://stackoverflow.com/comment/38896016
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24995526
type: AnswerComment
has text: It doesn't matter what language you use.

http://stackoverflow.com/q/24948517
tagged with: eclipse
has comment: http://stackoverflow.com/comment/38774963
type: Question
has title: how do I delete .jar files in the JRE System Library?
has comment: http://stackoverflow.com/comment/38774133
has answer: http://stackoverflow.com/a/24948555
has comment: http://stackoverflow.com/comment/38774114
has body: My homework assignment for my class gave me a lot of .java files to import, I was fiddling with eclipse trying to find a way to import them in the package (I did not realize I could just drag and drop..), but instead I imported them in the JRE System library folder, where I can no longer remove them. I understand the mistake that I made, however I cannot find a way to remove these files from JRE 1.7. I re-installed eclipse, and even deleted the JRE7 folder and reinstalled JRE. But the files are still here.
has answer: http://stackoverflow.com/a/24948610
has answer: http://stackoverflow.com/a/24948759
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/37108289
type: UnansweredQuestion
answer count: 4
score: 2
upvote count: 2
tagged with: java
has comment: http://stackoverflow.com/comment/38774207

http://stackoverflow.com/a/24980305
answers question: http://stackoverflow.com/q/24980063
score: 0
has body: As your properties file contains the key as primefacestheme but while calling its value you are trying to use some other key change this primefaces.THEME ${primefacestheme} to primefacestheme ${primefacestheme}
type: Answer

jaxb
tags question: http://stackoverflow.com/q/25001292
tags question: http://stackoverflow.com/q/24936430
tags question: http://stackoverflow.com/q/24982720
tags question: http://stackoverflow.com/q/25003891
tags question: http://stackoverflow.com/q/24927679
tags question: http://stackoverflow.com/q/25024845
tags question: http://stackoverflow.com/q/25032186
tags question: http://stackoverflow.com/q/24958148
tags question: http://stackoverflow.com/q/24982321
tags question: http://stackoverflow.com/q/25063880
tags question: http://stackoverflow.com/q/25015416
tags question: http://stackoverflow.com/q/25039337
tags question: http://stackoverflow.com/q/24992956
tags question: http://stackoverflow.com/q/24962895
type: Tag
tags question: http://stackoverflow.com/q/25061122
tags question: http://stackoverflow.com/q/25006503
tags question: http://stackoverflow.com/q/25010365
tag name: jaxb
tags question: http://stackoverflow.com/q/24934405
tags question: http://stackoverflow.com/q/25018627
tags question: http://stackoverflow.com/q/24980109
tags question: http://stackoverflow.com/q/24994107
tags question: http://stackoverflow.com/q/24922936
tags question: http://stackoverflow.com/q/24910193
tags question: http://stackoverflow.com/q/24911879
tags question: http://stackoverflow.com/q/25060137

http://stackoverflow.com/a/25045037
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/38955423
upvote count: 2
answers question: http://stackoverflow.com/q/25044957
type: Answer
has body: You could check if it contains http or not using: ... if(!lnk.startsWith("http://") { lnk = "http://" + lnk; } Hope this helps.

http://stackoverflow.com/q/25066950
has comment: http://stackoverflow.com/comment/38996807
answer count: 1
score: 0
tagged with: junit
has body: My failed Junit test reruns once and stops but i am looking to have it run 3 times. I guess my annotation is screwed in some way. Pls what is the proper format for annotation. Note: I will also appreciate info about correct annotation for testing SuiteClasses. Below is my annotation @Rule public Retry retry = new Retry(3); any help will be appreciated public class HostTest { /** * Test method for {@link com.ibm.ws.ui.collective.internal.rest.resource.Host}. */ public class RetryTest { /** * @param i */ public RetryTest(int i) { // TODO Auto-generated constructor stub } public class Retry extends TestRule { private final int retryCount; public Retry(int retryCount) { this.retryCount = retryCount; } @Override public Statement apply(Statement base, Description description) { return statement(base, description); } private Statement statement(final Statement base, final Description description) { return new Statement() { @Override public void evaluate() throws Throwable { Throwable caughtThrowable = null; // implement retry logic here for (int i = 0; i &lt; retryCount; i++) { try { base.evaluate(); return; } catch (Throwable t) { caughtThrowable = t; System.err.println(description.getDisplayName() + ": run " + (i + 1) + " failed"); } } System.err.println(description.getDisplayName() + ": giving up after " + retryCount + " failures"); throw caughtThrowable; } }; } } } @Test public void sanityCheck_withHostPathsNull() { Host h = new Host("myHost"); Map&lt;String, Object&gt; mapFromController = new HashMap&lt;String, Object&gt;(); h.setHostPaths(mapFromController); assertFalse("it is not empty", h.getHostPaths().isEmpty()); } }
has comment: http://stackoverflow.com/comment/38996957
type: AnsweredQuestion
has title: failed JUnit test reruns once and stops
tagged with: java
has answer: http://stackoverflow.com/a/25068100
accepted answer: http://stackoverflow.com/a/25068100
type: Question
has comment: http://stackoverflow.com/comment/38997222

http://stackoverflow.com/comment/38798598
type: Comment
comment on: http://stackoverflow.com/a/24961822
type: AnswerComment
has text: Yes, Thanks, and the that I asked was I can only run my GUI programs in eclipse i want to run them on the desktop or something
score: 0

http://stackoverflow.com/q/24952692
tagged with: android-fragments
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/24952841
has comment: http://stackoverflow.com/comment/38781464
has title: findViewById in Fragment returns Null
has body: I've tried both getActivity().findViewById() and getView(). This is the code in my fragment. They all return null.. @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.edit_viewer, container, false); Bundle bundle = getArguments(); id = bundle.getLong("VIEWER_ID"); DatabaseHelper dbHelper = new DatabaseHelper(getActivity()); username = (EditText)getView().findViewById(R.id.username); password = (EditText)getView().findViewById(R.id.entry); hostUrl = (EditText)getView().findViewById(R.id.hostUrl); webApp = (EditText)getView().findViewById(R.id.webApp); modelId = (EditText)getView().findViewById(R.id.modelId); properties = (EditText)getView().findViewById(R.id.properties); Code from Activity public class EditViewerActivity extends ActionBarActivity { private Long id; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_edit_viewer); Intent intent = getIntent(); Long id = intent.getLongExtra("VIEWER_ID", 0); ViewerEditFragment newFragment = new ViewerEditFragment(); Bundle bundle = new Bundle(); bundle.putLong("VIEWER_ID", id); newFragment.setArguments(bundle); if (savedInstanceState == null) { getSupportFragmentManager().beginTransaction() .add(R.id.container, newFragment) .commit(); } } edit_viewer.xml <?xml version="1.0" encoding="utf-8"?> <TextView style="?android:attr/listSeparatorTextViewStyle" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="sfn Credentials"/> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/username" android:paddingLeft="10dp" /> <EditText android:id="@+id/username" android:hint="Admin" android:layout_width="match_parent" android:layout_height="wrap_content" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/password" an…
has answer: http://stackoverflow.com/a/24952774
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/24952724
possible better answer: http://stackoverflow.com/a/24952774
accepted answer: http://stackoverflow.com/a/24952724
tagged with: android
type: AnsweredQuestion

http://stackoverflow.com/a/45875910
has body: Just sharing my experience with a similar error but a different cause in case somebody else runs into this. The same error appeared after adding an annotation from a test-scoped dependency to a class in src/main/java. Eclipse didn't complain because m2eclipse isn't very good at distinguishing compile and test scoped dependencies and just adds every dependency to the project classpath regardless of the scope. To see the actual compilation error, I had to perform the following steps : make m2e-apt generate the QueryDsl classes in Eclipse deactivate the annotation processing from the project's POM run mvn compile (without clean to not delete the classes generated in step 1)
downvote count: 0
answers question: http://stackoverflow.com/q/24959111
has comment: http://stackoverflow.com/comment/132798438
type: Answer
upvote count: 1
score: 1

cors
type: Tag
tag name: cors
tags question: http://stackoverflow.com/q/24991859

http://stackoverflow.com/comment/38912350
has text: You are throwing an exception in a completely unrelated thread. Of course, this is not affecting your iteration.
score: 0
comment on: http://stackoverflow.com/q/25021807
type: Comment
type: QuestionComment

http://stackoverflow.com/a/77858517
has body: I had a similar situation where I have a list of Map.Entry&lt;X, Y&gt; and was trying to aggregate them into a Map&lt;X, List&gt;. Here just the list.stream().collect(Collectors.groupingBy(Entry::getKey)) does not work simply. The way to go was: list.stream() .collect(Collectors.groupingBy(Entry::getKey, Collectors.mapping(Entry::getValue, Collectors.toList())))) Kudos to Piet from here: https://coderanch.com/t/755986/java/Create-Map-existing-List-Entry
type: Answer
answers question: http://stackoverflow.com/q/24917053
score: 0

http://stackoverflow.com/q/24935962
has body: I am having trouble running tests in a subclass in IntelliJ. This seems to work when I run the build through maven, but trying to run the child class in IntelliJ causes the child test to get ignored. Here is an example: The parent class: import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertFalse; import static org.testng.Assert.fail; import org.openqa.selenium.By; import org.openqa.selenium.NoSuchElementException; import org.openqa.selenium.WebElement; import org.openqa.selenium.interactions.Action; import org.openqa.selenium.interactions.Actions; import org.testng.annotations.Test; public class TestSomething { @Test public void runSomething(){ //Test Stuff } } And the child class: import org.openqa.selenium.By; import org.openqa.selenium.NoSuchElementException; import org.openqa.selenium.WebElement; import org.testng.annotations.DataProvider; import org.testng.annotations.Test; import static org.testng.Assert.*; public class TestThisSomethingAsWell extends TestSomething{ @Test(dependsOnMethods = "runSomething") public void runSomethingElse(){ //More Test Stuff } } In the above example, both runSomething and runSomethingElse get called when running through Maven, but when I run the TestThisSomethingAsWell class through IntelliJ only runSomething is run. It does not even show runSomethingElse in the list of tests. Also note that these are selenium tests, but I am not sure if that is part of the problem or not. Edit: Added import statements.
type: UnansweredQuestion
tagged with: maven
has comment: http://stackoverflow.com/comment/38752483
has comment: http://stackoverflow.com/comment/38755713
answer count: 0
score: 1
tagged with: java
tagged with: selenium
upvote count: 1
has comment: http://stackoverflow.com/comment/38750144
has title: Running child class tests dependent on parent does not work (TestNG, IntelliJ)
type: Question
has comment: http://stackoverflow.com/comment/38755645
has comment: http://stackoverflow.com/comment/38765767
tagged with: intellij-idea
downvote count: 0
favorite count: 0

http://stackoverflow.com/a/25006869
answers question: http://stackoverflow.com/q/25006718
upvote count: 3
has body: The functionality might not be the same. If the instance variables get re-assigned, passing them to the constructor would change the functionality. And having two copies makes the code harder to read. If the instance variables don't change and the classes really go together, it is probably fine. Make sure that the inner class really should be one. You are coupling the classes tightly with this technique which makes refactoring harder. For event handlers (a common inner class type) and the like, accessing the outer class' variables is common and logical.
score: 3
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25006718
type: Answer

http://stackoverflow.com/comment/38728533
has text: To enhance the code above, I would suggest to have an abstract class that would be parent to all of your events and a child of Observable class. This parent class would include an abstract method which returns an enum. The enum is include all possible types of Events. This is to enhance the code of the update method in the EventsListener to use switch instead of instanceof
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24924553

http://stackoverflow.com/comment/38781546
comment on: http://stackoverflow.com/a/24934808
type: Comment
score: 0
type: AnswerComment
has text: @Guenevere: Ah, yes. The `<%` needs to be `<%=`

http://stackoverflow.com/comment/38743973
has text: I've got another small question. Do I really need to reset all fields of the `event` object?
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24931330

plugins
tags question: http://stackoverflow.com/q/24920179
tags question: http://stackoverflow.com/q/24986376
tags question: http://stackoverflow.com/q/25066290
tags question: http://stackoverflow.com/q/24997990
tags question: http://stackoverflow.com/q/24918810
tag name: plugins
type: Tag
tags question: http://stackoverflow.com/q/25045437

http://stackoverflow.com/a/46476976
has body: One of the ways to do this in using a List of Character and in java9 could be : List&lt;Character&gt; vowels = List.of('a','e','i','o','u'); // pverloaded convenience factory method for(int j=0 ; j &lt; str.length() ; j++) { if(vowels.contains(char[j])) { count++; } }
score: 0
answers question: http://stackoverflow.com/q/24977783
type: Answer

http://stackoverflow.com/comment/38803280
comment on: http://stackoverflow.com/q/24964204
has text: How do you know it's changing back? What method are you using to check the value of `selection`?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38823634
score: 0
has text: due to an error from me. I tried to use the codes wrong class. It was my fault. Other than that, no error in the code.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24931927

http://stackoverflow.com/q/24930136
has body: I'm a Java beginner and have a question similar to the ones here: Java, How to add library files in netbeans? and Caused By: java.lang.NoClassDefFoundError: org/apache/log4j/Logger I followed the answers given there, which were very good, but I still cannot solve my problem. I'm developing a plugin for GATE in Java using NetBeans 7. I have written this first, trial code: public class LoadGateDoc { public static void main(String[] args) throws Exception { Gate.init(); // prepare the library Factory.newDocument("This is a document"); // create a new doc } } But when I compile, I get the following error messages: Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/log4j/Logger at gate.Gate.&lt;clinit&gt;(Gate.java:83) at loadgatedoc.LoadGateDoc.main(LoadGateDoc.java:15) Caused by: java.lang.ClassNotFoundException: org.apache.log4j.Logger at java.net.URLClassLoader$1.run(URLClassLoader.java:366) at java.net.URLClassLoader$1.run(URLClassLoader.java:355) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:354) at java.lang.ClassLoader.loadClass(ClassLoader.java:425) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) at java.lang.ClassLoader.loadClass(ClassLoader.java:358) ... 2 more Java Result: 1 I have added the "commons-logging" as well as the "org/apache/log4j/Logger" libraries to the properties of my NetBeans project, but this doesn't help, I get the same error messages anyway. Can you please help me out?
has title: Developing GATE plugin in Java: org/apache/log4j/Logger error
type: Question
linked to: http://stackoverflow.com/q/5893349
has comment: http://stackoverflow.com/comment/38740034
has comment: http://stackoverflow.com/comment/38740704
upvote count: 1
has comment: http://stackoverflow.com/comment/38740850
tagged with: log4j
favorite count: 0
tagged with: netbeans
linked to: http://stackoverflow.com/q/20909446
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42323294
tagged with: gate
has comment: http://stackoverflow.com/comment/38780834
tagged with: logging
answer count: 0
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/38739028
tagged with: java

http://stackoverflow.com/a/25044009
upvote count: 4
downvote count: 0
has body: You should be able to surround a single argument with quotes ", and anything inside the quotes will be treated as a single argument value. java MyFile "some&amp;&amp;argument" "some-other-argument" anArgWithoutQuotes
score: 4
accepted answer of: http://stackoverflow.com/q/25043920
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25043920
has comment: http://stackoverflow.com/comment/38954319
type: Answer

http://stackoverflow.com/q/24991474
has comment: http://stackoverflow.com/comment/38856539
has comment: http://stackoverflow.com/comment/38857409
answer count: 2
has comment: http://stackoverflow.com/comment/38865217
has body: I have a pdf coordinate (x, y) as input . I need to draw a string at the given input coordinate[Eg :- (x,y)=(200,250)]. I am using pdfbox , When I am using the below method moveTextPositionByAmount I am not getting the exact position.Even i have tried with moveTo(). Please help me how to draw the string at an exact position ? PDPageContentStream contentStream = new PDPageContentStream(document, page,true,true); contentStream.beginText(); contentStream.setFont(PDType1Font.HELVETICA_BOLD, 12); contentStream.moveTextPositionByAmount(xindex, yindex); contentStream.setNonStrokingColor(color); contentStream.drawString(comment); contentStream.stroke(); contentStream.endText(); Thanks.
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/38857545
has comment: http://stackoverflow.com/comment/38866390
has comment: http://stackoverflow.com/comment/38860301
tagged with: http://stackoverflow.com/tag/pdf
has comment: http://stackoverflow.com/comment/38855379
has answer: http://stackoverflow.com/a/25029157
has title: How to draw a string at a specific position on a pdf page in java using pdfbox?
type: UnansweredQuestion
upvote count: 1
has comment: http://stackoverflow.com/comment/38858680
type: Question
has comment: http://stackoverflow.com/comment/38861921
has answer: http://stackoverflow.com/a/24992794
score: 1
has comment: http://stackoverflow.com/comment/38855029
tagged with: java
tagged with: pdfbox
has comment: http://stackoverflow.com/comment/38857040

http://stackoverflow.com/a/24941539
has comment: http://stackoverflow.com/comment/97045906
accepted answer of: http://stackoverflow.com/q/24941388
answers question: http://stackoverflow.com/q/24941388
has comment: http://stackoverflow.com/comment/82558284
has body: No, there is not. But, according to Java Docs: Conversions denoted by an upper-case character (i.e. 'B', 'H', 'S', 'C', 'X', 'E', 'G', 'A', and 'T') are the same as those for the corresponding lower-case conversion characters except that the result is converted to upper case according to the rules of the prevailing Locale. The result is equivalent to the following invocation of String.toUpperCase() In other words, the following String result = String.format("%S", "Hi James!"); is equivalent to String result = String.format("%s", "Hi James!").toUpperCase(); So, if you want to get a lower case string, you can just do: String result = String.format("%s", "Hi James!").toLowerCase(); There won't be an optimization by doing the conversion using a flag.
type: AcceptedAnswer
downvote count: 0
upvote count: 30
type: Answer
score: 30

http://stackoverflow.com/q/24938283
answer count: 2
has comment: http://stackoverflow.com/comment/38754298
has title: Why is the following piece of code in Java shows error while I try to set a name for an object of a String class?
has answer: http://stackoverflow.com/a/24938380
has answer: http://stackoverflow.com/a/24938329
type: UnansweredQuestion
has body: The following piece of code shows error while I try to set a name for an object of a String class. I have created an object of ArrayList class and a String class of my own but the method setName(String name) does not seem to work. It is showing error. Here is the code. import java.util.ArrayList; public class testStringClass { public static void main(String[]args) { ArrayList arr= new ArrayList(); String[]s=new String[5]; for(int i=0;i&lt;s.length;i++) { s[i]=new String(); } s[0].setName("Raiyan"); //Here error shows for(int i=0;i&lt;s.length;i++) { arr.add(s[i]); } } } class String { String name; String(String name) { this.name=name; } String() { this(null); } public String getName() { return this.name; } public void setName(String name) { this.name=name; } }
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/38754400
score: 0

http://stackoverflow.com/comment/38918054
has text: They don't. They have options, such as greater than some value. They enter the value and the bounds will be [value, infinity).
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25025031

http://stackoverflow.com/comment/38878170
score: 1
has text: if u try to add the annotation: @XmlElementWrapper to your List it should be represented as empty
comment on: http://stackoverflow.com/q/25003891
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38955257
comment on: http://stackoverflow.com/a/25044871
type: Comment
type: AnswerComment
score: 0
has text: @user3218114 Can you please send me a link to that reference?

http://stackoverflow.com/q/24970039
favorite count: 0
upvote count: 2
has comment: http://stackoverflow.com/comment/38814008
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/3273834
tagged with: android
score: 2
has title: Making Object from getItem() and accessing the fields
tagged with: java
has answer: http://stackoverflow.com/a/24970401
has comment: http://stackoverflow.com/comment/38813835
has comment: http://stackoverflow.com/comment/38814152
type: Question
has body: I have a list listview in my code that contains 2 buttons and 2 TextViews. I want to access the text of each textView by Clicking on buttons. here is the code of the adapter... public class TracksAdapter extends SimpleAdapter { public TracksAdapter(Context context, List&lt;? extends Map&lt;String, ?&gt;&gt; data, int resource, String[] from, int[] to) { super(context, data, resource, from, to); } @Override public View getView(final int position, View convertView, ViewGroup parent) { final TracksAdapter proxy = this; final View trackView = super.getView(position, convertView, parent); Button dl = (Button) trackView.findViewById(R.id.dl); dl.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { // Do something with data : proxy.getItem(position) TextView tv = (TextView) trackView.findViewById(R.id.track); String track = tv.getText().toString(); Toast.makeText(getApplicationContext() , track , Toast.LENGTH_LONG); } }); Button play = (Button) trackView.findViewById(R.id.play); play.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { // Do something with data : proxy.getItem(position) Toast.makeText(getApplicationContext() , String.valueOf(proxy.getItem(position)).indexOf("file=") , Toast.LENGTH_LONG); } }); return trackView; } } the result of proxy.getItem(position) is something like {id=4 , name=foo , track=fofoo} what should I do to access 'foo' ????
has comment: http://stackoverflow.com/comment/38814164
has comment: http://stackoverflow.com/comment/38813891
has comment: http://stackoverflow.com/comment/38813938
downvote count: 0
answer count: 1

http://stackoverflow.com/comment/38829624
type: Comment
has text: What error do you get? Are we supposed to guess?
type: QuestionComment
comment on: http://stackoverflow.com/q/24978382
score: 0

http://stackoverflow.com/comment/38894697
comment on: http://stackoverflow.com/q/25012893
type: Comment
type: QuestionComment
score: 2
has text: where is `time` initialized? This `time = f.getTextView()` failed?

http://stackoverflow.com/q/25029779
type: Question
answer count: 1
downvote count: 0
has body: I have a standard gradle java project. My tests need to both read and output files to the filesystem. The files should exist within the project directory only and the output files should be automatically deleted when the gradle project is cleaned. Gradle seems to have conventional directories for source files and test source files. What is the conventional relative path that should be used to place input and output files used and generated by the test code.
favorite count: 0
has answer: http://stackoverflow.com/a/25030784
type: UnansweredQuestion
score: 1
tagged with: java
upvote count: 1
tagged with: gradle
has title: Conventional file system path for gradle test files
tagged with: unit-testing

http://stackoverflow.com/comment/38931229
type: QuestionComment
has text: possible duplicate of [Java serialization - java.io.InvalidClassException local class incompatible](http://stackoverflow.com/questions/8335813/java-serialization-java-io-invalidclassexception-local-class-incompatible)
comment on: http://stackoverflow.com/q/25032361
score: 0
type: Comment

http://stackoverflow.com/comment/38806163
comment on: http://stackoverflow.com/q/24965825
score: 0
type: Comment
type: QuestionComment
has text: If you uncomment your log statement in your `onClick()` does the log appear?

http://stackoverflow.com/comment/38929462
score: 0
has text: your activity is recreated or you are managing the rotation?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25031159

http://stackoverflow.com/q/24978231
has comment: http://stackoverflow.com/comment/38829266
score: 0
has comment: http://stackoverflow.com/comment/38829321
has comment: http://stackoverflow.com/comment/38829238
answer count: 1
has comment: http://stackoverflow.com/comment/38829346
tagged with: android
has body: Hello i am making a simple push button in android and this is my mainactivity file package dk.troll.android; import android.app.Activity; import android.content.Intent; import android.net.Uri; import android.os.Bundle; import android.widget.Button; import android.view.View; import android.view.View.OnClickListener; public class MainActivity extends Activity { Button button; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); addListenerOnButton(); } public void addListenerOnButton() { button = (Button) findViewById(R.id.button1); button.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.troll.dk")); startActivity(browserIntent); } }); } } and this is my xml file &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" &gt; &lt;TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="Lorem Ipsum and so much other stuff" /&gt; &lt;Button android:id="@+id/button1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Button - Go To Troll" /&gt; &lt;/LinearLayout&gt; On this line button = (Button) findViewById(R.id.button1); i get the error cannot find symbol:variable id location:class R Since the contents of class r are auto-generated,how can i fix the error?
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38832282
has comment: http://stackoverflow.com/comment/38829261
has answer: http://stackoverflow.com/a/24978685
accepted answer: http://stackoverflow.com/a/24978685
type: Question
tagged with: java
has title: Cannot find symbol id in button
has comment: http://stackoverflow.com/comment/38829235

morphia
tag name: morphia
tags question: http://stackoverflow.com/q/24948851
type: Tag
tags question: http://stackoverflow.com/q/25048048

http://stackoverflow.com/comment/38728454
comment on: http://stackoverflow.com/a/24923948
type: Comment
type: AnswerComment
has text: of course! if do you have a better example please put it here!
score: 0

http://stackoverflow.com/comment/38833678
score: 0
comment on: http://stackoverflow.com/q/24979583
type: Comment
type: QuestionComment
has text: (But don't forget to accept the ansert!) (the green checkmark left to the correct answer's rating)

http://stackoverflow.com/comment/38931469
type: Comment
comment on: http://stackoverflow.com/a/25032441
type: AnswerComment
has text: Please, argument your "minus".
score: 0

http://stackoverflow.com/a/26446115
answers question: http://stackoverflow.com/q/25051329
has body: Your client code is running in a different JVM other than the server's. What you need is very simple. You need to modify your code to start the initial context with properties of the server and not local. Take a look at this link here for more details on how to do this: http://docs.oracle.com/javase/jndi/tutorial/basics/prepare/initial.html You'll need to change the following values according to your environment, provider URL and context factory. The provider URL is where your server is with an IIOP port (refer to your server settings to get the port). Check the server's documentations for the conetxt factory (sorry have no idea about exact values for JBoss). Hope this helps.
downvote count: 0
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/comment/69711291
type: Comment
comment on: http://stackoverflow.com/a/24910575
score: 0
has text: Your question is certainly not about the task queue, which can scale quite far (500/s per queue, sharded across dozens of queues...). The bigger question is how many updates per second can you make to a search index. That I do not know.
type: AnswerComment

http://stackoverflow.com/comment/38857027
comment on: http://stackoverflow.com/q/24990331
has text: Maybe you could try to use full path of clish because jsch do not load your profile or bashrc files.
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38735422
comment on: http://stackoverflow.com/q/24927826
has text: Are you trying to display an image on your frame?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24984437
has title: According to Eclipse, why is the standard jar file extension ".jar;*.zip"?
score: 1
tagged with: java
tagged with: eclipse
has body: I tried to export a runnable Jar, and Eclipse said: You have used the extension ".jar" at the end of the name. The standard extension is ".jar;*.zip". You can choose to use the standard extension instead. [Use .jar;*.zip] [Cancel] [Use .jar] (See screenshot below.) Is there some sort of massive misunderstanding on my part here? Because ".jar;*.zip" really does not sound like a file extension to me. Why would it (Eclipse Luna 4.4.0) not want me to save it (a standard Java program) as a .jar? Just to be clear, it lets me and everything works, but why the warning?
has comment: http://stackoverflow.com/comment/38841468
answer count: 1
tagged with: jar
downvote count: 0
has answer: http://stackoverflow.com/a/25207142
has comment: http://stackoverflow.com/comment/38842383
favorite count: 0
has comment: http://stackoverflow.com/comment/38881021
has comment: http://stackoverflow.com/comment/38846073
has comment: http://stackoverflow.com/comment/38841069
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25207142
tagged with: file-extension
has comment: http://stackoverflow.com/comment/38841233
has comment: http://stackoverflow.com/comment/38883173
has comment: http://stackoverflow.com/comment/38841177
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/38841677

http://stackoverflow.com/comment/38715155
comment on: http://stackoverflow.com/a/24917126
has text: @DmitryFucintv Sure, I'll try to hunt through [here](http://docs.oracle.com/javase/specs/jls/se8/html/jls-18.html) later today. I can't remember the exact section of the top of my head. I hope it's at least clear why the inferred type doesn't matter, as long as it's valid.
type: AnswerComment
type: Comment
score: 1

jboss
tags question: http://stackoverflow.com/q/25015338
tags question: http://stackoverflow.com/q/24911625
tags question: http://stackoverflow.com/q/25046317
tags question: http://stackoverflow.com/q/24910771
tags question: http://stackoverflow.com/q/25023982
tags question: http://stackoverflow.com/q/24986500
tags question: http://stackoverflow.com/q/25031410
tags question: http://stackoverflow.com/q/24995598
tag name: jboss
tags question: http://stackoverflow.com/q/25048280
tags question: http://stackoverflow.com/q/24932056
tags question: http://stackoverflow.com/q/24928254
tags question: http://stackoverflow.com/q/25011613
tags question: http://stackoverflow.com/q/24939212
tags question: http://stackoverflow.com/q/25034772
tags question: http://stackoverflow.com/q/25044416
tags question: http://stackoverflow.com/q/24994358
type: Tag
tags question: http://stackoverflow.com/q/25015270
tags question: http://stackoverflow.com/q/25024446
tags question: http://stackoverflow.com/q/24995291
tags question: http://stackoverflow.com/q/24910524
tags question: http://stackoverflow.com/q/24963450
tags question: http://stackoverflow.com/q/25051329
tags question: http://stackoverflow.com/q/25058715
tags question: http://stackoverflow.com/q/25039129
tags question: http://stackoverflow.com/q/24944146
tags question: http://stackoverflow.com/q/25000113
tags question: http://stackoverflow.com/q/24991865
tags question: http://stackoverflow.com/q/25009834
tags question: http://stackoverflow.com/q/25059555

android-cursoradapter
type: Tag
tags question: http://stackoverflow.com/q/24993266
tag name: android-cursoradapter

http://stackoverflow.com/comment/38756064
score: 1
has text: Could you add some info please? Namely the (unparsable?) Part of the pom, maven version, the exact error ?
comment on: http://stackoverflow.com/q/24937585
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25406707
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: Try this: Create a fragment for single menu item as menuFragment.html Include the fragment in your menu file as rootMenuItemAsList is a list with your parent menu Hope this help will you
upvote count: 3
has comment: http://stackoverflow.com/comment/103685673
score: 3
answers question: http://stackoverflow.com/q/25032838
accepted answer of: http://stackoverflow.com/q/25032838

http://stackoverflow.com/q/25013776
has body: The xml looks like below mentioned format and the name is "song.xml" 1 sony 4 shal 5 eminem 2 cent The java bean class looks like below mentioned. Its name is "song.java" Class song { Public String id= null; Public String title= null; public int getid() { return id; } public void setid(int songNumber) { this.id = songNumber; } public int gettitle() { return title; } public void setid(String songTitle) { this.title = songTitle; } } My question is how can i parse the xml and set the value to the java bean?
tagged with: android
tagged with: http://stackoverflow.com/tag/xml
answer count: 0
linked to: http://stackoverflow.com/q/5827713
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38896321
tagged with: java
has comment: http://stackoverflow.com/comment/38896540
type: Question
score: 0
duplicate of: http://stackoverflow.com/q/5827713
has title: How to read values from xml and set it to bean in java?

http://stackoverflow.com/comment/38928859
type: AnswerComment
score: 0
type: Comment
has text: I know, I can deploy these artifacts in a private nexus server to share with my team. But what I need to do now is write unit tests and upgrade versions to latest ones.
comment on: http://stackoverflow.com/a/24953400

http://stackoverflow.com/comment/38763189
has text: Ok, I see. I cannot answer this one, but if you update your question you'll have more chances to see it answered.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/24942674
type: QuestionComment

http://stackoverflow.com/comment/38932478
has text: CXF just logs a warning if that policy is missing. Previously it threw an error. Start by enabling logging + looking at what the client -> STS message and response looks like. Is the STS processing the request successfully or not?
type: Comment
comment on: http://stackoverflow.com/a/24992013
score: 0
type: AnswerComment

http://stackoverflow.com/comment/38814462
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24970395
type: Comment
has text: But how will i catch the exceptions if i just use throws clause with the function?

http://stackoverflow.com/q/25000029
answer count: 1
has comment: http://stackoverflow.com/comment/38870422
has comment: http://stackoverflow.com/comment/38870514
favorite count: 0
downvote count: 2
has answer: http://stackoverflow.com/a/25000591
upvote count: 1
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/38870280
score: -1
type: Question
has comment: http://stackoverflow.com/comment/38870350
accepted answer: http://stackoverflow.com/a/25000591
has title: Display Custom listview from "List"
has comment: http://stackoverflow.com/comment/38871236
has comment: http://stackoverflow.com/comment/38870649
has body: I am using this type of data structure static List&lt;String&gt; displaypart = new ArrayList&lt;String&gt;(); static List&lt;String&gt; displayitalic = new ArrayList&lt;String&gt;(); static List&lt;String&gt; displayA_name = new ArrayList&lt;String&gt;(); static List&lt;String&gt; displayAS_name = new ArrayList&lt;String&gt;(); I have added their values as string from database by this code String strquery="select * from Articles where AS_name LIKE '%"+querytext+"%'"; cur=db.rawQuery(strquery,null); if(cur!=null&amp;&amp;cur.moveToFirst()) { do { Flag.displaypart.add(cur.getString(7)); Flag.displayA_name.add(cur.getString(2)); Flag.displayitalic.add(cur.getString(8)); Flag.displayAS_name.add(cur.getString(3)); Flag.displayDesc_art.add(cur.getString(4)); i++; } while(cur.moveToNext()); } } My requirement is to show these data in listview. Each cell consists of 4 textviews. For that I made query_cell.xml &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:background="#FFFFFF" android:orientation="vertical" android:id="@+id/querylinearlayout"&gt; &lt;TextView android:id="@+id/textView1" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="Large Text" android:gravity="center" android:textAppearance="?android:attr/textAppearanceLarge" /&gt; &lt;TextView android:id="@+id/textView2" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="Medium Text" android:gravity="center" android:textAppearance="?android:attr/textAppearanceMedium" /&gt; &lt;TextView android:id="@+id/textView3" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="Small Text" android:gravity="center" android:textAppearance="?android:attr/textAppearanceSmall" /&gt; &lt;TextView android:id="@+id/textView4" android:layout_width="match_parent" android:layout_height=…
tagged with: android-listview
tagged with: android

http://stackoverflow.com/comment/38700078
has text: Glad it helped you, have fun coding :)
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24909646

http://stackoverflow.com/a/65770818
answers question: http://stackoverflow.com/q/24957920
score: 0
type: Answer
has body: This can be done in MYSQL database: This code takes a JSON input string and automatically generates SQL Server CREATE TABLE statements to make it easier to convert serialized data into a database schema. It is not perfect, but should provide a decent starting point when starting to work with new JSON files. SET NOCOUNT ON; DECLARE @JsonData nvarchar(max) = ' { "Id" : 1, "IsActive":true, "Ratio": 1.25, "ActivityArray":[true,false,true], "People" : ["Jim","Joan","John","Jeff"], "Places" : [{"State":"Connecticut", "Capitol":"Hartford", "IsExpensive":true},{"State":"Ohio","Capitol":"Columbus","MajorCities":["Cleveland","Cincinnati"]}], "Thing" : { "Type":"Foo", "Value" : "Bar" }, "Created_At":"2018-04-18T21:25:48Z" }', @RootTableName nvarchar(4000) = N'AppInstance', @Schema nvarchar(128) = N'dbo', @DefaultStringPadding smallint = 20; DROP TABLE IF EXISTS ##parsedJson; WITH jsonRoot AS ( SELECT 0 as parentLevel, CONVERT(nvarchar(4000),NULL) COLLATE Latin1_General_BIN2 as parentTableName, 0 AS [level], [type] , @RootTableName COLLATE Latin1_General_BIN2 AS TableName, [key] COLLATE Latin1_General_BIN2 as ColumnName, [value], ROW_NUMBER() OVER (ORDER BY (SELECT 1)) AS ColumnSequence FROM OPENJSON(@JsonData, '$') UNION ALL SELECT jsonRoot.[level] as parentLevel, CONVERT(nvarchar(4000),jsonRoot.TableName) COLLATE Latin1_General_BIN2, jsonRoot.[level]+1, d.[type], CASE WHEN jsonRoot.[type] IN (4,5) THEN CONVERT(nvarchar(4000),jsonRoot.ColumnName) ELSE jsonRoot.TableName END COLLATE Latin1_General_BIN2, CASE WHEN jsonRoot.[type] IN (4) THEN jsonRoot.ColumnName ELSE d.[key] END, d.[value], ROW_NUMBER() OVER (ORDER BY (SELECT 1)) AS ColumnSequence FROM jsonRoot CROSS APPLY OPENJSON(jsonRoot.[value], '$') d WHERE jsonRoot.[type] IN (4,5) ), IdRows AS ( SELECT -2 as parentLevel, null as parentTableName, -1 as [level], null as [type], TableName as Tablename, TableName+'Id' as columnName, null as [value], 0 as columnsequence FROM (SELECT DISTINCT tablename FROM jsonRoot) j ), FKRows …

http://stackoverflow.com/q/25061162
answer count: 1
downvote count: 0
favorite count: 0
has body: I am trying to set up an automatic build system with Jenkins CI for a NetBeans multitiered web application project. This NetBeans project contains an EJB-project (for the business layer of the web application) and a WAR-project (for the web layer of the application). I'm currently stuck on getting Ant to compile the project. I am using Windows 8 to develop in NetBeans IDE 8.0. Jenkins also runs on Windows 8. I'm currently looking for someone who understands how to build EJB-projects with Jenkins and Ant. What I've done so far: I've set up a NetBeans project (as described above) I've set up a git repository for the project I've set up Jenkins CI I am able to get the project from the git repository with Jenkins CI I am able to make Jenkins use Ant to clean the project it retrieved from the git repository Where I get stuck: After being succesful to execute the clean command with Ant I want to make the debug command work. For this the project needs to be compiled. Here is where it goes wrong. I entered the following properties in the Properties field for the Ant Invoke in Jenkins: libs.CopyLibs.classpath=C:/Program Files/NetBeans 8.0/java/ant/extra/org-netbeans-modules-java-j2seproject-copylibstask.jar j2ee.server.home=C:/Program Files/wildfly-8.1.0.Final In the output of my Jenkins build I see the following command: [PGB Webapp] $ cmd.exe /C '""C:\Program Files (x86)\Jenkins\tools\hudson.tasks.Ant_AntInstallation\Apache_Ant\bin\ant.bat" "-Dlibs.CopyLibs.classpath=C:/Program Files/NetBeans 8.0/java/ant/extra/org-netbeans-modules-java-j2seproject-copylibstask.jar" "-Dj2ee.server.home=C:/Program Files/wildfly-8.1.0.Final" clean debug &amp;&amp; exit %%ERRORLEVEL%%"' And this is the last part of my output: (the part that seems most important to me) init: -init-cos: -deps-module-jar: -deps-ear-jar: deps-jar: -pre-pre-compile: [mkdir] Created dir: C:\Program Files (x86)\Jenkins\workspace\PGB Webapp\pgb-ejb\build\classes -pre-compile: -copy-meta-inf: [copy] Copying 2 files to…
linked to: http://stackoverflow.com/q/18138387
has title: How do I fix this: Ant cannot "find file" when trying to build a Java web application on Jenkins?
tagged with: netbeans
score: 2
tagged with: jenkins
upvote count: 2
has answer: http://stackoverflow.com/a/25062103
type: Question
type: AnsweredQuestion
tagged with: ant
tagged with: java
tagged with: ejb
accepted answer: http://stackoverflow.com/a/25062103

http://stackoverflow.com/q/24944678
tagged with: arraylist
score: 0
has title: Transfering values from an object in a ArrayList to an array sudoku board
has body: I will explain you my problem: I need to fill this grid: static int board[][]=new int[][] {{0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0}}; But I want to be able to transfert the values inside my arraylist objet (ligne,colone,valeur): Case case1=new Case(ligne, colone, valeur); monArrayCase.add(case1); I've already made a scanner and a print to verify that my arraylist number are added and that working... My main problem is that I printing this : System.out.println(Sudoku.board[ligne-1][colone-1]=valeur); I can add number but I can't delete them...Maybe cause I am doing it in the array...Is there an way to print the value from my arraylist object on the grill?Thank in advance.
has comment: http://stackoverflow.com/comment/38768702
tagged with: sudoku
type: Question
has answer: http://stackoverflow.com/a/24947699
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24947699
has comment: http://stackoverflow.com/comment/38772838
tagged with: java
has comment: http://stackoverflow.com/comment/38773139
tagged with: printing
tagged with: arrays
answer count: 1

http://stackoverflow.com/q/24986101
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38844644
has comment: http://stackoverflow.com/comment/38845008
has comment: http://stackoverflow.com/comment/38844810
tagged with: string
accepted answer: http://stackoverflow.com/a/24986671
has comment: http://stackoverflow.com/comment/38844965
has comment: http://stackoverflow.com/comment/38844835
favorite count: 0
has comment: http://stackoverflow.com/comment/38844603
has comment: http://stackoverflow.com/comment/38845004
has comment: http://stackoverflow.com/comment/38844848
has comment: http://stackoverflow.com/comment/38844588
type: Question
upvote count: 2
answer count: 2
has comment: http://stackoverflow.com/comment/38844825
has comment: http://stackoverflow.com/comment/38844539
score: -1
tagged with: java
has title: How to Printout String look like Jagged array 3 elements at a time Java
downvote count: 3
has comment: http://stackoverflow.com/comment/38844669
has comment: http://stackoverflow.com/comment/38844568
has comment: http://stackoverflow.com/comment/38844470
has answer: http://stackoverflow.com/a/24986671
has comment: http://stackoverflow.com/comment/38844781
has comment: http://stackoverflow.com/comment/38844511
possible better answer: http://stackoverflow.com/a/24986694
has comment: http://stackoverflow.com/comment/38844957
has answer: http://stackoverflow.com/a/24986694
has comment: http://stackoverflow.com/comment/38844873
has comment: http://stackoverflow.com/comment/38844827
has comment: http://stackoverflow.com/comment/38844696
has body: Code: public static void main(String...args) { File file = new File("C:\\Users\\Izak\\Documents\\NetBeansProjects" + "\\ReadElements\\src\\readelements\\elements.txt"); String s = ""; try (Scanner input = new Scanner(file)) { input.useDelimiter("\\A"); if (input.hasNext()) { s = input.next(); } String[] splitedS = s.split("null"); for (int i = 0; i &lt; splitedS.length; i++) { System.out.print(splitedS[i]); } } catch (Exception e) { System.out.println(e); } } my elements.txt content: null null -5 160 2 null null null 75 80 1 75 160 0 null 75 320 1 null null 155 160 2 null null 235 0 1 235 80 2 235 160 1 null null my result so far: -5 160 2 75 80 1 75 160 0 75 320 1 &lt;--- String gets printout Like this on Screen 155 160 2 235 0 1 235 80 2 235 160 1 excepted result: -5 160 2 75 80 1 75 160 0 75 320 1 155 160 2 235 0 1 235 80 2 235 160 1 but I cannot manage to have my expected result. anyone can help me to solve this?
has comment: http://stackoverflow.com/comment/38845005
has comment: http://stackoverflow.com/comment/38844526
has comment: http://stackoverflow.com/comment/38844993

http://stackoverflow.com/q/24995206
tagged with: eclipse-plugin
tagged with: ternary-operator
has answer: http://stackoverflow.com/a/25031313
accepted answer: http://stackoverflow.com/a/25031313
type: AnsweredQuestion
tagged with: java
tagged with: eclipse-jdt
type: Question
has answer: http://stackoverflow.com/a/24995856
has comment: http://stackoverflow.com/comment/38861831
has comment: http://stackoverflow.com/comment/38861721
tagged with: eclipse
possible better answer: http://stackoverflow.com/a/24995856
score: 0
answer count: 2
has body: I already have several visitors implemented, e.g. for Assignments, ForStatements etc. But as it seems there is no convenient way to find ternary operators ( ? : ) in my Java projects? So is there any other way to find ternary expressions in my project?
has title: Eclipse plugin: How to find/parse ternary operator?

http://stackoverflow.com/a/25035415
type: Answer
downvote count: 0
has body: try this: codeArr[k].split(" (?=\\S)"); so that x 100 -&gt; {"x","100"} 100 -&gt; {" ","100"} 11 -&gt; {" ", "11"} (two spaces)
score: 2
answers question: http://stackoverflow.com/q/25035211
upvote count: 2
accepted answer of: http://stackoverflow.com/q/25035211
type: AcceptedAnswer

http://stackoverflow.com/a/41945223
downvote count: 0
score: 7
has comment: http://stackoverflow.com/comment/78277952
has comment: http://stackoverflow.com/comment/72299426
upvote count: 7
type: Answer
has body: The following configuration will create a new logfile (the file name will have a datestamp on it) and console output every time the program is run, please note that it does not use RollingFileAppender. For more information please refer to logback documentation https://logback.qos.ch/manual/configuration.html <timestamp key="bySecond" datePattern="yyyyMMdd'T'HHmmss"/> %d{HH:mm:ss} [%thread] %-5level %logger{36} - %msg%n logfile-${bySecond}.txt true %d{HH:mm:ss} [%thread] %-5level %logger{36} - %msg%n
answers question: http://stackoverflow.com/q/25045887

http://stackoverflow.com/q/24927731
accepted answer: http://stackoverflow.com/a/25011026
type: Question
downvote count: 0
has body: I'm writing an Android app which sends data in JSON format to a Django REST API running on a local server. It is an https connection to the server and all necessary certificates are integratted into the app. Bevore we've updated to Django 1.6 we were running on Django 1.4 and everything worked fine. Now with Django 1.6 the app is still able to get the CSRF token, to log in and to do a HttpGet request, which returns the expected JSON object. Only the HttpPost requests are rejected with 403 Forbidden. I searched through the web and only found out that the Cross Site Request Forgery protection could be a problem, but we are accessing the API via webbrowser and app, so I think it would be a security lack to turn it off. Here is what I do to start httpPost and HttpGet: After starting the app a HttpClient holding the server certificates is created, this one is than used for all get and post requests: private DefaultHttpClient createHttpClient(Context ctx) throws CertificateException, IOException, KeyStoreException, NoSuchAlgorithmException, KeyManagementException, UnrecoverableKeyException { SSLSocketFactory ssf = new SSLSocketFactory(keyStore); SchemeRegistry schemeRegistry = new SchemeRegistry(); // http scheme schemeRegistry.register(new Scheme("http", PlainSocketFactory.getSocketFactory(), 888)); // https scheme schemeRegistry.register(new Scheme("https", ssf, 443)); HttpParams params = new BasicHttpParams(); params.setParameter(HttpProtocolParams.USE_EXPECT_CONTINUE, true); HttpProtocolParams.setVersion(params, HttpVersion.HTTP_1_1); HttpProtocolParams.setContentCharset(params, "utf-8"); //ClientConnectionManager cm = // new ThreadSafeClientConnManager(params, schemeRegistry); ClientConnectionManager cm = new SingleClientConnManager(params, schemeRegistry); return new DefaultHttpClient(cm, params); } Then I send a get request to get the CSRF token and login afterwards: public static String openAuthStream(DefaultHttpClient httpClient, String u, String pw) throws Clien…
has title: Android http post request returns 403 after Django update to 1.6
answer count: 2
tagged with: http-post
score: 2
favorite count: 0
tagged with: django-csrf
upvote count: 2
possible better answer: http://stackoverflow.com/a/24928025
tagged with: android
has answer: http://stackoverflow.com/a/24928025
tagged with: django
has answer: http://stackoverflow.com/a/25011026
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/q/24950384
type: UnansweredQuestion
has body: I am facing a issue with struts2 framework. I want to get data of excel file in Action class from html form. but i am able to finding HttpServletRequest object to get inputStream of this request. I am also implementing ServletRequestAware interface in my Action class of Struts2. My code is being displayed in please............ import com.opensymphony.xwork2.Action; import com.opensymphony.xwork2.ActionSupport; import java.io.IOException; import javax.servlet.ServletInputStream; import javax.servlet.http.HttpServletRequest; import org.apache.struts2.interceptor.ServletRequestAware; import jxl.*; import jxl.read.biff.BiffException; public class UpdateZflexRecordsAction extends ActionSupport implements ServletRequestAware{ /** * */ private static final long serialVersionUID = 1L; private boolean result = false; private String status = null; private String msg = null; private ServletInputStream inputStream = null; private HttpServletRequest request = null; public String getStatus() { return status; } public void setStatus(String status) { this.status = status; } public String getMsg() { return msg; } public void setMsg(String msg) { this.msg = msg; } public String execute() { try { inputStream = getServletRequest().getInputStream(); byte[] junk = new byte[1024]; int bytesRead = 0; // strip off the HTTP information from input stream // the first four lines are request junk bytesRead = inputStream.readLine(junk, 0, junk.length); bytesRead = inputStream.readLine(junk, 0, junk.length); bytesRead = inputStream.readLine(junk, 0, junk.length); bytesRead = inputStream.readLine(junk, 0, junk.length); // create the workbook object from the ServletInputStream Workbook workbook = Workbook.getWorkbook(inputStream); Sheet sheet = workbook.getSheet(0); Cell cell = null; System.out.println(sheet.getName()); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (BiffException e) { // TODO Auto-generated catch block e.printStackTrace(); } if (result) {…
has title: Why am i not getting initialize HttpServletRequest object in Struts2 Action?
tagged with: java
type: Question
answer count: 1
tagged with: struts2
score: 0
has answer: http://stackoverflow.com/a/24950576

http://stackoverflow.com/comment/38888564
score: 0
type: AnswerComment
has text: yeppp!! thanks for the set command Jankie
type: Comment
comment on: http://stackoverflow.com/a/25009287

http://stackoverflow.com/comment/38881166
type: QuestionComment
comment on: http://stackoverflow.com/q/25005567
score: 0
type: Comment
has text: And that is not what i need... *Doesn't have the info im looking for*

http://stackoverflow.com/q/25023981
score: -1
has comment: http://stackoverflow.com/comment/38916137
linked to: http://stackoverflow.com/q/13818129
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/38916125
accepted answer: http://stackoverflow.com/a/25024142
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml
has body: I have a requirement where I have to extract parts of XML child nodes and use it to generate reports. Here is an example of the sample XML code : <C> <D> </D> <D> </D> </C> <C> <D> </D> </C> <C> </C> I want to extract all the elements with B as XML tag name and use that to create reports. Could someone please explain how we can extract all the elements . PS: These extracted elements should also have their child elements in it.
tagged with: extract
possible better answer: http://stackoverflow.com/a/25024094
downvote count: 2
has answer: http://stackoverflow.com/a/25024094
upvote count: 1
has answer: http://stackoverflow.com/a/25024142
type: AnsweredQuestion
tagged with: java
has title: Extracting child elements of an XML in Java

http://stackoverflow.com/q/24963869
tagged with: jsp
has body: I'm having a Spring MVC application here. When menu page is opened i'm putting two model attributes: menuList and orderList. menuList is filled with infos from database and orderList is empty list that i want to be full-filled when the client is going to submit the dynamic form. I know how to bind all the products from the menu in the order list but that would be waste... of many things. What i need to do is to check if the value or length of the dynamically appended input field "pieces", next to each and every product, is greater than 0. How can i do that? <c:url value="/menu/order" var="orderPath"/> <form:form action="${orderPath}" method="POST" modelAttribute="orderList"> Name Code Price Description Calories Image Pieces <c:set var="index" value="0" scope="page" /> <c:forEach items="${menuList}" var="menu" varStatus="i"> ${menu.name} ${menu.code} ${menu.price} ${menu.description} ${menu.calories} <img src="<c:url value="/images/${menu.image}" />" alt="" width=120> <!-- i need to take the "pieces" input field value here and check it if, lets say, the length is greater than 0 (or the value is greater than 0) and to make data binding only in those situations I saw something like <c:if test="${param.pieces}>0"> but that's not working or maybe i'm doing some kind of mistake, i don't know --> <form:hidden path="orderList[${index}].orderID"/> <form:hidden path="orderList[${index}].menuID" value="${menu.menuID}"/> <form:hidden path="orderList[${index}].pieces" value="**value-of-pieces-input-field**"/> <c:set var="index" value="${index + 1}" scope="page" /> </c:forEach> </form:form>
score: 0
tagged with: http://stackoverflow.com/tag/html
answer count: 1
has answer: http://stackoverflow.com/a/24972730
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38815489
tagged with: java
has comment: http://stackoverflow.com/comment/38803118
type: Question
tagged with: jstl
has title: Ho to get the HTTP input field value and use it to do some tests using c:if

http://stackoverflow.com/q/24914581
downvote count: 6
has comment: http://stackoverflow.com/comment/38709732
favorite count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/38709687
score: -6
upvote count: 0
type: UnansweredQuestion
has title: i got error message locating in a line, but i cannot figure it out why it is wrong
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/24914841
has body: i got error message locating in this line "radiusToSelect[p*(p-1)/2+q]=distanceBetweenParticles[p][q];", but i cannot figure it out why it is wrong. java code is following, really appreciation for your help. this is the error message "2.04.02.06.04.02.08.0Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 6 at javaAndR.soswarm.main(soswarm.java:59)" public static void main(String[]args) { double [][] score=new double [40][4]; double [][] id=new double [1000][4]; int row, column; int [][] bmu=new int[id.length][1]; double [][] shortestdistance=new double [id.length][1]; double [][] distance=new double[id.length][score.length]; double [][] distanceBetweenParticles= new double[score.length][score.length]; double[] radiusToSelect=new double [(score[1].length-1)*(score[1].length)/2]; for(row=0;row&lt;score.length;row++) { for(column=0;column&lt;score[row].length;column++) { score[row][column]=row+column; } System.out.print("\n"); } for (int i =0;i&lt;id.length;i++) { for(int j=0;j&lt;id[row].length;j++) { id[i][j]=i*j; //System.out.print(id[i][j]+" "); } //System.out.print("\n"); } for (int p=1;p&lt;score.length;p++) { for(int q=0;q&lt;p;q++) { distanceBetweenParticles[p][q]=distance(score[p][0],score[p][1],score[p][2],score[p][3],score[q][0],score[q][1],score[q][2],score[q][3]); System.out.print(distanceBetweenParticles[p][q]); radiusToSelect[p*(p-1)/2+q]=distanceBetweenParticles[p][q]; } } int first; double temp; for (int a = radiusToSelect.length - 1; a &gt; 0; a--) { first = 0; //initialize to subscript of first element for(int b = 1; b &lt;= a; b ++) //locate smallest element between positions 1 and i. { if( radiusToSelect[ b ] &lt; radiusToSelect[ first ] ) first = b; } temp = radiusToSelect[first]; //swap smallest found with element in position i. radiusToSelect[ first ] = radiusToSelect[ a ]; radiusToSelect[ a ] = temp; } double radius=radiusToSelect[((int) radiusToSelect.length*2/3)]; System.out.println(radius+" "+"\n"); for(int ite=0;ite&lt;10…

http://stackoverflow.com/q/25029272
upvote count: 1
has answer: http://stackoverflow.com/a/25029352
downvote count: 1
has comment: http://stackoverflow.com/comment/38925677
has comment: http://stackoverflow.com/comment/38925680
answer count: 4
has comment: http://stackoverflow.com/comment/38925600
has comment: http://stackoverflow.com/comment/38925618
has answer: http://stackoverflow.com/a/25029329
has title: Error: missing return value in Java
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38925621
tagged with: java
tagged with: methods
type: Question
has body: So I've built a method to find prime numbers. It seems to work only when i forcible mark it as true. However when I leave it as I would like it, the compiler disagrees. How do I satisfy the missing return value error? private static boolean isPrime( int n) // write a loop that sets a loop variable named divisor that goes from 2 to n/2 // in the loop call isFactor to see if divisor divides n evenly // if it does print out that divisor followed by a space (no newline) { for (int divisor = 2; divisor &lt;= n; divisor++) { boolean prime = true; for (int i = 2; i &lt; divisor; i++) { if (isFactor(n, divisor)) { return false; } } } return true; // i just put this here so it would compile at all }
has comment: http://stackoverflow.com/comment/38925570
has comment: http://stackoverflow.com/comment/38925676
has answer: http://stackoverflow.com/a/25029401
accepted answer: http://stackoverflow.com/a/25029352
has comment: http://stackoverflow.com/comment/38925598
favorite count: 0
possible better answer: http://stackoverflow.com/a/25029340
score: 0
has answer: http://stackoverflow.com/a/25029340

http://stackoverflow.com/q/24941479
answer count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/38760574
favorite count: 0
has comment: http://stackoverflow.com/comment/38760608
type: UnansweredQuestion
has body: I'm writing a simple program to calculate the gross income of an employee. I'm reading an input file, then calculating the gross income. For some reason it only calculates the regular time, but not the overtime. I'm trying to nest an if then else inside a while loop. Any advice would be great, thanks! public static void main(String[] args) { InputFile payroll; payroll = new InputFile("payroll.txt"); String name, hours, payrate; Double p, h, finalpay; DecimalFormat numFormat; numFormat = new DecimalFormat("0.00"); while(!payroll.eof()) { name = payroll.readString(); hours = payroll.readWord(); payrate = payroll.readWord(); p = Double.parseDouble(payrate); h = Double.parseDouble(hours); if ( h &gt; 40) { finalpay = (p * 40) + (( (h - 40) * 1.5) * p ); System.out.println(name + " " + "gross pay is: " + numFormat.format(finalpay)); } else { finalpay = (p * h); System.out.println(name + " " + "gross pay is: " + numFormat.format(finalpay)); } } } }
score: 1
tagged with: java
type: Question
upvote count: 2
has comment: http://stackoverflow.com/comment/38760705
has title: Java, calculating gross income by nesting an if then else inside a while loop
has answer: http://stackoverflow.com/a/24941596
has comment: http://stackoverflow.com/comment/38760665
has comment: http://stackoverflow.com/comment/38760675
has comment: http://stackoverflow.com/comment/38760692

http://stackoverflow.com/q/24975100
tagged with: clojurescript
has title: Why can't I extend Clojure's IFn using extend-type?
tagged with: clojure
has body: I saw David Nolen's talk on ClojureScript where he makes extends IFn to Regexp and so that we can call a regex literal as a fuinction on a string to check for matches. I tried something similar with Strings in regular Clojure, but I get this exception. I see that IFn is an interface written in Java but how does the implementation work in CLojrue front. (extend-type java.lang.String #_=&gt; clojure.lang.IFn #_=&gt; (-invoke #_=&gt; ([this index] #_=&gt; (get (seq this) index)))) IllegalArgumentException interface clojure.lang.IFn is not a protocol clojure.core/extend (core_deftype.clj:742)
type: AnsweredQuestion
downvote count: 0
tagged with: java
upvote count: 8
type: Question
accepted answer: http://stackoverflow.com/a/24975230
has answer: http://stackoverflow.com/a/24975230
answer count: 1
score: 8
favorite count: 0

http://stackoverflow.com/q/25032813
type: Question
has answer: http://stackoverflow.com/a/25033043
tagged with: hashmap
has comment: http://stackoverflow.com/comment/38932002
tagged with: data-structures
tagged with: arraylist
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/38933460
has comment: http://stackoverflow.com/comment/38931997
has body: I want to use some set of data from ArrayList. I have 2 approach for storing data in ArrayList. 1st Approach : private ArrayList&lt;HashMap&lt;String, String&gt;&gt; showList = new ArrayList&lt;HashMap&lt;String, String&gt;&gt;(); and Where HashMap structure is HashMap&lt;String, String&gt; map = new HashMap&lt;String, String&gt;(); map.put("title","Mytitle"); map.put("Description", "MyDescription for show"); 2nd Approach: private ArrayList&lt;DataProvider&gt; showList = new ArrayList&lt;DataProvider&gt;(); and the DataProvider is public class DataProvider{ public String title = ""; public String description = ""; public void setTitle(String mTit){ title = mTit; } public void setDescription(String mDec){ description = mDec; }public String getTitle(){ return title ; }public String getDescription(){ return description; } I know how to store and retrieve the data form ArrayList. I want to know which one will perform better and faster.
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25032990
has comment: http://stackoverflow.com/comment/38932183
has comment: http://stackoverflow.com/comment/38932169
has comment: http://stackoverflow.com/comment/38932342
has comment: http://stackoverflow.com/comment/38932336
has comment: http://stackoverflow.com/comment/38932374
tagged with: java
has title: ArrayList with HashMap Vs ArrayList with Class
has comment: http://stackoverflow.com/comment/38932044
has answer: http://stackoverflow.com/a/25033298

http://stackoverflow.com/comment/38843814
type: QuestionComment
score: 0
has text: `T[] tempHeap = (T[]) new Object[capacity];` this can't be right
comment on: http://stackoverflow.com/q/24985893
type: Comment

tabs
type: Tag
tag name: tabs
tags question: http://stackoverflow.com/q/24983978

http://stackoverflow.com/a/25030432
has comment: http://stackoverflow.com/comment/38945403
score: 4
upvote count: 4
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/25024694
answers question: http://stackoverflow.com/q/25024694
has body: Check if the test/resources is added as classpath. You can verify in eclipse IDE as follows. Right click on the project ->properties->java build path -> in Sources tab you should find {proejct}/src/test/resources (with option included all.) If you cannot find the option you can manually add the directory or you can configure pom.xml as follows ${basedir}/src/test/resources

http://stackoverflow.com/comment/38738198
score: 0
type: Comment
comment on: http://stackoverflow.com/q/24929207
type: QuestionComment
has text: Do you have access to any other applications running on your tomcat server?

http://stackoverflow.com/comment/38861116
type: Comment
type: QuestionComment
has text: Are you sure your XML configuration is being read in correctly to the mapper before use?
comment on: http://stackoverflow.com/q/24995207
score: 0

http://stackoverflow.com/q/25042364
tagged with: java
has comment: http://stackoverflow.com/comment/64176700
tagged with: robolectric
type: Question
has answer: http://stackoverflow.com/a/25043340
has comment: http://stackoverflow.com/comment/38950251
answer count: 2
tagged with: junit
downvote count: 0
has answer: http://stackoverflow.com/a/43887678
has comment: http://stackoverflow.com/comment/38950396
has body: I have a parameterized test class with an enum member as parameter. public enum MyEnum { A, B } This is the significant part of the test class: @ParameterizedRobolectricTestRunner.Parameters public static Collection&lt;Object[]&gt; data() { return Arrays.asList(new Object[][] { {MyEnum.A} }); } public MyTestClass(MyEnum value) { } When running the tests, I get this exception: java.lang.IllegalArgumentException: argument type mismatch If I change the constructor to public MyTestClass(Object value) { MyEnum x = (MyEnum)value; } I get this exception: java.lang.ClassCastException: com.test.MyEnum cannot be cast to com.test.MyEnum Can anybody tell me whats going on there? Especially the second case seems totally strange. I'm mainly a C# developer, so maybe this is special case in Java? If I use other data types like Integer it works fine. Thanks for helping! Edit: The enum has actually 8 members, I just changed it here. Also, the constructor has more than one parameter, I just simplified the example. The type of value is correctly com.test.MyEnum Edit2: The ParameterizedRobolectricTestRunner is the problem. If I use the (standard) Parameterized TestRunner, everything works fine. In this special case it is ok, since I don't test UI. But when testing UI, the problem would still occur.
score: 8
favorite count: 0
has comment: http://stackoverflow.com/comment/38950253
upvote count: 8
type: UnansweredQuestion
has title: Exception when using an enum member in parameterized test class with JUnit

http://stackoverflow.com/comment/38836729
comment on: http://stackoverflow.com/a/24982132
type: AnswerComment
score: 0
type: Comment
has text: thanks for that, and thanks for explanation, Ive been playing with this socket issue for three days and havent much hair left to pull out. cheers.

http://stackoverflow.com/comment/38861253
comment on: http://stackoverflow.com/a/24992075
score: 0
type: AnswerComment
has text: I wouldn't go that far. JPQL, which is a query language of JPA cannot do it. But JPA? Sure can. Just select two dates so you can have it as Java objects, and you can subtract it many different ways.
type: Comment

http://stackoverflow.com/q/25038329
tagged with: unboundid-ldap-sdk
score: 0
has comment: http://stackoverflow.com/comment/38945275
tagged with: opendj
tagged with: ldap
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40106293
has body: I have created a Password Policy on OpenDJ LDAP and let's say that if I assigned that Password Policy to a user ('test1'), OpenDJ is going to lock out 'test1' after 3 wrong passwords. I have the confirmation that the Password Policy works well as I tested it using OpenAM and it generates me the pwdFailureTime every time that I tried to authenticate 'test1' via OpenAM with a wrong password and lockout 'test1' after 3 wrong attempts. My problem is that if I use UnboundID SDK API as following using the 'cn=Directory Manager' admin user for the connection to OpenDJ/LDAP and the user 'test1' to authenticate on OpenDJ, it doesn't work. OpenDJ is not generating me any value for pwdFailureTime when I provide the wrong password for 'test1' (debugging the 'Sentinelle 2'). Could someone have any idea what is going wrong here? import com.unboundid.ldap.sdk.*; import com.unboundid.ldap.sdk.controls.*; public final class SimpleBindExample { public static final String HOSTNAME = "redhat.tech.example.com"; public static final int PORT = 1389; public static final String usrDN = "cn=Directory Manager"; public static final String usrPWD = "password"; public static final void main(final String... args) { // Establish a connection to OpenDJ via the user: cn=Directory Manager LDAPConnection ldapConnection = null; try { ldapConnection = new LDAPConnection(HOSTNAME, PORT, usrDN, usrPWD); } catch(LDAPException ldapException) { System.err.println(ldapException); System.exit(ldapException.getResultCode().intValue()); } try { String testusr= "uid=test1,ou=people,dc=example,dc=com"; String testpwd = "password"; BindRequest bindRequest = new SimpleBindRequest(testusr,testpwd,new AuthorizationIdentityRequestControl()); BindResult bindResult = ldapConnection.bind(bindRequest); System.out.println("Sentinelle 1: The user is authenticated!"); ldapConnection.close(); System.out.println(bindResult); } catch(LDAPException ldapException) { System.out.println("Sentinelle 2: The user is NOT authenticated!"…
answer count: 0
has title: How to trigger the pwdFailureTime on OpenDJ LDAP using UnboundID SDK for Java
has comment: http://stackoverflow.com/comment/39010786
tagged with: openam
type: Question
tagged with: java

http://stackoverflow.com/comment/38777945
has text: I was missing project's maven nature.Thanks for your suggestions.
comment on: http://stackoverflow.com/q/24950391
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24942042
type: Question
linked to: http://stackoverflow.com/q/1359689
score: -2
answer count: 2
downvote count: 2
linked to: http://stackoverflow.com/q/2793150
has body: We have an application with API via HTTP. If I want to get data from this API from linux script I just run something like curl -s http://10.20.1.116:8080/afa/report?session=fd58603c6673 and get back json { "content" : [ { "id" : 6243, "user" : "admin", "firewall" : "NewGroup_Lab", "updateDate" : 1406225284152, "attributes" : { "EmailNotification" : "True", "Job_status" : "COMPLETED", "Submitted_by" : "afa", "Regulatory_score_glba_group" : "22,9,10,65", "Pid" : "11254", "Owner" : "admin", "Regulatory_score_nist_800-41_group" : "15,13,8,52", } Now we want to use this API in java program. What is the correct way to access the API URL? What should I replace the curl with? Thanks.
has answer: http://stackoverflow.com/a/24942120
tagged with: java
has comment: http://stackoverflow.com/comment/38761840
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24942084
tagged with: api
upvote count: 0
has title: Access http API from java
favorite count: 0

http://stackoverflow.com/q/24962555
has comment: http://stackoverflow.com/comment/38818673
has comment: http://stackoverflow.com/comment/38808379
tagged with: graph
tagged with: recursion
tagged with: java
has comment: http://stackoverflow.com/comment/38801901
has body: I began implementing a hierarchical scene graph in my Java/OpenGL project with basic entities/objects that have a position component, and that know both their parent entity and their child entity(s). public class Entity { private Entity parent; private ArrayList&lt;Entity&gt; children = new ArrayList&lt;Entity&gt;(); private Vector3f pos = new Vector3f(0,0,0); //simplified transformation addChild(Entity child){...} setParent(Entity parent){...} public Vector3f getPos(){ return pos; } public void setPos(Vector3f pos){this.pos = pos} //this is my non-functional attempt at creating hierarchical movement public void setRelativePos(Vector3f pos) { this.setPos(parent.getPos().add(pos)); //position relative to parent for(Entity child : children) { //how the child relatives to the newly moved parent vec3 relativePos = child.getPos().sub(getPos()); child.setRelativePos(relativePos); } } } What I had in mind was that children will move relative to their parent when the parent's position is changed/set.
type: Question
tagged with: transform
has title: Hierarchy of Transformations, recursive function troubles
answer count: 1
score: 0
has answer: http://stackoverflow.com/a/24962781
tagged with: hierarchy
type: UnansweredQuestion

http://stackoverflow.com/comment/38812807
score: 1
comment on: http://stackoverflow.com/a/24969043
type: AnswerComment
has text: [DefaultTableModel](http://docs.oracle.com/javase/7/docs/api/javax/swing/table/DefaultTableModel.html) extends AbstractTableModel. read more in [Swing Tutorial](http://docs.oracle.com/javase/tutorial/uiswing/components/table.html)
type: Comment

http://stackoverflow.com/comment/38806089
has text: I never said that :D.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24965662

http://stackoverflow.com/q/25014771
has comment: http://stackoverflow.com/comment/38898484
has comment: http://stackoverflow.com/comment/38898482
has title: JFace and Assertion ClassNotFoundException in Eclipse
tagged with: assert
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/25014973
favorite count: 0
has comment: http://stackoverflow.com/comment/38898068
tagged with: jface
linked to: http://stackoverflow.com/q/4352588
score: 2
type: AnsweredQuestion
tagged with: eclipse-juno
has comment: http://stackoverflow.com/comment/38898090
upvote count: 2
tagged with: java
has comment: http://stackoverflow.com/comment/38898140
accepted answer: http://stackoverflow.com/a/25014973
has body: I am going through examples in one book, and I experienced error for which I don't know exactly what is causing it and how to resolve it. OS: Windows7 64bit, Eclipse IDE for Java Developers, JFace installed or better to say jars attached to project, default ones which comess with Eclipse: org.eclipse.jface_3.8.102.v20130123-162658.jar org.eclipse.jface.databinding_1.6.0.v20120912-132807.jar org.eclipse.jface.text_3.8.2.v20121126-164145.jar Here is the application code: import org.eclipse.jface.viewers.ColumnWeightData; import org.eclipse.jface.viewers.TableLayout; import org.eclipse.swt.SWT; import org.eclipse.swt.layout.FillLayout; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Table; import org.eclipse.swt.widgets.TableColumn; import org.eclipse.swt.widgets.TableItem; public class TableLayoutExample { public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); shell.setSize(500, 400); shell.setText("Table Example"); shell.setLayout(new FillLayout()); TableLayout layout = new TableLayout(); layout.addColumnData(new ColumnWeightData(40, 80, true)); layout.addColumnData(new ColumnWeightData(40, 80, true)); layout.addColumnData(new ColumnWeightData(40, 80, true)); Table table = new Table(shell, SWT.SINGLE); table.setLayout(layout); TableColumn column1 = new TableColumn(table, SWT.CENTER); TableColumn column2 = new TableColumn(table, SWT.CENTER); TableColumn column3 = new TableColumn(table, SWT.CENTER); TableItem item = new TableItem(table, SWT.NONE); item.setText(new String[] { "column 1", "column 2", "column 3" }); item = new TableItem(table, SWT.NONE); item.setText(new String[] { "a", "b", "c" }); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); } } And here is the error: Exception in thread "main" java.lang.NoClassDefFoundError: org/eclipse/core/runtime/Assert at org.eclipse.jface.viewers.Colu…
type: Question

http://stackoverflow.com/comment/38986010
type: AnswerComment
has text: just for clarification: hibernate.connection.provider_class has moved to org.hibernate.engine.jdbc.connections.spi?
type: Comment
comment on: http://stackoverflow.com/a/25052540
score: 0

http://stackoverflow.com/a/24997478
score: 0
answers question: http://stackoverflow.com/q/24997406
type: Answer
has body: You can use this negative lookbehind based regex: (?&lt;!\\)[&lt;&gt;] Regex Demo

http://stackoverflow.com/q/24984325
has answer: http://stackoverflow.com/a/24984529
answer count: 1
accepted answer: http://stackoverflow.com/a/24984529
has comment: http://stackoverflow.com/comment/38840876
has comment: http://stackoverflow.com/comment/38840890
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/38840928
has body: the following code in the if condition is going to called for almost 10,000 times and in testing showing the performance issues . if (fileUploaderIdListVo != null &amp;&amp; fileUploaderIdListVo.size() &gt; 0) { for (FileUploaderIdVo fuidVo : fileUploaderIdListVo) { if ( fuidVo.getExploded() != null &amp;&amp; fuidVo.getExploded().equalsIgnoreCase("Y")) { List&lt;Rights&gt; rightsList = rightsDao.list(fuidVo.getContractId()); int contractTitleId = Integer.parseInt(fuidVo.getContractTitleId()); List&lt;Integer&gt; titleRightIds = new ArrayList&lt;Integer&gt;(); for(Rights right: rightsList) { if(right!=null ) { titleRightIds.add(right.getId()); } } titleRightsManager.saveRightCombination("true", user.getUid(), fuidVo.getContractId(), titleRightIds, contractTitleId,new ArrayList&lt;String&gt;()); } } } What I think of getting the rightsList outside the the if condition 2. calling the saveRightCombination again outside the if condition Please suggest suitable ways to improve the performance of the following code.
has comment: http://stackoverflow.com/comment/38840916
type: Question
has comment: http://stackoverflow.com/comment/38841244
score: 0
has comment: http://stackoverflow.com/comment/38840938
has title: Performance improvement suggestions for the Java code ( if condition )

http://stackoverflow.com/a/25047680
has comment: http://stackoverflow.com/comment/38960586
has comment: http://stackoverflow.com/comment/38960665
upvote count: 2
has comment: http://stackoverflow.com/comment/38960528
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38960892
has body: Try this: java -cp "&lt;projectRoot&gt;/target/classes" com.myproject.client.MyClass [optional arguments]
type: Answer
has comment: http://stackoverflow.com/comment/38961088
accepted answer of: http://stackoverflow.com/q/25047637
score: 2
answers question: http://stackoverflow.com/q/25047637
downvote count: 0

http://stackoverflow.com/comment/38860198
type: Comment
comment on: http://stackoverflow.com/a/24990095
type: AnswerComment
score: 0
has text: Don't know SQS and I'm not sure I understood all but a solution could be to avoid executeAsync() and implement your own Callable<Message> (or whatever you need, a message handler etc.), within the call() method you perform your query and then return the Message so you can perform what you need (or in alternative implement a Runnable and you perform all in your run())

http://stackoverflow.com/comment/38900778
score: 3
comment on: http://stackoverflow.com/q/25014727
type: Comment
type: QuestionComment
has text: **Ask bookkeeping**. The problem is that totalling must be done last, but then you get a discrepancy with the other precision's case. Normally there is a (swiss bank?) account for differences.

http://stackoverflow.com/comment/87457079
type: Comment
comment on: http://stackoverflow.com/a/40782943
score: 0
has text: Arrrr - that was it for me. >>> Case matters.
type: AnswerComment

http://stackoverflow.com/comment/39019060
type: Comment
score: 0
has text: Here file means one generic name, just like, "city". That contains all the city names. Second example, "Animal", that contains all the animal names. Is it better to make a regex or files ?
type: AnswerComment
comment on: http://stackoverflow.com/a/25068987

http://stackoverflow.com/q/25001992
type: AnsweredQuestion
tagged with: performance
downvote count: 0
tagged with: java
type: Question
score: 20
possible better answer: http://stackoverflow.com/a/25002229
has body: What is the quickest implementation of java.util.Map for a very small number of entries (under 15 elements or so)? Both thread-safe and non-thread-safe.
accepted answer: http://stackoverflow.com/a/25002101
has comment: http://stackoverflow.com/comment/38873850
favorite count: 0
answer count: 3
has comment: http://stackoverflow.com/comment/38873931
has answer: http://stackoverflow.com/a/25002101
tagged with: dictionary
has title: Quickest implementation of Java Map for a small number of entries
has answer: http://stackoverflow.com/a/25002020
upvote count: 20
has answer: http://stackoverflow.com/a/25002229
tagged with: collections

checkbox
tag name: checkbox
tags question: http://stackoverflow.com/q/25016930
tags question: http://stackoverflow.com/q/24943125
type: Tag

http://stackoverflow.com/q/24959879
tagged with: persistence
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38795145
tagged with: java
has title: Qualified OneToMany-ManyToOne relation
has answer: http://stackoverflow.com/a/24963064
has body: i try to build a sample qualified relation and get a null value for the qualifier column in the join table. Error: Internal Exception: java.sql.SQLIntegrityConstraintViolationException: cannot insert NULL into 'TIRE_POSITION' Entities: @Entity public class Bike { @OneToMany(mappedBy = "bike", cascade=CascadeType.ALL) @MapKeyColumn(name="TIRE_POSITION", nullable=false) private Map&lt;String, Tire&gt; tires; ... } @Entity public class Tire { @ManyToOne(cascade=CascadeType.ALL) @JoinColumn(name="BIKE_ID") private Bike bike; public enum TirePosition{ FRONT("FRONT"), BACK("BACK"); ... } } Insert invocation: public void testIt(){ Bike bike = new Bike(); Tire tireFront = new Tire(); Tire tireBack = new Tire(); Map&lt;String, Tire&gt; tires = new HashMap&lt;String, Tire&gt;(); tires.put(Tire.TirePosition.BACK.getPosition(), tireBack); tires.put(Tire.TirePosition.FRONT.getPosition(), tireFront); bike.setTires(tires); EntityTransaction trans = em.getTransaction(); trans.begin(); em.persist(bike); trans.commit(); } Anyone an idea what is wrong here?
type: Question
tagged with: jakarta-ee
has comment: http://stackoverflow.com/comment/38794752
score: 0
tagged with: jpa
answer count: 1

http://stackoverflow.com/q/24923403
tagged with: jframe
tagged with: jmenubar
tagged with: swing
tagged with: jmenu
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/38726620
score: 0
answer count: 1
has title: JMenuBar won't show up in JFrame
has body: I know this question has been asked a lot but nothing seems to be working for me so I'll ask again. I'm trying to get a JMenuBar, with a JMenu, to show up in my Window class which extends JFrame. Here is my relevant code: public class Window extends JFrame { //class variables JMenuBar menuBar; JMenu menu; Window() throws IOExcpetion { menuBar = new JMenuBar(); menu = new JMenu("A Menu"); menuBar.add(menu); this.setJMenuBar(menuBar); this.add(menuBar); //I've tried with and without this menu.setVisible(true); menuBar.setVisible(true); this.setVisible(true); while(true) { repaint(); //my paint method doesn't touch the JMenuBar or JMenu } }
has answer: http://stackoverflow.com/a/24923422
type: UnansweredQuestion

http://stackoverflow.com/q/24991491
has body: I have the problem that the decoding from a URL causes some major problems. The request URL contains %C3%BC as the letter 'ü'. The decoding server side should now decode it as an ü, but it does this: Ã¼ decoding is done like this: decoded = URLDecoder.decode(value, "UTF-8"); while value contains '%C3%BC' and decoded should now conatain 'ü', but that's where the problem is. What's going wrong here? I use this method in more than one application and it works fine in all other cases...
has title: URL decode ä -> ã1⁄4
has answer: http://stackoverflow.com/a/25050420
accepted answer: http://stackoverflow.com/a/25050420
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/24991915
tagged with: url
tagged with: decoding
tagged with: utf-8
has comment: http://stackoverflow.com/comment/38854564
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/24991915
tagged with: java
type: Question

http://stackoverflow.com/comment/38874673
has text: good point. I have changed the order but nothing is happening!
comment on: http://stackoverflow.com/a/25002040
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/25057422
has title: Close Encapsulating Writers/Streams for ServletOutputStream
favorite count: 0
accepted answer: http://stackoverflow.com/a/25057617
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38978654
score: 2
upvote count: 2
tagged with: java
has answer: http://stackoverflow.com/a/25057617
type: Question
has comment: http://stackoverflow.com/comment/38978337
has comment: http://stackoverflow.com/comment/38979088
tagged with: servlets
has body: I know it has been the point of many previous questions to close or not to close a ServletOutputStream like here: Should I close the servlet outputstream? or here: Should one call .close() on HttpServletResponse.getOutputStream()/.getWriter()? or with another focus here: Do I need to flush the servlet outputstream? The general consensus seems to be not to close it because you are not owning it in a more strict sense. (The HttpServletResponse owns it.) But what about e.g. these constructs: PrintWriter out = new PrintWriter( new OutputStreamWriter( resp.getOutputStream(), MY.ENCODING ) ); Now I'm clearly the owner of the PrintWriter which has some additional buffers which at least needs to get flushed (and which are flushed e.g. by closing it). What is the general consensus here? Do I need to close the PrintWriter (or any other such construct as for this matter.)? EDIT: There are valid arguments for closing the stream, too. Notable e.g. not wanting something else writing on the stream. And meanwhile we have with try-with-resource constructs which might change the picture. See my other question here: Eclipse complaining over resource leak when not closing ServletOutputStream This might change nothing (and my general feeling is to not close the stream, too) but try-with-resource above all literally screams for code like: try( Something out = new Something( resp.getOutputStream() ) ){ out.print( "Foo" ); } instead of Something out; try { out = new Something( resp.getOutputStream() ); out.print( "Foo" ) } finally { if( out != null &amp;&amp; out.isUnFlushedWhatever() ) out.flush(); }
answer count: 1
downvote count: 0
tagged with: outputstream

http://stackoverflow.com/comment/38737823
comment on: http://stackoverflow.com/q/24928803
type: Comment
score: 0
type: QuestionComment
has text: An other pattern that could fit is the use of a proxy, maybe even a [proxy extending a class](http://stackoverflow.com/q/3291637/3080094).

http://stackoverflow.com/comment/38933008
comment on: http://stackoverflow.com/q/25032827
score: 0
type: Comment
type: QuestionComment
has text: @Z.Neeson, Yeah I realised too late, usually it would work but since the thread is passed to the executor which takes a thread object then cant call start on it there :) I didn't test it which is why I didn't write it as an answer :)

http://stackoverflow.com/comment/38845835
type: Comment
score: 0
has text: I created my environment from scratch. Still no luck. Is glassfish really this crappy ? I never faced these issues with tomcat or weblogic.
comment on: http://stackoverflow.com/a/24986555
type: AnswerComment

http://stackoverflow.com/comment/38828921
score: 0
type: Comment
type: QuestionComment
has text: Can u please give me a example?
comment on: http://stackoverflow.com/q/24977871

http://stackoverflow.com/comment/38836790
type: Comment
comment on: http://stackoverflow.com/a/24975732
type: AnswerComment
has text: Yes if you don't have an answer please do not leave it in the answer box
score: 0

http://stackoverflow.com/comment/38929699
type: AnswerComment
comment on: http://stackoverflow.com/a/25029880
type: Comment
has text: @alfasin if it is a member variable it will use the getfield and putfield which is the same as the static field's getstatic and putstatic
score: 0

http://stackoverflow.com/a/25060698
type: Answer
has comment: http://stackoverflow.com/comment/38989841
has body: Simply use the other constructor for KeyCodeCombination, for example like that: MenuItem.setAccelerator(new KeyCodeCombination(KeyCode.S, KeyCombination.ModifierValue.ANY, KeyCombination.ModifierValue.ANY, KeyCombination.ModifierValue.ANY, KeyCombination.ModifierValue.ANY, KeyCombination.ModifierValue.ANY));
has comment: http://stackoverflow.com/comment/39014043
score: 0
answers question: http://stackoverflow.com/q/25042529

http://stackoverflow.com/a/25044930
score: 19
has comment: http://stackoverflow.com/comment/65561108
answers question: http://stackoverflow.com/q/25044725
type: AcceptedAnswer
downvote count: 0
has body: After running a quick comparison of the schemas, these appear to be the changes for upgrading from Spring Batch 2.2.7.RELEASE -> 3.0.1.RELEASE on MySQL. ALTER TABLE `BATCH_JOB_EXECUTION` MODIFY COLUMN `EXIT_CODE` varchar(2500) DEFAULT NULL; ALTER TABLE `BATCH_JOB_EXECUTION` ADD COLUMN `JOB_CONFIGURATION_LOCATION` varchar(2500) DEFAULT NULL; ALTER TABLE `BATCH_JOB_EXECUTION_SEQ` ADD COLUMN `UNIQUE_KEY` char(1) NOT NULL; ALTER TABLE `BATCH_JOB_EXECUTION_SEQ` ADD UNIQUE KEY `UNIQUE_KEY_UN` (`UNIQUE_KEY`); ALTER TABLE `BATCH_JOB_SEQ` ADD COLUMN `UNIQUE_KEY` char(1) NOT NULL; ALTER TABLE `BATCH_JOB_SEQ` ADD UNIQUE KEY `UNIQUE_KEY_UN` (`UNIQUE_KEY`); ALTER TABLE `BATCH_STEP_EXECUTION` MODIFY COLUMN `EXIT_CODE` varchar(2500) DEFAULT NULL; ALTER TABLE `BATCH_STEP_EXECUTION_SEQ` ADD COLUMN `UNIQUE_KEY` char(1) NOT NULL; ALTER TABLE `BATCH_STEP_EXECUTION_SEQ` ADD UNIQUE KEY `UNIQUE_KEY_UN` (`UNIQUE_KEY`);
accepted answer of: http://stackoverflow.com/q/25044725
has comment: http://stackoverflow.com/comment/65611252
type: Answer
upvote count: 19
has comment: http://stackoverflow.com/comment/65637383

http://stackoverflow.com/q/24981640
score: 0
tagged with: android
has comment: http://stackoverflow.com/comment/38841360
answer count: 1
has comment: http://stackoverflow.com/comment/38837707
favorite count: 0
has title: I don't get any altitude data (GPS Android)
type: UnansweredQuestion
upvote count: 1
downvote count: 1
tagged with: gps
tagged with: java
has answer: http://stackoverflow.com/a/25086558
tagged with: eclipse
type: Question
has comment: http://stackoverflow.com/comment/38838493
has body: I am doing a GPS app, with latitude, longitude, speed, altitude...but I don't get any data for this one. I always get 1.0 as a value. (With the speed it happens the same). I tried with the simulator of GPX in Eclipse (DDMS) and on the terminal (KML simulator, not on the street)...but it always shows 0.0 or 1.0. My code is the following: private Location currentLoc; private Location previousLoc; The criteria for the GPS... // Criteria object is optional. Will return value representing "GPS" Criteria oGPSSettings = new Criteria(); oGPSSettings.setAccuracy(Criteria.ACCURACY_FINE); oGPSSettings.setSpeedRequired(true); oGPSSettings.setAltitudeRequired(true); oGPSSettings.setBearingRequired(false); oGPSSettings.setCostAllowed(false); oGPSSettings.setPowerRequirement(Criteria.POWER_MEDIUM); When a new location is recieved... @Override public void onLocationChanged(Location location) { currentLoc = location; String sText = "Altitude: " + currentLoc.getAltitude(); txtOutput.setText(sText); } // sets this location as last location. previousLoc = currentLoc; } I removed from the code things like displaying latitude, longitude...right now I'll show only altitude. The question is: Why do you think is it happening this? The latitude and longitude works fine, but not the altitude. Maybe is it a hardware issue? Because the code seems correct, I think. Only with the getAltitude function should works. Thank you in advance!

http://stackoverflow.com/comment/38790416
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24957671
has text: Do you want to inflate spinner with id spinner1?
score: 0

http://stackoverflow.com/comment/38944799
has text: Thanks, using BufferedOutputStream worked. I cannot simply redirect input, because, in fact, my input stream is a ReplaceInputStream (I need to replace several characters before parsing).
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25039266
type: AnswerComment

http://stackoverflow.com/comment/39034395
type: Comment
type: QuestionComment
has text: On gae and using maven I get these error, but with the google plugin, nothing happens, allways using the same code, may be something is not well configured on maven
comment on: http://stackoverflow.com/q/25046225
score: 0

http://stackoverflow.com/comment/63541940
type: AnswerComment
has text: it doesn't change anything, the space is still there.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25200752

http://stackoverflow.com/q/25048010
type: Question
has body: I have this situation where it seems that the Java 8 Streams API would be helpful, but I'm not fully sure how it could be. From two Collections with distinct element types, I want to build a third collection whose elements are all the possible Pairs of elements from both collections. Basically: The two distinct element types... public class A {} public class B {} A "pair" of As and Bs. public class Pair { private A a; private B b; public Pair(A a, B b){ this a = a; this b = b; } } The "combination" made using old-style java.util.Collection API: public Collection&lt;Pair&gt; combine(Collection&lt;A&gt; as, Collection&lt;B&gt; bs){ Collection&lt;Pair&gt; pairs = new ArrayList(); foreach(A a: as){ foreach(B b: bs){ Pair pair = new Pair(a,b); pairs.add(pair); } } return pairs; } The ordering in the resulting pairs collection is not important. So, every instance of Pair could be created and added to the resulting collection in parallel. How could I achieve this? The best I could figure out by myself was to use the Streams version of foreach: as.foreach( a -&gt; { bs.foreach( b -&gt; { Pair pair = new Pair(a,b); pairs.add(pair); } } ); This example was made trivial for the sake of simplification. The class Pair is an example of processing two elements into a third one (that is, a java.util.function.BiFunction), and adding them to a Collection is just an example of a mutable reduction. Is there a more elegant way to do that? Or preferable, in a more profitable way in regards to efficiency? Something like BiFunction&lt;A,B,Pair&gt; combinator = Pair::new; //or any other function f(a,b)=c; Stream&lt;Pair&gt; pairStream = Streams.unknownElegantMethod(as.stream(), bs.stream(), combinator);
has answer: http://stackoverflow.com/a/42604455
score: 15
upvote count: 15
answer count: 2
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/41059490
tagged with: cartesian-product
tagged with: lambda
has title: Should I use Java 8 Streams Api to combine two Collections?
tagged with: java-8
has comment: http://stackoverflow.com/comment/41050590
has comment: http://stackoverflow.com/comment/41062933
has answer: http://stackoverflow.com/a/25048170
tagged with: java-stream
type: UnansweredQuestion
tagged with: java

opengl-es-2.0
tag name: opengl-es-2.0
tags question: http://stackoverflow.com/q/24953805
type: Tag

http://stackoverflow.com/comment/38745890
score: 0
comment on: http://stackoverflow.com/q/24933493
has text: Thumbs up if you like my answer :P
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25064355
tagged with: android
has title: Does android SmsManager show message is sent for numbers that are switched off?
tagged with: smsmanager
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
accepted answer: http://stackoverflow.com/a/25066217
type: Question
has body: I am trying to understand how import android.telephony.SmsManager; would know that an sms was successfully delivered. I am using this code from the study guide protected void sendSMSMessage() { Log.i("Send SMS", ""); String phoneNo = txtphoneNo.getText().toString(); String message = txtMessage.getText().toString(); try { SmsManager smsManager = SmsManager.getDefault(); smsManager.sendTextMessage(phoneNo, null, message, null, null); Toast.makeText(getApplicationContext(), "SMS sent.", Toast.LENGTH_LONG).show(); } catch (Exception e) { Toast.makeText(getApplicationContext(), "SMS failed, please try again.", Toast.LENGTH_LONG).show(); e.printStackTrace(); } } Ordinarily,i know when i send an sms to a number that is switched off,i don't receive the delivery report to confirm that the message was received.Does import android.telephony.SmsManager; show the message was sent even if the number is switched off?.
has comment: http://stackoverflow.com/comment/38995987
downvote count: 0
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/25066217
tagged with: sms

http://stackoverflow.com/a/24978197
answers question: http://stackoverflow.com/q/24978143
downvote count: 0
has comment: http://stackoverflow.com/comment/38829647
has comment: http://stackoverflow.com/comment/38829378
upvote count: 8
has comment: http://stackoverflow.com/comment/38829309
has comment: http://stackoverflow.com/comment/38829394
has body: Simple answer is : your session data are stored on the server side. Web browser will get only an string id to identify it's session. In fact, spring security takes more care of session information, because if users even don't login, session may not exist at all. When I use spring mvc only, I don't use session to store important data, because session is stored in memory only. It is designed to save data temporarily. When I use spring security, I have to save many important things in memory, such as account data which could not be transmitted on internet, and I won't load them from database every time. So I have to choose session. So when the server which stored login session is down, all users have logged in on this server would have to relogin to retrieve another session id. Session is not always the best choice, because when we have many servers that use session data, I have to share the data among all servers, anyway, net IO is expensive for servers.
has comment: http://stackoverflow.com/comment/38829498
score: 8
has comment: http://stackoverflow.com/comment/38829553
type: Answer

http://stackoverflow.com/comment/38759142
has text: *The easier the solution the better.* use third party libraries.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24940756
score: 2

http://stackoverflow.com/comment/39001854
type: Comment
comment on: http://stackoverflow.com/a/25066498
score: 1
has text: @jonas.ninja You can get the source code at http://git.eclipse.org/c/ Can't help you with building it though.
type: AnswerComment

http://stackoverflow.com/a/24923611
score: 1
has comment: http://stackoverflow.com/comment/38738774
accepted answer of: http://stackoverflow.com/q/24918842
answers question: http://stackoverflow.com/q/24918842
upvote count: 1
type: AcceptedAnswer
has body: You can send GCM messages from your Java Server. The simplest way is to use the server library supplied by Google (gcm-server.jar). The code for sending a message is as simple as : Sender sender = new Sender(apiKey); Message message = new Message.Builder() .delayWhileIdle(true) .addData("key1", "value1") .addData("key2", "value2") .build(); Result result = sender.send(message, registrationId, numOfRetries); In addition, you'd have to check the result, to see if your message was accepted or rejected by GCM server. This example shows how to send a message to a single device. There's a similar way to send the same message to multiple devices. Finally, you'll have to implement some web service that accepts a registration ID from your app, and saves it in your DB.
has comment: http://stackoverflow.com/comment/38750368
has comment: http://stackoverflow.com/comment/38751420
type: Answer
has comment: http://stackoverflow.com/comment/38751131
downvote count: 0

http://stackoverflow.com/comment/38831350
type: QuestionComment
has text: Then why do you need to resize things at all? The layout should take care of that for you.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/24976355

http://stackoverflow.com/a/25052075
answers question: http://stackoverflow.com/q/25052046
score: 1
downvote count: 0
type: Answer
has body: There are already a lot of examples out there, but HERE you go. Add this dependency to your project: net.sf.json-lib json-lib 2.3 compile Put the following JSON sample in your classpath: {'foo':'bar', 'coolness':2.0, 'altitude':39000, 'pilot':{'firstName':'Buzz', 'lastName':'Aldrin'}, 'mission':'apollo 11'} Load the resource from the classpath and parse this JSON as follows: package com.discursive.answers; import java.io.InputStream; import net.sf.json.JSONObject; import net.sf.json.JSONSerializer; import org.apache.commons.io.IOUtils; public class JsonParsing { public static void main(String[] args) throws Exception { InputStream is = JsonParsing.class.getResourceAsStream( "sample-json.txt"); String jsonTxt = IOUtils.toString( is ); JSONObject json = (JSONObject) JSONSerializer.toJSON( jsonTxt ); double coolness = json.getDouble( "coolness" ); int altitude = json.getInt( "altitude" ); JSONObject pilot = json.getJSONObject("pilot"); String firstName = pilot.getString("firstName"); String lastName = pilot.getString("lastName"); System.out.println( "Coolness: " + coolness ); System.out.println( "Altitude: " + altitude ); System.out.println( "Pilot: " + lastName ); } }
upvote count: 1

http://stackoverflow.com/a/24948173
has body: Set is abstract so it cannot be instantiated. You need to use an implementation of Set, such as HashSet. public class StopTests { public void someMethod() { BusRoute rte = new BusRoute("250"); Set&lt;BusRoute&gt; set = new HashSet&lt;BusRoute&gt;(); set.add(rte); BusStop stop = new BusStop(00000, "Staples Center", 90.0, 90.0, set); ... } }
has comment: http://stackoverflow.com/comment/38773422
answers question: http://stackoverflow.com/q/24948052
score: 0
has comment: http://stackoverflow.com/comment/38773679
type: Answer

http://stackoverflow.com/comment/38898017
type: Comment
comment on: http://stackoverflow.com/a/25002474
has text: Thanks for answering, but unfortunately, I need to a way to use a URL for this, so your answer will not work.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/38715140
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24916866
type: Comment
has text: Also, check path and permissions for it file. _f.canRead()_ _f.exists()_ _f.isFile()_ will help.

http://stackoverflow.com/comment/38739167
type: QuestionComment
comment on: http://stackoverflow.com/q/24930218
score: 0
type: Comment
has text: @LMK those are variable sthat store the values retrived from database

http://stackoverflow.com/comment/38832407
comment on: http://stackoverflow.com/q/24979579
has text: Thats the Log: http://pastebin.com/S0avy8za
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24952573
has body: If you do not mind a slight loss of performance, you can put all the maxima in a static Map, define a class that holds a getter, a setter, and a norm methods, and replace the individual variables with instances of that class: private static Map&lt;String,Object&gt; max = new HashMap&lt;String,Object&gt;(); private static class IntMaxTrack { private final String key; private int value; public IntMaxTrack(String k, int v) { key = k; value = v; max.put(key, value); } public int get() { return value; } public void set(int v) { int m = ((Integer)max.get(key)).intValue(); value = v; if (value &gt; m) { max.put(key, value); } } public double norm() { int m = ((Integer)max.get(key)).intValue(); return val / ((double)m); } } Make a similar class for double, i.e. DblMaxTrack Now you can replace primitives with instances of these classes, and call their get, set, and norm from the corresponding methods of your class.
has comment: http://stackoverflow.com/comment/38781831
type: Answer
accepted answer of: http://stackoverflow.com/q/24952273
has comment: http://stackoverflow.com/comment/38862419
has comment: http://stackoverflow.com/comment/38781286
answers question: http://stackoverflow.com/q/24952273
score: 2
downvote count: 0
upvote count: 2
has comment: http://stackoverflow.com/comment/38862486
type: AcceptedAnswer

http://stackoverflow.com/a/25031718
downvote count: 0
type: Answer
has body: Works fine without problem until and unless you are using JDBC properly.I am using getGeneratedKeys() since long time and didn't came across any issue till now.
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/25031445

http://stackoverflow.com/comment/38914708
type: AnswerComment
has text: Without the '\*' following the name of the folder defined in the classpath, none of the jars are picked up - I just tried it. So that does not appear to ne the solution.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25023216

http://stackoverflow.com/a/24981286
score: 0
has body: You are calling initialze AND initializeForView. You should only be calling one, most likely initializeForView.
has comment: http://stackoverflow.com/comment/39195090
type: Answer
has comment: http://stackoverflow.com/comment/38846084
answers question: http://stackoverflow.com/q/24975169
has comment: http://stackoverflow.com/comment/38846434
has comment: http://stackoverflow.com/comment/39291116
has comment: http://stackoverflow.com/comment/39291087

http://stackoverflow.com/a/24988192
has body: You should use And operator &amp;&amp; for So when any of the field matches the criterion it gets added to the datastructure. which i dont want unless it fulfills others too. suppose it fulfils 1 but does not fulfil 2 it should be rejected. if((filterModel != null &amp;&amp; partsModel.getPartModel().equalsIgnoreCase(filterModel)) &amp;&amp; (filterProduct != null &amp;&amp; partsModel.getPartName().equalsIgnoreCase(filterProduct)) &amp;&amp; (filterDescription != null &amp;&amp; partsModel.getPartSpecs().contains(filterDescription))) { partsModelList.add(partsModel); }
upvote count: 4
answers question: http://stackoverflow.com/q/24988146
downvote count: 0
score: 4
type: Answer

http://stackoverflow.com/comment/38890700
comment on: http://stackoverflow.com/q/25010843
type: Comment
has text: Java haven't been considered "slow" for at least a decade. Since SUN's HotSpot compiler most Java runtimes today recompiles the Java VM code to native code. The only people who consider Java slow are people who either don't use Java but has "heard" that it's slow, or detractors who actively dislike Java and help spread these rumors.
score: 5
type: QuestionComment

http://stackoverflow.com/q/25068178
answer count: 0
type: Question
has comment: http://stackoverflow.com/comment/39000352
tagged with: java
has comment: http://stackoverflow.com/comment/39000246
tagged with: database
has comment: http://stackoverflow.com/comment/39010095
has title: Java app connecting to SQLite database
score: 0
has comment: http://stackoverflow.com/comment/39011270
tagged with: sqlite
tagged with: jar
has body: I am developing a very small java application for people on my network. All it does is accept options for user input, grabs data from multiple SQLite databases (no updating to actual database!), and spits out a calculation. It works fine in eclipse but I cannot find a solution for running it as one consolidated application that I can distribute to my coworkers. I am reading that JDBC is not able to query databases inside jars. I am also reading that it is dangerous and slow to keep the databases on the shared network. Finally, I am told I can create a temporary database when the program runs but I haven't a clue on how get the databases to copy into the temporary ones if the program cannot find them in the first place. Here is the syntax I am using to access the databases: Connection con = DriverManager.getConnection ("jdbc:sqlite:src/productLine.db", config.toProperties()); The database is located in the src folder. My questions are: Is it possible (if advisable) to get the runnable jar to read a database inside of it? Are there alternative options for this sort of problem? Am I storing my databases properly or should they have their own source folder?
type: UnansweredQuestion
tagged with: jdbc
has comment: http://stackoverflow.com/comment/39020789

http://stackoverflow.com/comment/38792806
type: Comment
has text: Yes, I've dropped just foo_bar and dropped the entire database. When Hibernate is creating the table it's making the composite key somehow
type: QuestionComment
comment on: http://stackoverflow.com/q/24957395
score: 0

http://stackoverflow.com/q/24975187
tagged with: java
has comment: http://stackoverflow.com/comment/38825229
type: Question
has body: I've set up a small sample project (https://github.com/mikepenz/HoloKitKatDrawer) for my applications, and uploaded it to github. It is a really helpful wrapper for applications with a drawerlayout and fragments as content. Now i got a problem. If i try to inflate my menu like this: @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.main, menu); return super.onCreateOptionsMenu(menu); } it doesn't show all items which are to much for the actionbar. It will simply forget or ignore them. The same happens if i set showAsAction="never" I never had this issue before. (I also have a device without a menu button). You can find the rest of the source code at my github. https://github.com/mikepenz/HoloKitKatDrawer Someone got an idea what i do wrong with the project so it will handle the ActionItems wrong? Cheers, Mike
has comment: http://stackoverflow.com/comment/38829980
has answer: http://stackoverflow.com/a/24978757
answer count: 1
score: 0
has title: Android ActionItem Overflow not shown
tagged with: android
type: UnansweredQuestion
tagged with: menuitem

http://stackoverflow.com/a/24911306
type: Answer
has comment: http://stackoverflow.com/comment/38704007
has comment: http://stackoverflow.com/comment/38704573
upvote count: 1
answers question: http://stackoverflow.com/q/24910172
score: 1
has comment: http://stackoverflow.com/comment/38703912
downvote count: 0
has body: Synchronize always on a final instance. private MyEvent myEvent; private final Object SYNC = new Object(); public Callable&lt;String&gt; doStuff() { callSomeAsyncFunction(); return new Callable&lt;String&gt; () { @Override public String call() throws Exception { synchronized (SYNC) { while (myEvent == null) { SYNC.wait(); } return "ok"; } } }; } public void onMyEvent(MyEvent event) { synchronized (SYNC) { myEvent = event; SYNC.notifyAll(); } }
has comment: http://stackoverflow.com/comment/38703868
has comment: http://stackoverflow.com/comment/38704393
has comment: http://stackoverflow.com/comment/38704829

http://stackoverflow.com/comment/107712718
type: Comment
comment on: http://stackoverflow.com/a/25030340
score: 0
type: AnswerComment
has text: @JimmyB And `linger()` has nothing to do with it. All it does is block `close()` for up to the specified period while there is outgoing pending data. It doesn't affect the actual transmission of that data in any way. Unless you use it to reset the connection, which you simply shouldn't.

http://stackoverflow.com/comment/38862444
type: QuestionComment
has text: Are you talking about [Eclipse DTP](http://wiki.eclipse.org/Data_Tools_Platform_Project) ? Because this can not be used in Java Projects.
comment on: http://stackoverflow.com/q/24995191
score: 0
type: Comment

http://stackoverflow.com/comment/38977166
comment on: http://stackoverflow.com/q/25051253
score: 0
has text: The error is in Loading the classes from the Jar. Is there any other method to load the TiffImage Writer/Reader classes
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24971331
tagged with: mysql
has comment: http://stackoverflow.com/comment/38816343
has comment: http://stackoverflow.com/comment/38817447
has answer: http://stackoverflow.com/a/24971460
has comment: http://stackoverflow.com/comment/38817640
type: AnsweredQuestion
downvote count: 0
has comment: http://stackoverflow.com/comment/38816277
possible better answer: http://stackoverflow.com/a/24971362
has body: I am trying to connect to the mysql server, but this takes 5 seconds. showTime(); Class.forName("com.mysql.jdbc.Driver"); conn = (Connection) DriverManager.getConnection("jdbc:mysql://192.168.1.212:3306/db",username.getText(),password.getText()); showTime();
has answer: http://stackoverflow.com/a/24971362
has answer: http://stackoverflow.com/a/26057234
type: Question
tagged with: jdbc
score: 1
accepted answer: http://stackoverflow.com/a/26057234
has title: MySQL jdbc connection takes too long
linked to: http://stackoverflow.com/q/15198319
has comment: http://stackoverflow.com/comment/38816234
favorite count: 0
answer count: 3
has comment: http://stackoverflow.com/comment/38816242
upvote count: 1
has comment: http://stackoverflow.com/comment/38816392
linked to: http://stackoverflow.com/q/24095344
tagged with: java
linked to: http://stackoverflow.com/q/22999830

http://stackoverflow.com/comment/38784938
type: AnswerComment
has text: Sir, the thing is user input is not always the same as reverse of search key in all cases. Eg: Assume csv contains son,jackson,robert,etc. Now when user inputs "son", I need to display son, jackson, etc that has son as the last part. If I don't create a submap, can you tell me how I can realize this?
type: Comment
score: 0
comment on: http://stackoverflow.com/a/24947570

http://stackoverflow.com/comment/38790890
type: Comment
comment on: http://stackoverflow.com/a/24957686
score: 0
type: AnswerComment
has text: @njzk2 I edited the question and this is the simplified version of what I need to achieve. But if you can show a small example of how I can cast c.returnA(); to a custom class that will overwrite getID function that would be great.

generics
tags question: http://stackoverflow.com/q/24916890
tags question: http://stackoverflow.com/q/24932177
tags question: http://stackoverflow.com/q/25020765
tags question: http://stackoverflow.com/q/25003711
tags question: http://stackoverflow.com/q/24937901
tags question: http://stackoverflow.com/q/24936150
tags question: http://stackoverflow.com/q/24920133
tags question: http://stackoverflow.com/q/25060251
tags question: http://stackoverflow.com/q/25028860
tags question: http://stackoverflow.com/q/24985093
type: Tag
tags question: http://stackoverflow.com/q/25043929
tags question: http://stackoverflow.com/q/25061494
tags question: http://stackoverflow.com/q/24924319
tags question: http://stackoverflow.com/q/25064083
tags question: http://stackoverflow.com/q/24943302
tags question: http://stackoverflow.com/q/25050544
tags question: http://stackoverflow.com/q/25067746
tags question: http://stackoverflow.com/q/24986279
tags question: http://stackoverflow.com/q/25054652
tags question: http://stackoverflow.com/q/25012509
tags question: http://stackoverflow.com/q/24918525
tags question: http://stackoverflow.com/q/24957269
tags question: http://stackoverflow.com/q/25041520
tags question: http://stackoverflow.com/q/24936842
tags question: http://stackoverflow.com/q/24968386
tags question: http://stackoverflow.com/q/24985893
tags question: http://stackoverflow.com/q/24911179
tags question: http://stackoverflow.com/q/25041315
tags question: http://stackoverflow.com/q/25035413
tags question: http://stackoverflow.com/q/24944118
tags question: http://stackoverflow.com/q/24980432
tags question: http://stackoverflow.com/q/24949669
tags question: http://stackoverflow.com/q/24984135
tags question: http://stackoverflow.com/q/24983603
tag name: generics
tags question: http://stackoverflow.com/q/24975984
tags question: http://stackoverflow.com/q/25063150
tags question: http://stackoverflow.com/q/24995088
tags question: http://stackoverflow.com/q/25061646
tags question: http://stackoverflow.com/q/25040837
tags question: http://stackoverflow.com/q/24971003
tags question: http://stackoverflow.com/q/25055032

http://stackoverflow.com/comment/38755321
comment on: http://stackoverflow.com/q/24937398
score: 0
type: Comment
has text: This is strange; I don't see any opportunity for the lock to be left locked; the `RedisLockRegistry` won't help - that's for when using multiple application instances and a shared group store.
type: QuestionComment

http://stackoverflow.com/a/25040806
score: 1
has comment: http://stackoverflow.com/comment/38947416
type: Answer
has comment: http://stackoverflow.com/comment/38948179
upvote count: 1
has comment: http://stackoverflow.com/comment/38955116
has comment: http://stackoverflow.com/comment/38952467
has comment: http://stackoverflow.com/comment/38947482
accepted answer of: http://stackoverflow.com/q/25039915
has comment: http://stackoverflow.com/comment/38981747
has body: I think you may be missing a closing } for the javascript bit just above /script script type="text/javascript"> . . . some html code DDD <% } %> /script> BTW Scriptlets are deprecated. I tend to use the Java Standard Tag Library (JSTL) and beans. http://www.tutorialspoint.com/jsp/jsp_standard_tag_library.htm
answers question: http://stackoverflow.com/q/25039915
has comment: http://stackoverflow.com/comment/38948882
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38981911
has comment: http://stackoverflow.com/comment/38981688
downvote count: 0

http://stackoverflow.com/q/24920563
type: AnsweredQuestion
has body: I have classes like below class A { @Override public boolean equals(Object other) { return true } } Class B extends A { } Class C extends A { @Override public boolean equals(Object other) { if ((other != null) || (other instanceOf B)) return false; } } In my main() I have this following code Set&lt;A&gt; mySet = new CopyOnWriteArraySet&lt;A&gt;(); mySet.add(C); I want mySet to contain C at this point mySet.add(B); // #1 I want mySet to contain C &amp; B at this point mySet.remove(B); // #2 I want mySet to contain C at this point I want to create a global queue where if object C exists in the queue B should be allowed to be added but not the other way around. So before #1 I am looping through the elements inside the set doing element.equals(B) with add on false. But 1 is calling B.equals(C) which is returning true and so mySet has only one C object after this line 2 is again calling B.equals(C) which is returning true and removing the existing object C. Shouldn't it be C.equals(B) in this case? I am expecting this line as no-action Is this some wrong use of CopyOnWriteArraySet? Thanks for looking
has comment: http://stackoverflow.com/comment/38721504
tagged with: java
accepted answer: http://stackoverflow.com/a/24921455
has comment: http://stackoverflow.com/comment/38721430
has comment: http://stackoverflow.com/comment/38721382
type: Question
has answer: http://stackoverflow.com/a/24920601
answer count: 2
tagged with: copy-on-write
possible better answer: http://stackoverflow.com/a/24920601
score: 0
has comment: http://stackoverflow.com/comment/39347589
has comment: http://stackoverflow.com/comment/38721585
has title: Overriding equals for CopyOnWriteArraySet.add and remove
tagged with: equals
has answer: http://stackoverflow.com/a/24921455

http://stackoverflow.com/comment/38847615
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24978569
has text: Its Australia time... Yes, but for testing purposes, I need to use GMT. We have a testing server which generates the same log file. Isn't there a universal or default timezone. Or cant we have timezone in properties file?

http://stackoverflow.com/q/24948371
answer count: 4
has answer: http://stackoverflow.com/a/24948478
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24948407
tagged with: java
type: Question
tagged with: arrays
has answer: http://stackoverflow.com/a/24948406
has body: I am new to this group. Please suggest how to return File[] array as my code below is giving NullPointerException when I am trying to add all text files from "D:\" to File[] array, as I want to return all text files as an File[] array which will be used in another method to read all text files. File[] allFiles; int i = 0; public File[] findFiles(File source) { FileFilter filter = new FileFilter() { @Override public boolean accept(File pathname) { // TODO Auto-generated method stub if (!pathname.isHidden()) { return true; } return false; } }; File[] list = source.listFiles(filter); if (list != null) { for (File f : list) { if (f.isDirectory()) { findFiles(f); } if (f.getName().contains("txt")) { System.out.println(f.getAbsolutePath()); allFiles[i] = f; // it is giving nullpointerexception i++; } } } return allFiles; // want to return this to another method }
score: 0
has answer: http://stackoverflow.com/a/24948405
has title: How to return File[] array after adding all files to it

http://stackoverflow.com/q/25056178
downvote count: 3
upvote count: 1
type: Question
linked to: http://stackoverflow.com/q/7520432
has comment: http://stackoverflow.com/comment/38976147
has answer: http://stackoverflow.com/a/25056333
has comment: http://stackoverflow.com/comment/38978105
score: -2
has comment: http://stackoverflow.com/comment/38976379
has title: Can't run if statements completely
has comment: http://stackoverflow.com/comment/38977876
has comment: http://stackoverflow.com/comment/38977690
has comment: http://stackoverflow.com/comment/38976207
linked to: http://stackoverflow.com/q/513832
answer count: 3
has comment: http://stackoverflow.com/comment/38976492
accepted answer: http://stackoverflow.com/a/25056333
favorite count: 0
has answer: http://stackoverflow.com/a/25056267
has comment: http://stackoverflow.com/comment/38976288
has comment: http://stackoverflow.com/comment/38976195
possible better answer: http://stackoverflow.com/a/25056267
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38976404
has body: I have a problem with my java programs when I use if statements. In fact the programs don't run well and completely as I write. To tell you the truth I'm really confused about it because I don't know where is the problem from... For example I've written these codes but when I run them, I can't get the city codes: import java.util.Scanner; public class Code { public static void main(String[] args) { Scanner sc = new Scanner(System.in); System.out.println("Give the name, Get the code!\n* * * * * * * * * * * * * * *\n"); System.out.print("Please enter the name of the country : "); String countryInput = sc.next().toLowerCase(); System.out.print("Please enter the name of the city : "); String cityInput = sc.next().toLowerCase(); System.out.println("\n-----------------------------"); switch(countryInput) { case "iran" : System.out.print("+98 "); break; case "us" : System.out.print("+1 "); break; default: System.out.print("ERROR: the entered country doesn't exist in program database!"); } if(countryInput=="iran") { switch(cityInput) { case "tabriz" : System.out.print("411"); break; case "tehran" : System.out.print("21"); break; case "mashhad" : System.out.print("511"); break; default : System.out.print("\nERROR: the entered city doesn't exist in program database!"); } } if(countryInput=="us") { System.out.print("(Sorry, the US cities aren't avalable!)"); } System.out.print("\n-----------------------------\nProgrammer: user3891619"); } } And also this one. The program never says "Password is wrong" even when is necessary: import java.util.Scanner; public class Pass { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int pass = 1234 ; System.out.print("Please enter your password: "); if(sc.hasNextInt() &amp;&amp; sc.nextInt() == pass) { System.out.println("The password was successfully entered."); } else { if(sc.hasNextInt()) { System.out.println("The password is wrong."); } else { System.out.println("Password format is incorrect."); } } } }
has answer: http://stackoverflow.com/a/25056303
tagged with: java

http://stackoverflow.com/q/24964454
type: Question
has title: Accessing/creating multi dimensional array in Java
answer count: 2
tagged with: arrays
has answer: http://stackoverflow.com/a/24964532
score: 0
tagged with: multidimensional-array
has answer: http://stackoverflow.com/a/24964501
has comment: http://stackoverflow.com/comment/38803842
possible better answer: http://stackoverflow.com/a/24964532
linked to: http://stackoverflow.com/q/5360628
has comment: http://stackoverflow.com/comment/38804013
tagged with: netbeans
has body: I am fairly new to Java but am trying my best to learn. As a personal experiment I am writing a program that times the film developing process, fairly similar to the 'Massive Dev Chart' for Android and iPhone which I use quite a lot. Following the code at: https://www.youtube.com/watch?v=QeaXXpxNtq0, I have the following code to read a CSV file and generate a 2 dimensional array: static String xStrPath; static String[][] myArray; static void setUpMyCSVArray() { myArray = new String[8702][8]; Scanner scanLn = null; int Rowc = 0; int Row = 0; int Colc = 0; int Col = 0; String InputLine = ""; double xnum = 0; String xfileLocation; xfileLocation = "database.csv"; System.out.println("\n****** Setup Array ******"); try { scanLn = new Scanner(new BufferedReader(new FileReader(xfileLocation))); while (scanLn.hasNextLine()) { InputLine = scanLn.nextLine(); String[] InArray = InputLine.split(","); for (int x = 0; x &lt; InArray.length; x++) { myArray [Rowc] [x] = InArray[x]; } Rowc++; } } catch (Exception e) { System.out.println(e); } System.out.println(Arrays.toString(myArray[0])); } The CSV file looks like this: Film Name Developer Dilution ISO/ASA 35mm 120 Sheet Temperature Adox CHM 125, 510-Pyro, 1+100, 125, 7, , , 21C Adox CHM 125, 510-Pyro, 1+500, 125, 50, , , 21C Adox CHM 125, 777, stock, 100, 12, , , 24C Adox CHM 125, A03, stock, 125, 6.5, , , 20C Adox CHM 125, ACU-1, 1+10, 100, 9, , , 21C Adox CHM 125, Acufine, stock, 125, 4, , , 20C Adox CHM 125, Acufine, stock, 200, 6, , , 20C Adox CHM 125, Acufine, stock, 320, 5, , , 21C When I run: System.out.println(Arrays.toString(myArray[0])); The output is: Adox CHM 125, 510-Pyro, 1+100, 125, 7, , , 21C But I am unable to separate the data on that line, i.e. I want to run System.out.println(Arrays.toString(myArray[0][0])); To output: Adox CHM 125 After many attempts I am a little stuck as to what is going wrong with my code, any help or advice would be much appreciated.
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24964501
tagged with: java

http://stackoverflow.com/a/24917981
accepted answer of: http://stackoverflow.com/q/24917944
upvote count: 5
downvote count: 0
answers question: http://stackoverflow.com/q/24917944
has body: Use StringBuilder : StringBuilder sb = new StringBuilder(); for (int i = 0; i &lt; p; i++) { char c = (char) (r.nextInt(26) + 'a'); sb.append(c); } Then you can call sb.toString() to get the resulting String.
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38716596
has comment: http://stackoverflow.com/comment/38716578
has comment: http://stackoverflow.com/comment/38716622
type: Answer
has comment: http://stackoverflow.com/comment/38716531
has comment: http://stackoverflow.com/comment/38716689
score: 5

http://stackoverflow.com/q/25057379
has comment: http://stackoverflow.com/comment/38978449
has comment: http://stackoverflow.com/comment/38978342
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/38978205
has answer: http://stackoverflow.com/a/25057406
has title: ArrayList will not allow scanner input
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/38978355
type: Question
accepted answer: http://stackoverflow.com/a/25057406
has body: I'm confused about something, again, in my code. I'm a beginner, but I still am familiar with the Scanner class. However, for a generic array, it bypasses the user input of a string. I want to understand why it's not being "collected" for the ArrayList: public static void addingIngredients(){ ArrayList&lt;String&gt; Ingredients = new ArrayList&lt;String&gt;(); String addedIngredient = input.nextLine(); Ingredients.add(addedIngredient); System.out.println(Ingredients +": Continue?" ); System.out.println("1 (Yes) / 2 (No)"); int choice = input.nextInt(); switch (choice){ case 1: addingIngredients(); case 2: System.out.println("Test"); } } The String "addedIngredient" is being skipped; This is what I'm receiving via console: Now Loading... What Ingredients are in this protein powder? Begin Add? 1 (Yes) / 2 (No) 1 []: Continue? 1 (Yes) / 2 (No) 1 []: Continue? 1 (Yes) / 2 (No) 2 Test Thank you in advance. P.S: Is there a more convenient way to write a loop to collect data from the user?

http://stackoverflow.com/comment/38737201
type: Comment
type: QuestionComment
has text: seems like the daemon thread is lingering for a couple of seconds after the `main()` ends and before the JVM actually shuts down.. that's why its writing only once. This might just be a matter of *delay* in shutting down the JVM.
comment on: http://stackoverflow.com/q/24929265
score: 0

jdialog
type: Tag
tags question: http://stackoverflow.com/q/25045437
tag name: jdialog
tags question: http://stackoverflow.com/q/25007303
tags question: http://stackoverflow.com/q/25068926
tags question: http://stackoverflow.com/q/24922088

http://stackoverflow.com/comment/38932177
comment on: http://stackoverflow.com/q/25032280
has text: well it worked. But I have >80 enities so I dont' want to write each entity in persistent.xml
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26708932
score: 4
upvote count: 4
type: AcceptedAnswer
has body: My go to solution in cases like this where what your code should be doing is always doing it manually, then figuring out the essence of how it is that I am tackling the solution. For this problem I found myself looking at possible subsets of the original array, then looking backwards through the original array to see if I can find that same subset again. Next, I translated that into pseudocode, for each segment in nums check if nums contains segment backwards Repeated, but this time with more implementation details worked out. for each segment in nums, starting with the largest reverse the segment check if nums contains reversed segment if it does, return the size of that segment Next, find some likely candidates for methods in the pseudocode and write them. I chose to do this for "reverse" and "contains": private int[] reverse(int[] nums) { int[] rtn = new int[nums.length]; for (int pos = 0; pos &lt; nums.length; pos++) { rtn[nums.length - pos - 1] = nums[pos]; } return rtn; } private boolean contains(int[] nums, int[] segment) { for (int i = 0; i &lt;= nums.length - segment.length; i++) { boolean matches = true; for (int j = 0; j &lt; segment.length; j++) { if (nums[i + j] != segment[j]) { matches = false; break; } } if (matches) return true; } return false; } Finally, implement the rest: public int maxMirror(int[] nums) { for (int window = nums.length; window &gt; 0; window--) { for (int pos = 0; pos &lt;= nums.length - window; pos++) { int[] segment = new int[window]; for (int innerpos = 0; innerpos &lt; window; innerpos++) { segment[innerpos] = nums[pos + innerpos]; } segment = reverse(segment); if (contains(nums, segment)) { return window; } } } return 0; }
type: Answer
answers question: http://stackoverflow.com/q/24986982
accepted answer of: http://stackoverflow.com/q/24986982
downvote count: 0

http://stackoverflow.com/comment/38746559
comment on: http://stackoverflow.com/q/24933492
type: Comment
type: QuestionComment
has text: @TheLostMind, lol thank you. But it lacks detail, and I lack the time right now to flesh it out. Feel free to run with it.
score: 1

http://stackoverflow.com/q/25057589
downvote count: 0
answer count: 0
type: UnansweredQuestion
has title: Eclipse complaining over resource leak when not closing ServletOutputStream
type: Question
score: 1
has comment: http://stackoverflow.com/comment/38978688
tagged with: java
tagged with: eclipse
tagged with: servlets
has body: Regarding this code: void process( HttpServletResponse response ){ ServletOutputStream out = respones.getOutputStream(); out.print( " Test " ); } Eclipse complains of a potiential resouce leak because of not closing the ServletOutputStream and I might be tempted to rewrite it as such: void process( HttpServletResponse response ){ try( ServletOutputStream out = respones.getOutputStream() ){ out.print( " Test " ); } } which makes the warning go away (and for the sake of this argument I don't have to write anything else to the response). As of this answer: Should one call .close() on HttpServletResponse.getOutputStream()/.getWriter()? it seems to be general consensus not closing the ServletOutputStream and there are good arguments for it. So is Eclipse plain wrong with this and I should add an @IgnoreWarning or are there new arguments that now having Try-With-Resource I should close it indeed?
upvote count: 1
favorite count: 0
tagged with: outputstream

http://stackoverflow.com/a/24947698
type: AcceptedAnswer
has body: You're accessing a separate list instance in each of your threads. Since each list is only accessed by one thread, you can't get a concurrency error. List list = new ArrayList&lt;String&gt;(); That declares an instance field. Therefore, each call to new ThreadTest() creates a new list. In order to make all the ThreadTest instances use the same list, try making the field static (i.e. a class field): static List list = new ArrayList&lt;String&gt;(); As for how an error can happen, take a look at the code for ArrayList's add method: public boolean add(E e) { ensureCapacityInternal(size + 1); // Increments modCount!! elementData[size++] = e; return true; } If two threads call add at the same time, they could process the elementData[size++] = e statement at the same time. The size field is not declared volatile; therefore, the two threads could end up writing to the same index in the elementData array. Even if size were declared volatile, the size++ operation is not atomic. See How to model a situation, when i++ is corrupted by simultaneously executing threads? for an example of how an operation like size++ can fail in a multithreaded environment. Finally, if you don't understand what volatile and atomic mean in the Java context, you really need to read up on concurrent programming in Java before you write any multithreaded code. It will be a worthwhile investment as you'll save yourself a lot of headaches by understanding these concepts.
type: Answer
accepted answer of: http://stackoverflow.com/q/24947530
downvote count: 0
answers question: http://stackoverflow.com/q/24947530
has comment: http://stackoverflow.com/comment/38775867
score: 1
upvote count: 1

http://stackoverflow.com/comment/39000548
has text: Where are you calling the method? You should only call the method in if( press == 0 ) {}
type: Comment
score: 0
comment on: http://stackoverflow.com/q/25068799
type: QuestionComment

http://stackoverflow.com/q/25035009
favorite count: 0
has comment: http://stackoverflow.com/comment/38937524
has comment: http://stackoverflow.com/comment/38935854
has comment: http://stackoverflow.com/comment/38940880
tagged with: spring
has comment: http://stackoverflow.com/comment/38941820
has title: Enforce initialization of Spring Bean which's reference is not explicitly used
has comment: http://stackoverflow.com/comment/38967152
has comment: http://stackoverflow.com/comment/38937097
has comment: http://stackoverflow.com/comment/38937445
has comment: http://stackoverflow.com/comment/38936427
type: UnansweredQuestion
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/38938088
has comment: http://stackoverflow.com/comment/38935930
has comment: http://stackoverflow.com/comment/38936433
tagged with: java
has comment: http://stackoverflow.com/comment/38951721
type: Question
has comment: http://stackoverflow.com/comment/38937192
has comment: http://stackoverflow.com/comment/38937067
has answer: http://stackoverflow.com/a/25035148
answer count: 1
downvote count: 0
has body: Is there a way to enforce the initialization of a Spring Bean in cases that the reference of the bean is never explicitly used or even requested in the ApplicationContext? &lt;bean class="foo.bar.FooBar&gt; &lt;property name="fooBar" ref="foo.bar.reference"/&gt; &lt;/bean&gt; This bean is meant to do things inside, get's properties passed by IoC but it is never used by any other bean which implies that the it's reference is nowhere else configured. My problem is, that this bean seems not to be initialized because of that. I tried &lt;bean .. lazy-init="false"/&gt; but this did not do the trick. How can ensure the bean is going to be initialized? Since I cannot modify the application context, I would need a way doing it just in the XML configuration.

http://stackoverflow.com/q/25055878
tagged with: java
has body: Here is my registerController: collectionsApp.controller('registerController', function($scope, userService) { $scope.register = function() { userService.register($scope.user); }; }); Here is my serviceController: collectionsApp.service('userService', function($http) { return { login : function(user) { $http.post('/user/login', user).then(function(data) { return data; }); }, register : function(user) { $http.post('/user/add', user).then(function(data) { }); } }; }); When I hit interface button that has data-ng-click="register(user)" registration works just fine BUT when I want to add simple test feedback message responded from backend in data object and edit my registerController like this: collectionsApp.controller('registerController', function($scope, userService) { $scope.register = function() { userService.register($scope.user); }; userService.register = function(data) { if (data.status === "success") { alert("OK"); } else { alert("NOT OK"); } }; }); Now I am not able to register new (there are no new user written to db) but I get this "NOT OK" alert every time... Can someone help me fix and understand this mechanism? How to get this status, check it, and send it to view (redirect registered user to new page)? Thanks in advance...
has title: AngularJS - userService, registerControll: broken code in registerController, not registering user and returning wrong alert
downvote count: 0
tagged with: javascript
type: UnansweredQuestion
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/38975514
has answer: http://stackoverflow.com/a/25056228
score: 1
has answer: http://stackoverflow.com/a/25056256
tagged with: angularjs
answer count: 2
upvote count: 1
tagged with: spring-mvc
tagged with: model-view-controller

http://stackoverflow.com/a/61979232
downvote count: 0
answers question: http://stackoverflow.com/q/25049021
has body: I tried this out with the following code: ScheduledExecutorService scheduler = Executors.newSingleThreadScheduledExecutor(); AtomicInteger count = new AtomicInteger(0); Runnable task = () -&gt; { int currentCount = count.incrementAndGet(); System.out.println("Task #" + currentCount + " started"); if (currentCount == 2) { System.out.println("Shutting down scheduler..."); scheduler.shutdown(); } try { Thread.sleep(1000); } catch (InterruptedException ie) { throw new RuntimeException(ie); } System.out.println("Task #" + currentCount + " finished"); }; System.out.println("Starting scheduler..."); ScheduledFuture&lt;?&gt; scheduledFuture = scheduler.scheduleWithFixedDelay( task, 0, 2, TimeUnit.SECONDS); System.out.println("Getting scheduled future..."); System.out.println(scheduledFuture.get()); System.out.println("End of code reached."); Here is the output: Exception in thread "main" java.util.concurrent.CancellationException at java.base/java.util.concurrent.FutureTask.report(FutureTask.java:121) at java.base/java.util.concurrent.FutureTask.get(FutureTask.java:191) at Rextester.main(source.java:33) Starting scheduler... Getting scheduled future... Task #1 started Task #1 finished Task #2 started Shutting down scheduler... Task #2 finished Online Rextester Demo: https://rextester.com/LYKN32123 Not sure how useful this is but it shows the get() method throws a CancellationException if the scheduler is shut down.
upvote count: 2
type: Answer
score: 2

http://stackoverflow.com/a/24947349
has comment: http://stackoverflow.com/comment/38772780
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/38772488
has comment: http://stackoverflow.com/comment/38772726
has comment: http://stackoverflow.com/comment/38773003
has comment: http://stackoverflow.com/comment/38772660
has body: You haven't closed the <web-api> in web.xml using /web-api> at the end. SO,it might be giving error. Also,it is better to keep after the servlet-mapping parameters. Just try the following piece of code in web.xml(COPY-PASTE my code in your web.xml) :- <?xml version="1.0" encoding="UTF-8"?> restapi/TEST_Authenticate.java TEST_Authenticate restapi.TEST_Authenticate TEST_Authenticate /TEST_Authenticate 30 EDIT ---> By default,the welcome page is set to index.jsp in a web-application project in NetBeans IDE. So,if you don't specify anything even then it'll search for that file only and open it. If you want to open a specific page,edit the login.jsp and replace the login.jsp with your_required_jsp_page. I hope it answers your question. Feel free to comment if it doesn't help.
has comment: http://stackoverflow.com/comment/38772350
has comment: http://stackoverflow.com/comment/38772909
has comment: http://stackoverflow.com/comment/38773048
has comment: http://stackoverflow.com/comment/38772916
upvote count: 1
has comment: http://stackoverflow.com/comment/38772842
has comment: http://stackoverflow.com/comment/38772697
has comment: http://stackoverflow.com/comment/38772601
has comment: http://stackoverflow.com/comment/38772985
has comment: http://stackoverflow.com/comment/38772634
answers question: http://stackoverflow.com/q/24942153
type: Answer
has comment: http://stackoverflow.com/comment/38772694

http://stackoverflow.com/comment/39004256
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25047290
score: 4
has text: My memory is returning slightly on `strictfp`. If you *did not* specify `strictfp` then the JVM is at (some) liberty to carry intermediate values as 80-bit rather than 64-bit quantities. (With `strictfp`, after every computation any intermediate values must be "narrowed" to 64 bits.) Whether or not a value is "narrowed" can make a 1-lsb difference in the result (probably about half the time). Likely when the OP removed the "useless" "grid squares" (or whatever they were) it removed some adds of 0.0 or some such and changed which values get coerced to 64 bits when.

http://stackoverflow.com/comment/38867469
score: 1
comment on: http://stackoverflow.com/q/24972709
type: Comment
type: QuestionComment
has text: Is this a web application/standalone? how do you run this project? you need to provide more information

http://stackoverflow.com/comment/38846043
type: AnswerComment
has text: Yes you can call the function,but its more maintainable, imagine typing this in everywhere you want it`(max3(a, b, c)` than `maxValue`, also waht if you want to do something on your `maxValue` like `maxValue` * 3? if you are not using a new variable, you have go to all your lines of code with this `max3(a, b, c) * 3`, its messy and hard to maintain.
type: Comment
comment on: http://stackoverflow.com/a/24986901
score: 1

http://stackoverflow.com/comment/38958258
has text: Are we arguing word choice in the comments? Define *[implicitly](https://www.google.com/search?q=define%20implicitly)*: without qualification: absolutely. If you think it's important, feel free to submit an edit for moderation.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25046223
type: Comment

http://stackoverflow.com/comment/38934022
type: AnswerComment
score: 3
type: Comment
comment on: http://stackoverflow.com/a/25007460
has text: Hello Daniel. Thanks for your help. It fits pretty much what I wanted.

http://stackoverflow.com/q/24940260
tagged with: active-directory
has title: add user certificate to Active Directory - Java
answer count: 1
has body: I have inherited this code that pulls a userCertificate out of AD: byte[] userCERT = (byte[])attribs.get("userCertificate").get(); ByteArrayInputStream bais = new ByteArrayInputStream( (userCERT)) ; CertificateFactory cf = CertificateFactory.getInstance("X.509"); X509Certificate cert = (X509Certificate)cf.generateCertificate(bais); What I need to do now is the exact opposite. A user will submit via the web, their public key. Is it as simple as taking the String and doing a toBytes() on it like this: ByteArrayInputStream bais = new ByteArrayInputStream(userCertificateString.getBytes()) ; Attribute modCert = new BasicAttribute("userCertificate", bais); mods[0] = new ModificationItem(context.REPLACE_ATTRIBUTE, modCert); context.modifyAttributes(dn + "," + searchBase, mods); UPDATE: It is not this simple. This does not work. any guidance would be great.
has answer: http://stackoverflow.com/a/25144605
type: UnansweredQuestion
tagged with: x509certificate
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/38787732
type: Question

http://stackoverflow.com/q/24939212
has comment: http://stackoverflow.com/comment/38761432
has comment: http://stackoverflow.com/comment/38760927
score: 0
has comment: http://stackoverflow.com/comment/38764301
has comment: http://stackoverflow.com/comment/38759636
tagged with: log4j
has title: Migrating log4j 1.2.17 from JBoss AS 7.1.1 Final to JBoss EAP 6.2
accepted answer: http://stackoverflow.com/a/24959679
has comment: http://stackoverflow.com/comment/38764273
has body: I am migrating my application server from JBoss AS 7.1.1 Final to JBoss EAP 6.2. However, I am having some issues with the Apache log4j 1.2.17 and EAP 6.2. In AS 7.1.1 I didn't have to do anything other than have the log4j.jar in the build path of the project I was working on in Eclipse. The logs I wanted were defined within the JBoss standalone.xml and were created whenever I started the server. I am using JAR files, not WAR or EAR files for the deployment of my applications. Now when migrating to EAP 6.2 I am trying to make everything local in my Eclipse structure. I set the per-deployment setting in the standalone.conf to false as shown below: JAVA_OPTS="$JAVA_OPTS -Dorg.jboss.as.logging.per-deployment=false" I created a META-INF folder in my project src folder with the file jboss-deployment-structure.xml with the following: &lt;jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.2"&gt; &lt;deployment&gt; &lt;dependencies&gt; &lt;module name="com.log4j.mylog4j" export="true" /&gt; &lt;/dependencies&gt; &lt;exclusions&gt; &lt;module name="org.apache.log4j" /&gt; &lt;/exclusions&gt; &lt;/deployment&gt; I also placed the log4j.properties in the src folder with the definition of rootlogger and all of the individual loggers. However, whenever I try to log anything within my application I get the warning: log4j:WARN No appenders could be found for logger log4j:WARN Please initialize the log4j system properly. log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info. Any help would be greatly appreciated.
has comment: http://stackoverflow.com/comment/38760581
tagged with: logging
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38763737
tagged with: java
tagged with: jboss
tagged with: eclipse
has comment: http://stackoverflow.com/comment/38763273
has comment: http://stackoverflow.com/comment/38760378
has answer: http://stackoverflow.com/a/24959679
answer count: 1

http://stackoverflow.com/q/24950586
has answer: http://stackoverflow.com/a/24991702
type: Question
has answer: http://stackoverflow.com/a/37877827
answer count: 2
has comment: http://stackoverflow.com/comment/38777909
tagged with: string
score: 4
linked to: http://stackoverflow.com/q/12203003
favorite count: 0
tagged with: parsing
possible better answer: http://stackoverflow.com/a/37877827
has comment: http://stackoverflow.com/comment/38778707
downvote count: 0
has title: Parse parenthesized Boolean String Expressions with Java
tagged with: boolean-expression
accepted answer: http://stackoverflow.com/a/24991702
upvote count: 4
has body: I need to evaluate a parenthesized boolean expression I receive in a String. Since I need to deal with variable expression i need to find a way to parse it into a boolean expression to evaluate it in java. An example for an String expression is: String boolexpr1 = "(!(true||false)&amp;&amp;!((true)^(true)))" The possible operators are parentheses, AND, OR, XOR, NOT. Since this is already a Java-processable expression I thought it should be easy to parse it, but couldn't think of a elegant solution. I also found some code online, but it either deals with other/less operators, without parentheses or is still too complex.
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38777797
tagged with: java
tagged with: evaluation
has comment: http://stackoverflow.com/comment/38777823

http://stackoverflow.com/comment/48868145
score: 0
has text: Your solution works in one of my project but for another project it is not working.
type: Comment
comment on: http://stackoverflow.com/a/25821440
type: AnswerComment

http://stackoverflow.com/q/25063995
has body: Does anyone know how to get a handle the Hibernate SessionFactory that is created by Spring Boot?
has comment: http://stackoverflow.com/comment/38991385
has answer: http://stackoverflow.com/a/29571677
has answer: http://stackoverflow.com/a/55539377
linked to: http://stackoverflow.com/q/5640778
downvote count: 1
answer count: 7
accepted answer: http://stackoverflow.com/a/25064080
has answer: http://stackoverflow.com/a/37948844
has answer: http://stackoverflow.com/a/53397754
favorite count: 0
upvote count: 74
has answer: http://stackoverflow.com/a/33881946
has answer: http://stackoverflow.com/a/25064080
tagged with: spring
has title: Spring Boot - Handle to Hibernate SessionFactory
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/33881946
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/65550465
type: Question
tagged with: spring-boot
score: 73

http://stackoverflow.com/a/68010496
score: 1
upvote count: 1
downvote count: 0
has body: In addition to the above answer, I was working with Jetty 11 Http Client and realized that req.header has been deprecated in the latest release. ( 11.0.5 ). As a result I had to figure out a way send authentication headers with Jetty Http Client 11. This is how I did it. Pay attention to line 4. httpClient.start(); URI uri = UriBuilder.fromUri(URI.create(ENDPOINT)).path("v1/testPath").queryParam("testParam","testValue").build(); InputStreamResponseListener listener = new InputStreamResponseListener(); //Required for large responses only httpClient.newRequest(uri).method(HttpMethod.GET).headers(httpFields -> httpFields.add("Authorization","Bearer "+token)).send(listener); Response response = listener.get(20, TimeUnit.SECONDS); if(response.getStatus() == 200){ //doSomething. }
type: Answer
answers question: http://stackoverflow.com/q/24920302

http://stackoverflow.com/comment/38891185
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25010929
has text: use Html.fromHtml("your text"); example :-- myTextView.setText(Html.fromHtml(" Title Description here "));
score: 0

http://stackoverflow.com/q/25016055
has comment: http://stackoverflow.com/comment/38901283
tagged with: adjacency-matrix
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/25017238
has comment: http://stackoverflow.com/comment/38901168
has body: I have a network graph with nodes and edges and i managed to construct an adjacent matrix of my graph. sample adjacent matrix with edge weight Nodes -> {A, B, C, D} Edges -> {[A->B = 2] , [A->D = 5] , [C->A = 1] , [C->B = 4] , [D->B = ] , [D->C = 2]} my adjacent network is like this 0 2 0 2 0 0 0 0 4 4 0 0 0 6 6 0 so i want to change the adjacent matrix to be like this with labels of the nodes and average of each column by considering non zero cells A B C D A 0 2 0 2 B 0 0 0 0 C 4 4 0 0 D 0 6 6 0 X 4 4 6 2 &lt;- Mean of non zero column here is my the code i used to create adjacent matrix, Node.java public class Node { public char label; public Node(char l) { this.label=l; } } Graph.java public class Graph { public ArrayList nodes=new ArrayList(); public double[][] adjacentMatrix; int size; public void addNode(Node n) { nodes.add(n); } public void addEdge(Node start,Node end,int weight) { if(adjacentMatrix==null) { size=nodes.size(); adjacentMatrix=new double[size][size]; } int startIndex=nodes.indexOf(start); int endIndex=nodes.indexOf(end); adjacentMatrix[startIndex][endIndex]=weight; } public static void printAdjacentMatrix(double matrix[][]) { for (int row = 0; row &lt; matrix.length; row++) { for (int column = 0; column &lt; matrix[row].length; column++) { System.out.print(matrix[row][column] + " "); } System.out.println(); } } } Main.java public class Main { public static void main(String[] args) { // TODO Auto-generated method stub //Defining nodes Node nA=new Node('A'); Node nB=new Node('B'); Node nC=new Node('C'); Node nD=new Node('D'); //Creating adjacent matrix Graph g=new Graph(); g.addNode(nA); g.addNode(nB); g.addNode(nC); g.addNode(nD); g.addEdge(nA, nB, 2); g.addEdge(nA, nD, 2); g.addEdge(nC, nA, 4); g.addEdge(nC, nB, 4); g.addEdge(nD, nB, 6); g.addEdge(nD, nC, 6); g.printAdjacentMatrix(g.adjacentMatrix); } } so i ask for help to display the second matrix with average and labels...Thank you in advance
has title: Manipulating adjacent matrix
has answer: http://stackoverflow.com/a/25017238
answer count: 1
downvote count: 0
favorite count: 0

http://stackoverflow.com/a/25010861
score: 1
has comment: http://stackoverflow.com/comment/38893689
upvote count: 1
has body: someField is a private variable when enums are static variables. You cant assign non static variable to static variable in this way.
downvote count: 0
answers question: http://stackoverflow.com/q/25010763
has comment: http://stackoverflow.com/comment/38890711
has comment: http://stackoverflow.com/comment/38890683
type: Answer

http://stackoverflow.com/q/24945515
has comment: http://stackoverflow.com/comment/38768508
favorite count: 0
possible better answer: http://stackoverflow.com/a/24945543
has answer: http://stackoverflow.com/a/24945602
answer count: 4
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24945606
has body: So I have a simple code similar to a digital math test (only 1 question though). I want the program to scan what I type in the input window, and the print the results whether I was right or wrong in a new text file. The problem is I can not find the text file in my project in eclipse, instead I have to locate my projects folder and find the .txt file there instead. Is it possible to make the .txt file visible inside my project in eclipse? Thanks! ... also, how do you do quote marks inside of quote marks in java? I mean like "You answered "500" ". package Default; import java.io.File; import java.io.FileNotFoundException; import java.io.PrintStream; import java.util.Scanner; public class MathTest { public static void main(String args[]) throws FileNotFoundException { String Canswer = "270"; String X; PrintStream file = new PrintStream(new File("Test results.txt")); Scanner scan = new Scanner(System.in); System.out.println("This is a test, please answer the question correctly."); System.out.println("What is 50*50/100-20+(800/20) ?"); X = scan.nextLine(); System.out.println("That concludes this test, your test results will be available" + " in ´Test results."); if (X.equals(Canswer)) { file.println("You answered " + X); file.println("That is correct, well done!"); } else { file.println("You answered " + X + "."); file.println("The correct answer was " + Canswer); file.println("You have failed this test."); } } }
downvote count: 0
score: 1
type: Question
has answer: http://stackoverflow.com/a/24945543
tagged with: java
has title: I want java to create a new file with ...new PrintStream... it all works fine, but I can't find the file in my project
tagged with: eclipse
has answer: http://stackoverflow.com/a/24945645
upvote count: 1
accepted answer: http://stackoverflow.com/a/24945645
has comment: http://stackoverflow.com/comment/38768437

http://stackoverflow.com/comment/61481582
has text: I get why he wants to do this. I'd like to do the same to add Linq-style code into Java. It is inconvenient that you can't declare an array `Thing[] list = new Thing[100];`, access elements using array syntax 'Thing thisThing = list[50];` and also use extension methods: 'Thing[] subset = list.Where( new Comparator<Thing>,,, ). And you can't override the [] operator to simplify code either.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24913784
score: 1

http://stackoverflow.com/comment/38892228
score: 0
type: Comment
type: QuestionComment
has text: I am newbie and if installer is concerned, this is my first attempt. I rather acknowledge the fact that its not a good idea, but then help me to get to the right way. Firstly, to locally ship a mysql and then changing settings to listen to different port...
comment on: http://stackoverflow.com/q/25011177

http://stackoverflow.com/comment/38910728
comment on: http://stackoverflow.com/q/25021354
has text: It's called [Operator Precedence](http://docs.oracle.com/javase/tutorial/java/nutsandbolts/operators.html).
type: Comment
type: QuestionComment
score: 11

http://stackoverflow.com/comment/38904561
has text: And, `""` isn't a valid double.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25018095

http://stackoverflow.com/q/25008212
answer count: 2
downvote count: 0
has title: Merge two list on the basis of employee Alphabet (sort)
has answer: http://stackoverflow.com/a/25008289
favorite count: 0
tagged with: android
upvote count: 1
possible better answer: http://stackoverflow.com/a/25008270
has body: I have two list which contain header as Alphabet and the name of Employee List&lt;Item&gt; list1 = new ArrayList&lt;Item&gt;(); List&lt;Item&gt; list2 = new ArrayList&lt;Item&gt;(); public List&lt;Item&gt; getList1() { list1.add("A"); list1.add("A1"); list1.add("A2"); list1.add("A3"); list1.add("B"); list1.add("B1"); list1.add("B2"); list1.add("B3"); list1.add("C"); list1.add("C1"); list1.add("C2"); list1.add("C3"); return list1; } public List&lt;Item&gt; getList2() { list2.add("A"); list2.add("A4"); list2.add("A5"); list2.add("A6"); list2.add("B"); list2.add("B4"); list2.add("B5"); list2.add("B6"); list2.add("C")); list2.add("C4"); list2.add("C5"); list2.add("C6"); return list2; } I want to merge two list basis of alphabet and output should be like below list1.add("A"); list1.add("A1"); list1.add("A2"); list1.add("A3"); list1.add("A4"); list1.add("A5"); list1.add("A6"); list1.add("B"); list1.add("B1"); list1.add("B2"); list1.add("B3"); list1.add("B4"); list1.add("B5"); list1.add("B6"); list1.add("C"); list1.add("C1"); list1.add("C2"); list1.add("C3"); list1.add("C4"); list1.add("C5"); list1.add("C6"); Please anyone let me know that How two array list will be merge according to alphabet like A,B,C etc.
accepted answer: http://stackoverflow.com/a/25008289
has answer: http://stackoverflow.com/a/25008270
type: AnsweredQuestion
score: 1
tagged with: java
type: Question

unsupported-class-version
type: Tag
tags question: http://stackoverflow.com/q/24978867
tag name: unsupported-class-version

http://stackoverflow.com/q/24985836
type: Question
has body: I need to update my columns using JAVA Handle and create statement, but from what I have researched I need to be using batch if its all (or most) of the columns I desired to update? This is the code i've written thus far: private int deletePlayer(Handle handle, String username, String table) { logger.debug("Deleting from table " + table); String sqlCommand; sqlCommand = String.format("UPDATE %s SET rank = 1 " + "SET level = 1 " + "SET exp = 0 " + "SET prof = '' " + "SET guild = '' " + "SET varname = '' " + "WHERE name = :username", table); handle.createStatement(sqlCommand) .bind("username", username) .execute(); return 1; } I broke it up to try and pinpoint the problem and found that the MySQL Command: sqlCommand = String.format("UPDATE %s SET varname = '' WHERE name = :username", table); And the like is not working. This is more than likely because of the string/char concatenation. Also, should I be using batch instead? Stack Trace: [Ljava.lang.StackTraceElement;@15b2043 Please, if you are going to make this post down please tell me why and I will be more than happy to fix it to your liking, or clarify, so that it adheres to the forum conduct/terms of service/ et cetera.
has comment: http://stackoverflow.com/comment/38843782
has comment: http://stackoverflow.com/comment/38844064
tagged with: java
score: 0
has comment: http://stackoverflow.com/comment/38844026
answer count: 1
has answer: http://stackoverflow.com/a/24986760
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38845051
tagged with: mysql
has comment: http://stackoverflow.com/comment/38843724
has title: how to update a sql varchar column using JAVA handle createStatement INNO DB
has comment: http://stackoverflow.com/comment/38844032

http://stackoverflow.com/comment/38959212
comment on: http://stackoverflow.com/q/25046815
type: Comment
type: QuestionComment
has text: Put quite frankly there is no easy platform neutral way to do it so you may want to list your OS details...
score: 1

http://stackoverflow.com/a/24982360
downvote count: 0
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/24982318
score: 1
has body: One typical model for your situation is to use: Service for long running communication (taking "orders" from a queue BroadcastReceiver to be notified about asynchronous events handled by Service Activity to handle UI One reference to consider looking at is here

http://stackoverflow.com/a/24973361
has comment: http://stackoverflow.com/comment/38820315
downvote count: 0
has body: From PostgreSQL doc : PREPARE creates a prepared statement. A prepared statement is a server-side object that can be used to optimize performance. When the PREPARE statement is executed, the specified statement is parsed, analyzed, and rewritten. When an EXECUTE command is subsequently issued, the prepared statement is planned and executed. This division of labor avoids repetitive parse analysis work, while allowing the execution plan to depend on the specific parameter values supplied. moe was right : preparing a query will only remove the overhead of reparsing it again and again. The planing is done only when you will execute the prepared query with its parameters.
answers question: http://stackoverflow.com/q/24973259
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/38820295
score: 1
accepted answer of: http://stackoverflow.com/q/24973259
type: AcceptedAnswer

http://stackoverflow.com/a/25059517
upvote count: 2
type: Answer
answers question: http://stackoverflow.com/q/25059482
score: 2
has body: You kill the service, but the alarm is still set, you have to cancel the pending intent from the alarm manager in onDestroy
downvote count: 0

http://stackoverflow.com/comment/38971212
score: 0
type: Comment
type: QuestionComment
has text: No.i have seen that question but not same as my requirement as i want to allow new user to login and logout the previous login user.i used session timeout when user closes the browser or in case of crash server in my application.
comment on: http://stackoverflow.com/q/25052679

http://stackoverflow.com/q/25056289
answer count: 1
tagged with: pbkdf2
accepted answer: http://stackoverflow.com/a/25056766
has comment: http://stackoverflow.com/comment/38976468
has body: Is this a good implementation of PBKDF2? https://crackstation.net/hashing-security.htm#javasourcecode I'm not sure that is a good idea to store password like: pass = PBKDF2_ITERATIONS + ":" + toHex(salt) + ":" + toHex(hash); Is there some other implementation?
type: AnsweredQuestion
tagged with: passwords
has comment: http://stackoverflow.com/comment/38976305
has title: Is this PBKDF2 java implementation, a good implementation? Is up to date?
tagged with: java
has answer: http://stackoverflow.com/a/25056766
has comment: http://stackoverflow.com/comment/38977318
type: Question
score: 0

http://stackoverflow.com/comment/38901596
type: Comment
comment on: http://stackoverflow.com/q/25015978
has text: Yes, I tried this. It didn't change anything.
score: 0
type: QuestionComment

http://stackoverflow.com/q/24931201
has title: java PHP regex expression
type: Question
downvote count: 4
upvote count: 0
has comment: http://stackoverflow.com/comment/38740597
answer count: 1
tagged with: regex
favorite count: 0
score: -4
tagged with: php
has answer: http://stackoverflow.com/a/24931246
type: AnsweredQuestion
has body: i need help to validate expression for grid two characters and 1 to 3 numbers the minimum user can enter is AA1 the maximum user can enter is FZ280 everything between can be entered meens: first two character of string between AA and FZ pos of string: pos 1: uppercase character from A-F pos 2: uppercase character from A-Z pos 3: number if pos 4 and pos 5 not entered THEN from 1-9 ELSE from 1-2 pos 4: number if pos 5 not entered THEN from 0-9 ELSE from 1-8 pos 5: number from 1-9 white space and special characters are not allowed examples: Valid = AA1, AA29, BB89, etc... AB101, FZ207, inValid = AA0, AA01, AA001, GAxxx, a1, A1, I need this for JAVA and after for PHP I spend now to much time on this, i hope somebody can help me Thanks
tagged with: java
accepted answer: http://stackoverflow.com/a/24931246

http://stackoverflow.com/q/24951237
has answer: http://stackoverflow.com/a/25134566
has comment: http://stackoverflow.com/comment/38779033
answer count: 4
has answer: http://stackoverflow.com/a/24952964
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24951393
downvote count: 1
has answer: http://stackoverflow.com/a/24952027
type: Question
upvote count: 5
tagged with: java
tagged with: this
linked to: http://stackoverflow.com/q/17722902
score: 4
has title: Chaining methods on a subclass object, methods that return this from both classes
favorite count: 0
has body: I have 2 classes: public class A { private final List&lt;String&gt; list; public A() { list = new ArrayList&lt;String&gt;(); } public A first(String s) { list.add(s); return this; } public A second() { System.out.println(list); return this; } } public class B extends A { public B bfisrt() { System.out.println("asd"); return this; } } and a class with main, the following code in main work B b = new B(); b.first("unu") .second(); b.bfirst(); but I would like to chain methods from both class on the same object. Is that posible? Like B b = new B(); b.first("unu") .second() .bfisrt();
tagged with: subclass

http://stackoverflow.com/q/25040837
score: 4
upvote count: 4
has comment: http://stackoverflow.com/comment/38947108
has comment: http://stackoverflow.com/comment/38947123
downvote count: 0
answer count: 1
has body: I am trying to understand the concept of Bridge Method creation, and was stuck on the example given on the Oracle Java Docs. Below are the example for reference Given are the following two classes: public class Node&lt;T&gt; { private T data; public Node(T data) { this.data = data; } public void setData(T data) { System.out.println("Node.setData"); this.data = data; } } public class MyNode extends Node&lt;Integer&gt; { public MyNode(Integer data) { super(data); } public void setData(Integer data) { System.out.println("MyNode.setData"); super.setData(data); } } Then it's written that due Type erasure the classes after complilation should become as below: After type erasure, the Node and MyNode classes become: public class Node { private Object data; public Node(Object data) { this.data = data; } public void setData(Object data) { System.out.println("Node.setData"); this.data = data; } } public class MyNode extends Node { public MyNode(Integer data) { super(data); } public void setData(Integer data) { System.out.println(Integer data); super.setData(data); } } So to preserve the polymorphism, a bridge method is entered in Class MyNode class MyNode extends Node { // Bridge method generated by the compiler // public void setData(Object data) { setData((Integer) data); } public void setData(Integer data) { System.out.println("MyNode.setData"); super.setData(data); } // ... } Below are my questions, on how is it solving the polymorphism? Suppose I call setData using the below code MyNode mn = new MyNode(5); mn.setData(new Integer(6)); which method will be called from MyNode, setData(Integer data) or setData(Object data)? When super.setData(data) is called from setData(Integer data) in Class MyNode, how that is getting resolved, because due to Type Erasure there is no setData(Integer int) in the super Class Node? It seems that the polymorphism problem which was explained will still remain after insertion of the Bridge Method by the compiler. Any help/explaination is really …
tagged with: generics
favorite count: 0
has title: Generics Bridge Method --- on Polymorphism
type: UnansweredQuestion
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/5007357
has answer: http://stackoverflow.com/a/25041027

http://stackoverflow.com/comment/38989035
has text: @DavidConrad that solution didn't work because it couldn't handle the spaces between everything and separating apps into one list properly and envs in another properly. Which is why I asked this question on splitting strings
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25061649
type: QuestionComment

http://stackoverflow.com/comment/38891939
type: QuestionComment
has text: Maybe show us what have you tried so far in order for us to help?
score: 0
comment on: http://stackoverflow.com/q/25011439
type: Comment

http://stackoverflow.com/a/25051013
upvote count: 3
has body: It's best to make the objects you use with synchronized private. Since you synchronize on the Downloader, you don't know whether other threads synchronize on the Downloader too. The following listener causes a deadlock: MyProgressListener extends ProgressListener { public Downloader downloader; public void onProgress(int n) { Thread t = new Thread() { @Override public void run() { synchronized(downloader) { // do something ... } } }; t.start(); t.join(); } } Code that deadlocks: Downloader d = new Downloader(...); MyProgressListener l = new MyProgressListener(); l.downloader = d; d.addListener(l); d.run(); The following will happen if you run that code: the main thread reaches the updateProgress and aquires a lock on the Downloader the MyProgressListener's onProgress method is called and the new thread t is started the main thread reaches t.join(); In this situation the main thread cannot procede until t is finished, but for t to finish, the main thread would have to release it's lock on the Downloader, but that won't happen since the main thread can't procede -> Deadlock
score: 3
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25050574
answers question: http://stackoverflow.com/q/25050574
type: Answer

http://stackoverflow.com/comment/38980149
has text: Not necessarily. If you run the GC one million times, then you'll see a similar effect.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25058368
type: Comment

http://stackoverflow.com/a/25035695
answers question: http://stackoverflow.com/q/25035466
score: 0
has body: You try to call the private member of a specific object. To access base, you would have to make it static. But then every triangle has the same base value.
type: Answer

http://stackoverflow.com/comment/38911019
comment on: http://stackoverflow.com/q/25021285
type: Comment
type: QuestionComment
score: 0
has text: You can do what you're trying to do (decompile, change the code and put it back in same place), but it would be very difficult because your project may have lot of dependencies which need to be available at compile time which may not available after decompilation.

http://stackoverflow.com/a/24986604
has body: No need to null variables, new java and C#/C++ engines will take care of garbage collection and RAM would not be lost.
type: Answer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24986568
has comment: http://stackoverflow.com/comment/38845255
answers question: http://stackoverflow.com/q/24986568
score: 3
has comment: http://stackoverflow.com/comment/38845261
upvote count: 3
type: AcceptedAnswer

http://stackoverflow.com/q/24939766
type: UnansweredQuestion
has body: I am working on an android app that uses Facebook SDK. Using Facebook SDK forces me to use certain methods that doesn't allow me to get an arraylist values from method into a global field. Here is my code from the ListFragment class public class SelectionFragment extends ListFragment { private static final String TAG = "SelectionFragment"; public static final String PAGE_URL = "1438734076389483/feed"; private static final int REAUTH_ACTIVITY_CODE = 100; private static final String[] FROM = { "message", "crated_time", "likes" }; private static final int[] TO = { R.id.feed_box, R.id.created_time, R.id.like_count }; ArrayList&lt;HashMap&lt;String, String&gt;&gt; feedsList; @Override public void onAttach(Activity activity) { Log.d(TAG, "onAttach method is called"); feedsList = new ArrayList&lt;HashMap&lt;String,String&gt;&gt;(); super.onAttach(activity); } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { Log.d(TAG, "onCreateView method is called"); //super.onCreateView(inflater, container, savedInstanceState); // Check for an open session final Session session = Session.getActiveSession(); if (session != null &amp;&amp; session.isOpened()) { // Get the page's feed makePageRequest(session); Log.d(TAG, "makePageRequest method is called from onCreateView"); } SimpleAdapter adapter = new SimpleAdapter(getActivity() .getBaseContext(), feedsList, R.layout.row, FROM, TO); setListAdapter(adapter); return super.onCreateView(inflater, container, savedInstanceState); } @Override public void onCreate(Bundle savedInstanceState) { Log.d(TAG, "onCreate method is called"); super.onCreate(savedInstanceState); uiHelper = new UiLifecycleHelper(getActivity(), callback); uiHelper.onCreate(savedInstanceState); } private void makePageRequest(final Session session) { Log.d(TAG, "makePageRequest method is called"); // Make an API call to get the page feed // and define a new callback to handle the response. new Request(session, PAGE_U…
tagged with: arraylist
has answer: http://stackoverflow.com/a/24940867
has comment: http://stackoverflow.com/comment/38758002
type: Question
score: 0
has comment: http://stackoverflow.com/comment/38757767
answer count: 1
tagged with: android-fragments
tagged with: java
has title: Get arraylist from method into a global field

http://stackoverflow.com/comment/126488984
type: Comment
has text: Stack is totally worth it! but the duality of `empty()` and `isEmpty()` should be cleaned up - sorry, i was not clear about that...
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24987559

http://stackoverflow.com/comment/84889729
comment on: http://stackoverflow.com/a/26916190
type: Comment
type: AnswerComment
has text: This also worked in my case. I plan on using this for a couple of applications so I have place it in a method. Thanks for this! +1
score: 0

http://stackoverflow.com/comment/39047356
has text: Thanks for answering. I tried what you said, but i don't think I did it right because it doesn't work. Actually, i am sure i did it wrong. I can't really understand what you did there. Here is the code, i hope it doesn't make you laugh.I didn't know what to put in the Context parameter so I left it null.
type: AnswerComment
comment on: http://stackoverflow.com/a/25058236
type: Comment
score: 0

http://stackoverflow.com/comment/38794857
type: Comment
type: QuestionComment
has text: what does aggregated.toString() give you?
comment on: http://stackoverflow.com/q/24959766
score: 0

http://stackoverflow.com/comment/60452119
has text: I am not sure this is the problem. The issue appears only while spawning a lot of events, so it is likely a threading issue. Apart from that I use Windows 7. Maybe I should have written that as well, but I did not see the need back then. This is a java problem so I though it to be fairly system independent. I realize now that this may not be entirely correct, but in that case it should rather be due to different thread handling.
type: AnswerComment
score: 1
type: Comment
comment on: http://stackoverflow.com/a/36379292

http://stackoverflow.com/comment/38727744
type: Comment
has text: @user3700763 Not the best example of a singleton but simple for demonstration purposes - let me know if you would like a better example
score: 0
comment on: http://stackoverflow.com/a/24923948
type: AnswerComment

http://stackoverflow.com/comment/38975564
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/25055756
has text: You are using the `c3p0` connection pool, which is old and has a reputation of being a little difficult to work with. I haven't worked with `c3p0` myself so I don't have any suggestions on how to fix your `c3p0` connection problems, but I suggest that you take a look at the other connections pools that I mentioned

http://stackoverflow.com/a/24949740
type: Answer
answers question: http://stackoverflow.com/q/24948579
has body: finalize() of any particular class is called by jvm just before collecting the object of that class as a garbage. Now next question is when an object of a class is collected as garbage? Answer is: When there is no more objects reference to that object or simply no more object reference is pointing to that allocated memory space or an object has only live references via WeakHashMap it will be eligible for garbage collection. Read more here. As an option we can use System.gc() or Runtime.gc() that will give a request to jvm to consider the garbage collection. But whether your request will be listened or ignored by jvm that depends upon following factors: Internal implementation of JVM &amp; its Garbage Collection algorithm Java Heap size Free memory available in Heap
score: 0

http://stackoverflow.com/comment/38851640
type: Comment
type: QuestionComment
has text: Is there a way to "bump" this, although its impolite?
comment on: http://stackoverflow.com/q/24934465
score: 0

http://stackoverflow.com/q/25045893
has title: Spinner Default Value / Change position
has comment: http://stackoverflow.com/comment/38957233
has answer: http://stackoverflow.com/a/25069700
answer count: 3
accepted answer: http://stackoverflow.com/a/25046045
tagged with: android
has comment: http://stackoverflow.com/comment/39001523
favorite count: 0
possible better answer: http://stackoverflow.com/a/25046117
has answer: http://stackoverflow.com/a/25046117
downvote count: 1
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/25046045
score: -1
has comment: http://stackoverflow.com/comment/38957393
type: Question
has body: Hello to the community, got a problem with the implementation of my project, which I hope someone can give me because some clarity. Short description of my project: I want to change from the Activity_A means of a button onclick events the default position of a spinner in the Activity_B. In my sample code I've tried using an Intent, Value Activity_A to the spinner in the Activity_B in an if - to give statement which then starts the spinner in the corresponding position. Here is my code: Activity_A: public class Start extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.start); Button button = (Button) findViewById(R.id.button_1); button.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { Intent intent = new Intent(Start.this, Spinnerwert.class); intent.putExtra("position", "3"); startActivity(intent); } }); } } Activity_B: public class Spinnerwert extends Activity { private TextView beschreibung_1; private TextView beschreibung_2; private Spinner s1; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.spinner_wert); // TextView issue of Spinner beschreibung_1 =(TextView)findViewById(R.id.tV_spinner_1); // TextView output Intent worth beschreibung_2 =(TextView)findViewById(R.id.tV_spinner_2); // Intent data receiving Intent i = getIntent(); String selected = i.getStringExtra("position"); beschreibung_2.setText(selected); s1 = (Spinner) findViewById(R.id.spinner_1); ArrayAdapter&lt;CharSequence&gt; adapter = ArrayAdapter.createFromResource(this, R.array.auswahl, android.R.layout.simple_spinner_item); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); s1.setAdapter(adapter); s1.setOnItemSelectedListener(new OnItemSelectedListener() { public void onItemSelected(AdapterView&lt;?&gt; parent, View view, int position, lo…
upvote count: 0

http://stackoverflow.com/q/25016142
has comment: http://stackoverflow.com/comment/38904410
has title: FragmentTransaction addToBackStack fragments get recreated on orientation changes
tagged with: android-fragments
tagged with: java
has comment: http://stackoverflow.com/comment/38903168
downvote count: 0
score: 1
has answer: http://stackoverflow.com/a/25022600
type: Question
has comment: http://stackoverflow.com/comment/38901916
has body: i found a weird behavior when using FragmentTransaction addToBackStack. Anytime the phone gets rotated, it recreates all fragments in stack.. Why should those fragments be recreated, aren't they supposed to be onPause? i mean.. they are not visible nor running any background thread.. I provide a simple example (just a basic navigation drawer template in Android Studio) where you can check this behavior. just navigate a few times to other fragments so that some fragments get stored in the stack, then rotate the device, onCreate gets fired as many times you have navigated. MainActivity.java package gsrtc_driver.example.com.supportfragmentmanager_orientationchanges; import android.app.Activity; import android.support.v7.app.ActionBarActivity; import android.support.v7.app.ActionBar; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; import android.content.Context; import android.os.Build; import android.os.Bundle; import android.util.Log; import android.view.Gravity; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.support.v4.widget.DrawerLayout; import android.widget.ArrayAdapter; import android.widget.TextView; public class MyActivity extends ActionBarActivity implements NavigationDrawerFragment.NavigationDrawerCallbacks { private final static String DEBUG_TAG = "DEBUG_TAG"; /** * Fragment managing the behaviors, interactions and presentation of the navigation drawer. */ private NavigationDrawerFragment mNavigationDrawerFragment; /** * Used to store the last screen title. For use in {@link #restoreActionBar()}. */ private CharSequence mTitle; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_my); mNavigationDrawerFragment = (NavigationDrawerFragment) getSupportFragmentManager().findFragmentById(R.id.navigation_drawer); mTitle = getTitle()…
type: AnsweredQuestion
tagged with: android
accepted answer: http://stackoverflow.com/a/25022600
has comment: http://stackoverflow.com/comment/38902220
favorite count: 0
tagged with: fragmenttransaction
upvote count: 1
answer count: 1

http://stackoverflow.com/comment/38713577
comment on: http://stackoverflow.com/a/24911121
type: AnswerComment
score: 0
type: Comment
has text: I finally managed to solve this issue. Sonar Jenkins plugin apparently does not run the command "mvn clean install". I thought it did. So therefore, I had all of these errors.

http://stackoverflow.com/q/24973394
answer count: 2
has title: Remove duplicate arrays in a ArrayList?
possible better answer: http://stackoverflow.com/a/24973611
tagged with: arraylist
has answer: http://stackoverflow.com/a/24973611
has comment: http://stackoverflow.com/comment/38821199
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38820860
score: 0
type: Question
has comment: http://stackoverflow.com/comment/38820406
has comment: http://stackoverflow.com/comment/38820418
has answer: http://stackoverflow.com/a/24973455
tagged with: java
tagged with: duplicates
has comment: http://stackoverflow.com/comment/38820643
has comment: http://stackoverflow.com/comment/38820783
accepted answer: http://stackoverflow.com/a/24973455
has body: Is there a way to remove duplicates arrays in an ArrayList? I tried to convert the ArrayList into a HashSet and back to remove the duplicate arrays. But this won't work: ArrayList&lt;int[]&gt; mylist = new ArrayList&lt;int[]&gt;(); mylist.add(new int[]{1,2}); mylist.add(new int[]{2,2}); // Duplicate mylist.add(new int[]{2,2}); // Duplicate Before: {{1,2},{2,2},{2,2}} After: {{1,2},{2,2}}

http://stackoverflow.com/q/24971165
has answer: http://stackoverflow.com/a/24990013
type: Question
has title: Play framework asynchronous calls in java
tagged with: asynchronous
tagged with: promise
score: 0
has body: Im using the code below to call a webservice. Play's framework non blocking actions are great. The only issue is i want to store the response and manipulate them before i sent them off to the view. public static Promise&lt;JsonNode&gt; classService(String id) { String urlS = "www.service.api.com"; Promise&lt;WSResponse&gt; responsePromise = WS.url(urlS).get(); Promise&lt;JsonNode&gt; resultPromise = responsePromise .map(new Function&lt;WSResponse, JsonNode&gt;() { @Override public JsonNode apply(WSResponse response) throws Throwable { JsonNode searchResponse = response.asJson(); return searchResponse; } }); return resultPromise; } I'm calling the service action in this while loop while(dataIter.hasNext()){ JsonNode tempNode = dataIter.next(); String id = tempNode.path("id").toString(); classService(id); } When i tried storing the data in the while loop, the code breaks(timeout error). So how do i store the data when play is done with a promise.
tagged with: java
has answer: http://stackoverflow.com/a/24993819
answer count: 2
tagged with: playframework
type: UnansweredQuestion

http://stackoverflow.com/a/24993748
answers question: http://stackoverflow.com/q/24993255
has comment: http://stackoverflow.com/comment/38858464
has comment: http://stackoverflow.com/comment/38858560
has comment: http://stackoverflow.com/comment/38858869
has body: If we compare the code for the up actions... if (e.getSource() == up) { value100++; if (value100 &gt; 0) { number.setText(value100 + ""); down.setEnabled(true); } } //... if (e.getSource() == up_3) { value100++; if (value100 &gt; 0) { number_3.setText(value100 + ""); down_3.setEnabled(true); } } With the code of the down actions if (e.getSource() == down) { value1000--; if (value1000 &gt; 0) { number.setText(value1000 + ""); } if (value1000 == 0) { number.setText(value1000 + ""); down.setEnabled(false); value1000 = 0; } } //... if (e.getSource() == down_3) { value100--; if (value100 &gt; 0) { number_3.setText(value100 + ""); } if (value100 == 0) { number_3.setText(value100 + ""); down_3.setEnabled(false); value100 = 0; } } We can see a discrepancy...up is modifying value100 where as down is modifying value1000, but up_3 and down_3 are modifying value100... While I have the moment... This is what your UI looks like on my PC... Now, I'm sitting here scratching my head of "..." Now, if I replace the setSize with pack (called at the end of the constructor) I get... Now, if I remove all the setPreferredSize calls I get... Still needs some work, but is a far (IMHO) better result... Take a look at Should I avoid the use of set(Preferred|Maximum|Minimum)Size methods in Java Swing? for decisions on the subject... Oh, I don't know if it's important or not, but you might want to take a look at How to use spinners
type: AcceptedAnswer
downvote count: 0
score: 3
type: Answer
accepted answer of: http://stackoverflow.com/q/24993255
has comment: http://stackoverflow.com/comment/38858441
upvote count: 3

http://stackoverflow.com/comment/38753190
type: Comment
type: QuestionComment
has text: You are right. Well, so far, I have been able to put a map on a screen, and I looked at some resources for resizing the map, but I have not been able to get it to work too much to how I would like. @RIT
comment on: http://stackoverflow.com/q/24924463
score: 0

http://stackoverflow.com/comment/38892504
has text: I put it like this `new GetImages().execute(); String[] stringArr = list.toArray(new String[list.size()]); TextView array = (TextView)findViewById(R.id.testarray); array.setText(Arrays.toString(stringArr));` inside onPostExecute
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25010162
score: 0

http://stackoverflow.com/q/24959282
has answer: http://stackoverflow.com/a/24959406
tagged with: swing
downvote count: 6
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38793548
tagged with: java
linked to: http://stackoverflow.com/q/147181
has comment: http://stackoverflow.com/comment/38793472
type: Question
duplicate of: http://stackoverflow.com/q/147181
accepted answer: http://stackoverflow.com/a/24959406
upvote count: 0
has body: I have been created a java app using swing and I want to convert to an exe file how to do it. public Performance() { f = new JFrame("Ticket Booking"); f1 = new JFrame("Payment Details"); f2 = new JFrame("Payment Successfull"); l1 = new JLabel("Movies :"); l2 = new JLabel("Timing :"); l3 = new JLabel("Class:"); l4 = new JLabel(); l5 = new JLabel(); l6 = new JLabel("No of Person:"); l11 = new JLabel("Movies :"); l22 = new JLabel(); l33 = new JLabel("Timing :"); l44 = new JLabel(); l55 = new JLabel("Class:"); l66 = new JLabel(); l77 = new JLabel("No of Person:"); l88 = new JLabel(); l99 = new JLabel("Amount:"); l00 = new JLabel(); lsuccess = new JLabel(" Thank u For booking Ticket..."); c1 = new JComboBox(s1); c2 = new JComboBox(s2); r1 = new JRadioButton("10:00pm"); r2 = new JRadioButton("1:00pm"); r3 = new JRadioButton("4:30pm"); buttongroup = new ButtonGroup(); b1 = new JButton("Submit"); b11 = new JButton("Pay Bill"); b22 = new JButton("Edit"); t1 = new JTextField(10); }
has comment: http://stackoverflow.com/comment/38793567
answer count: 1
score: -6
favorite count: 0
has comment: http://stackoverflow.com/comment/38793780
has title: How to convert java or class file to exe file

http://stackoverflow.com/a/47074612
score: 0
type: Answer
has body: edit_event_time.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Calendar calendar =Calendar.getInstance(); SimpleDateFormat sdf=new SimpleDateFormat("hh:mm a"); String time = sdf.format(calendar.getTime()); Log.e("time","time "+sdf.format(calendar.getTime())); String inputTime = time, inputHours, inputMinutes; inputHours = inputTime.substring(0, 2); inputMinutes = inputTime.substring(3, 5); TimePickerDialog mTimePicker = new TimePickerDialog(getActivity(), new TimePickerDialog.OnTimeSetListener() { @Override public void onTimeSet(TimePicker timePicker, int selectedHour, int selectedMinute) { if (selectedHour == 0) { selectedHour += 12; timeFormat = "AM"; } else if (selectedHour == 12) { timeFormat = "PM"; } else if (selectedHour &gt; 12) { selectedHour -= 12; timeFormat = "PM"; } else { timeFormat = "AM"; } String selectedTime = selectedHour + ":" + selectedMinute + " " + timeFormat; edit_event_time.setText(selectedTime); } }, Integer.parseInt(inputHours), Integer.parseInt(inputMinutes), false);//mention true for 24 hour's time format mTimePicker.setTitle("Select Time"); mTimePicker.show(); } });
answers question: http://stackoverflow.com/q/25051149

http://stackoverflow.com/comment/38855773
type: QuestionComment
has text: please explain a bit more. not clear.
comment on: http://stackoverflow.com/q/24992412
score: 0
type: Comment

http://stackoverflow.com/q/24984643
answer count: 3
upvote count: 0
has title: What does this function do in Java?
favorite count: 0
has answer: http://stackoverflow.com/a/24984905
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38841391
has answer: http://stackoverflow.com/a/24984662
has comment: http://stackoverflow.com/comment/38841412
linked to: http://stackoverflow.com/q/1788312
has comment: http://stackoverflow.com/comment/38841389
tagged with: java
has body: public class TransparentProxy { private static ProxyServer _proxyserver = null; private static TransparentProxy _instance = null; public TransparentProxy() { } public static void main(String args[]) throws Exception { TransparentProxy.getInstance(); } I understand everything except the public TransparentProxy() {}. Why is it empty? What is its purpose? Why is it exempt from having a return type? I have looked it up but can't get an exact answer. Thanks
has answer: http://stackoverflow.com/a/24984674
has comment: http://stackoverflow.com/comment/38841424
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/38841415
score: -1

http://stackoverflow.com/comment/38993275
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25064864
has text: Can you include your fragment with the Installed apps?

http://stackoverflow.com/comment/38817431
comment on: http://stackoverflow.com/a/24968839
type: AnswerComment
score: 0
type: Comment
has text: It may not be a strictly defined memory leak, but it won't ever be opened again during the app's lifespan so in my mind it should be completely cleaned up without waiting for Android. How does Android determine the potential for it to be opened again.

http://stackoverflow.com/q/25064864
type: Question
tagged with: arraylist
tagged with: android-listview
has comment: http://stackoverflow.com/comment/38993275
has body: In my android app, I have two fragments one with installed apps and one that is blank. Both are listviews. I have a plus sign next to each item in the installed app listview. I am trying to make it so that when the user clicks the plus button. The listview app item goes to the blank fragment. What I am trying to do is use create a public string array in the activity which is holding the tabs and when I click on the plus button add the packagename to the array. And then in the blank fragment I am trying to check if it is found in the string array using the index. In my BlockActivity class with holds the actionbar tabs I made this: public static List&lt;String&gt; blacklist = new ArrayList&lt;String&gt;(); And here is my blank fragment condition to retrieve the app: if(!b || !c ) { if (BlockActivity.blacklist.contains(pi.packageName)) { packageList1.add(pi); } } Now I think I have to you will have to reference to the position of the item the button was clicked from listview. Doing this, I will probably have to reference a method from my adapter class, but I am not sure how to implement that and the method. I am trying to follow something similar to this: http://androidexample.com/How_To_Create_A_Custom_Listview_-_Android_Example/index.php?view=article_discription&amp;aid=67&amp;aaid=92 Here is my adapter class: package com.ibc.android.demo.appslist.app; import android.app.Activity; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; import android.graphics.drawable.Drawable; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.ImageButton; import android.widget.TextView; import com.spicycurryman.getdisciplined10.app.R; import java.util.List; public class ApkAdapter extends BaseAdapter { List&lt;PackageInfo&gt; packageList; Activity context; PackageManager packageManager; boolean[] itemChecked; public ApkAdapter(Activity context, List&lt;Package…
downvote count: 0
favorite count: 0
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/38993323
answer count: 0
score: 1
tagged with: java
tagged with: android-package-managers
upvote count: 1
has title: Adding an item in listview to another listview (Both are fragments)
has comment: http://stackoverflow.com/comment/38993353

http://stackoverflow.com/q/25003431
has body: I am creating an eclipse plugin: a refactoring tool that uses Eclipse's JDT libraries. Part of the project is to utilize another library, a process-programming language that requires objects be Serializable in order to be passed between steps. I wish I could change this but I cannot, so I need a way to make an AST object Serializable. My first attempt was to define a proxy class that implements Serializable and holds a transient AST, and use libraries such as XStream and GSON to actually serialize and deserialize the AST. However I was running into circular reference errors there. I still like this idea but I haven't found a library capable of doing it. Any other ideas? Will altering the source and recompiling affect the portability of the plugin? Would this be possible with load-time aspect weaving?
type: Question
upvote count: 2
tagged with: aspectj
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/25005966
has title: How can I make Eclipse's JDT objects Serializable?
tagged with: serialization
downvote count: 0
type: UnansweredQuestion
score: 2
tagged with: java
tagged with: eclipse-jdt
tagged with: eclipse

http://stackoverflow.com/q/24932080
downvote count: 0
has answer: http://stackoverflow.com/a/24933329
has answer: http://stackoverflow.com/a/24936741
tagged with: rest
tagged with: jax-rs
has comment: http://stackoverflow.com/comment/38745528
favorite count: 0
has answer: http://stackoverflow.com/a/27933419
has answer: http://stackoverflow.com/a/42260008
has answer: http://stackoverflow.com/a/53994534
has body: I've created a REST webservice using jax-rs and jersey that is supposed to consume JSON on a POST request. My web service class looks like this: @Path("/webhookservice") public class Webhook { @POST @Consumes(MediaType.APPLICATION_JSON) public Response readData (Song song) { // Prints out the song info System.out.println("SONG INFO \n======================="); System.out.println("songname: " + song.getSongname()); System.out.println("artist: " + song.getArtist()); // Repsonse with a HTTP 200 OK Response response = Response.status(200).build(); return response; } } My Song class: public class Song { private String songname; private String artist; public String getSongname () { return this.songname; } public String getArtist () { return this.artist; } public void setSongname (String songname) { this.songname = songname; } public void setArtist (String artist) { this.artist = artist; } } My web.xml (if needed) <?xml version="1.0" encoding="UTF-8"?> SnapScan-Webhook com.sun.jersey.spi.container.servlet.ServletContainer com.sun.jersey.config.property.packages za.co.lancet.service com.sun.jersey.api.json.POJOMappingFeature true 1 SnapScan-Webhook /* I'm using RESTClient a little, well, rest client... Here's a screenshot of what I'm sending: When I send that off, I get the 415 Unsupported Media Type error. Anybody have an idea why?
has answer: http://stackoverflow.com/a/24933904
accepted answer: http://stackoverflow.com/a/24933904
has comment: http://stackoverflow.com/comment/38745295
has answer: http://stackoverflow.com/a/49638528
has title: REST Webservice returning 415 - Unsupported Media Type
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/38745378
tagged with: http://stackoverflow.com/tag/json
type: Question
score: 20
answer count: 8
has answer: http://stackoverflow.com/a/64302696
tagged with: jersey
upvote count: 20
possible better answer: http://stackoverflow.com/a/27933419

http://stackoverflow.com/comment/38845959
type: QuestionComment
has text: Thanks for your responses. The drawable white_blue is a background image that looks completly fine on eclipse device preview but when loaded on multiple emulators, along with my actual android device, the screen is completely gray with no text field, or input shown, which is odd since the items are clearly visible in eclipse device preview.
comment on: http://stackoverflow.com/q/24986930
score: 0
type: Comment

http://stackoverflow.com/comment/38971227
has text: You are correct again. Your support on the JFreeChart (and other) questions here is amazing!
type: Comment
comment on: http://stackoverflow.com/a/25043680
type: AnswerComment
score: 0

http://stackoverflow.com/comment/38797837
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24919508
score: 0
has text: @JesanFafon Actually, I would prefer that this program can account for that and recognize that 11.001 is also a decimal. Would this require being more specific with the type, i.e. something to do with float/double? Forgive me if I am not on the right track.

http://stackoverflow.com/q/24961990
score: 0
answer count: 2
type: UnansweredQuestion
tagged with: android
has body: So i have this java file which basically creates a list of menu items that will take me to that specific activity. I created the list in java but did not create an .xml file when creating the list. Normally, when creating a new activity, android creates an .xml and java file for both. I only created a java file for it. Can android auto generate an .xml file for my menu class or do i have to recreate it? Code: Menu.java package com.AthleteProgram.x.athleteprogram; import android.app.ListActivity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.ArrayAdapter; import android.widget.ListView; public class Menu extends ListActivity{ String classes [] = {"AddAthlete", "Email"}; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); ArrayAdapter&lt;String&gt; adapter = new ArrayAdapter&lt;String&gt;(Menu.this, android.R.layout.simple_list_item_1, classes); setListAdapter(adapter); } @Override protected void onListItemClick(ListView l, View v, int position, long id) { super.onListItemClick(l, v, position, id); String listPosition = classes[position]; try { Class myClass = Class.forName("com.AthleteProgram.x.athleteprogram." + listPosition); Intent intent = new Intent(Menu.this, myClass); startActivity(intent); } catch (ClassNotFoundException e) { e.printStackTrace(); } } } I tried to create a menu.xml but to no avail: &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" android:paddingBottom="@dimen/activity_vertical_margin" tools:context="com.AthleteProgram.x.athleteprogram.Menu"&gt; &lt;TextView android:text="@string/hello_world" android:la…
has answer: http://stackoverflow.com/a/45101092
tagged with: http://stackoverflow.com/tag/xml
has answer: http://stackoverflow.com/a/24962076
tagged with: java
type: Question
has title: How to create .xml file from java file (Android)?

http://stackoverflow.com/comment/38833495
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24980539
has text: Swing itself illustrates many common [patterns](http://stackoverflow.com/q/1673841/230513); you're looking for the observer pattern. See also [*How to wire one JPane to another JPane*](http://stackoverflow.com/q/10523343/230513).
score: 0

weblogic-10.x
tag name: weblogic-10.x
tags question: http://stackoverflow.com/q/24952989
type: Tag
tags question: http://stackoverflow.com/q/24974380
tags question: http://stackoverflow.com/q/24927027

http://stackoverflow.com/q/24983024
downvote count: 0
tagged with: deserialization
score: 1
has title: Jackson JSON not able to deserialize array of elements with custom root name?
favorite count: 0
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/24983476
has body: I have a Json that looks like this: { "testEntities" : [ { "id" : 1, "floatNumber" : 0.006117165, "floatNumberObject" : 0.15273619, "intNumber" : -1155869325, "intNumberObject" : 431529176, "doubleNumber" : 0.41008081149220166, "doubleNumberObject" : 0.20771484130971707, "shortNumber" : 9364, "shortNumberObject" : 13977, "booleanValue" : true, "booleanValueObject" : true, "byteValue" : -79, "charValue" : "e", "charValueObject" : "b", "creationDate" : 86400000 }, { "id" : 2, "floatNumber" : 0.9874208, "floatNumberObject" : 0.45285606, "intNumber" : -1154715079, "intNumberObject" : 1260042744, "doubleNumber" : 0.9014476240300544, "doubleNumberObject" : 0.49682259343089075, "shortNumber" : 483, "shortNumberObject" : 18322, "booleanValue" : false, "booleanValueObject" : true, "byteValue" : -73, "charValue" : "c", "charValueObject" : "r", "creationDate" : 172800000 } ] } When I attempt to deserialize it, it fails with: Caused by: com.fasterxml.jackson.databind.JsonMappingException: Root name 'testEntities' does not match expected ('TestObject[]') for type I already enabled array deserialization: objectMapper.enable(DeserializationFeature.USE_JAVA_ARRAY_FOR_JSON_ARRAY); Clearly, testEntities is a custom name that Jackson knows nothing about. The TestObject class has a custom annotation I created called JsonRootNamePlural, to be used when the root element is a collection instead of a single instance: @JsonRootName("testEntity") @JsonRootNamePlural("testEntities") public class TestObject { ... } This annotation is needed in other places of the system as well. I want it to use it the same way it uses the @JsonRootName annotation, except that for arrays. So It could look for the root element as indicated by JsonRootName, and if none is found, it could look for @JsonRootNamePlural. All other root names in the JSON should be ignored by Jackson. The question is, what should I override or customize to introduce this behavior? Any help or pointers are greatly appreciated, thanks!!
tagged with: java
tagged with: http://stackoverflow.com/tag/json
upvote count: 1
possible better answer: http://stackoverflow.com/a/37995088
has answer: http://stackoverflow.com/a/37995088
tagged with: arrays
accepted answer: http://stackoverflow.com/a/24983476
tagged with: jackson
type: AnsweredQuestion

android-library
type: Tag
tag name: android-library
tags question: http://stackoverflow.com/q/24930062

http://stackoverflow.com/comment/38879064
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25001624
has text: I'm at a loss to understand what you want. It's recreating the .jar file each time, how could you not copy them if copying them is what you wanted?
type: Comment

http://stackoverflow.com/a/24966030
has comment: http://stackoverflow.com/comment/38806521
answers question: http://stackoverflow.com/q/24965869
downvote count: 0
has body: Your problem is here: textview1.setText((CharSequence) headline); Headline is an async task, not a string (or other charsequence). Delete this line, and set the text in onPostExecute
type: Answer
has comment: http://stackoverflow.com/comment/38806570
upvote count: 1
score: 1

http://stackoverflow.com/q/24985734
possible better answer: http://stackoverflow.com/a/24985817
tagged with: java
has answer: http://stackoverflow.com/a/24985817
has title: activity_main cannot be resolved or is not a field
has answer: http://stackoverflow.com/a/24986024
has comment: http://stackoverflow.com/comment/38843697
type: AnsweredQuestion
has body: i am a new android developer stucked in this error, I've read other threads, following the instructions but there is no way to solve it. This is the file res/layout/activity_main.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" &gt; &lt;Button android:id="@+id/button1" android:layout_width="300dp" android:layout_height="225dp" android:layout_centerHorizontal="true" android:layout_centerVertical="true" android:textSize="30sp" android:textColor="#613def" android:textStyle="bold" android:background="@drawable/microphonegrey"/&gt; &lt;/RelativeLayout&gt; in the class MainActivity.java: @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.activity_main, menu); return true; } with the Error "activity_main cannot be resolved or is not a field" I choose Create field 'activity_main' in type 'menu' The field is created, but then I see this message in the console: [2014-07-27 23:11:30 - TestProject] R.java was modified manually! Reverting to generated version! over and over again..., cleaning the project, saving...With the same result, the import clause is the correct in the file: import mypackage.R, not android.R
tagged with: android
type: Question
score: 0
answer count: 2
accepted answer: http://stackoverflow.com/a/24986024

http://stackoverflow.com/q/24965751
has body: I know the community version (free) version seemed to have a well integrated version of the plugin previously (like 4 years ago?) : Google App Engine Java development on IntelliJ? however, i can't get that downloaded plugin to work with my current version of Intellij and also google app engine java sdk 1.9.7. where is the silver bullet that i'm looking for ?
linked to: http://stackoverflow.com/q/815499
score: 0
tagged with: java
tagged with: intellij-idea
has answer: http://stackoverflow.com/a/24966899
type: UnansweredQuestion
answer count: 1
type: Question
has title: Google app engine Java SDK 1.9.7 plugin for Intellij?
tagged with: google-app-engine

http://stackoverflow.com/a/24975624
score: 2
has comment: http://stackoverflow.com/comment/38824587
has comment: http://stackoverflow.com/comment/38824934
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/24975487
has comment: http://stackoverflow.com/comment/38825962
upvote count: 2
has body: what this above program is doing? It is a class that implements Comparable that will be used to sort your last name in ascending order with overridden equals, hashCode and toString method. public int compareTo(Name n) { int lastCmp = lastName.compareTo(n.lastName); return (lastCmp != 0 ? lastCmp : firstName.compareTo(n.firstName)); } For sorting the string the first line is to check if the value is greater or less than the compared string. The second line is when the both last name are equal then it will sort the first name instead. sample String banana rod ras app apple rod it will be sorted as ras app apple rod banana rod For the overriden toString() When you print an Object of the name without overriding the toString sample Name na = new Name(); System.out.println(na); It will print the memory location of that object in memory and since it is overridden it it will print the first and last name. For the overriden hashCode() If you are trying to compare two Name object hashcode with the same last and first name they will return true. sample: Name na = new Name(); Name na2 = new Name(); System.out.println(na.hashCode() == na2.hashCode()); //will return true if first and last name are the same

http://stackoverflow.com/comment/38907155
comment on: http://stackoverflow.com/a/25009934
type: AnswerComment
score: 0
type: Comment
has text: I apologize. I changed it so both match to jobsData. I am still getting the null pointer exception. Any idea why this is?

http://stackoverflow.com/comment/38776050
has text: I recommend you to use webservices.
comment on: http://stackoverflow.com/q/24949497
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/38971185
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25053215
has text: r u sure ur `Project` table has a column `endDate` ? Also, from where are you getting this error? Please post the full context.
score: 0

http://stackoverflow.com/a/24952040
answers question: http://stackoverflow.com/q/24951752
score: 0
has body: Those constraints should be handled elsewhere. In your code design, in the database, using a validation framework, or better in all of them. The cache should mirror frequently used data. If such redundancies appear in it, there might already be something wrong.
type: Answer

http://stackoverflow.com/q/25067298
linked to: http://stackoverflow.com/q/3255073
tagged with: java
tagged with: hibernate
has body: I have three domain objects, one parent object with two children. The parent object has a many to one relationship with both children, and therefore both children have a collection of parent objects, while the parent has references to both children objects. The parent public class Parent { private OtherChild otherChild; private SomeChild someChild; /*Other methods and properties*/ @ManyToOne(fetch = FetchType.EAGER) public SomeChild getSomeChild() { return this.someChild; } public void setSomeChild(SomeChild someChild) { this.someChild = someChild; } @ManyToOne(fetch = FetchType.EAGER) public OtherChild getOtherChild() { return this.otherChild; } public void setOtherChild(OtherChild otherChild) { this.otherChild = otherChild; } } The children public class SomeChild { private List&lt;Parent&gt; parents; /*Other methods and properties*/ @OneToMany(fetch = FetchType.LAZY, mappedBy = "someChild") public List&lt;Parent&gt; getParents() { return parents; } public void setParents(List&lt;Parent&gt; parents) { this.parents = parents; } } I am using hibernate with JPA annotations to persist this setup to the database, but when the collection of parents in any of the children is a list, I get a stack overflow error when trying to fetch the parent(the children in the parent are both marked as FetchType.EAGER). When I change the fetching to FetchType.LAZY, fetching the parent works fine but fetching any of the children alone still causes a stack overflow error because (seeing from the SQL), hibernate still tries to get the parent even though the parent's collection in the children is marked as lazy fetch. In the ordinary usage of this parent it always needs to have its children fetched so their mappings are marked as fetch = FetchType.EAGER in the parent object. I have tried disabling eager fetch for each of the children in turns but that only removes the error when fetching the parent but fetching any of the children still causes the SO error. The only solution I have so far i…
has comment: http://stackoverflow.com/comment/38997947
type: Question
tagged with: jpa
has comment: http://stackoverflow.com/comment/39011925
score: 0
has comment: http://stackoverflow.com/comment/39005260
has title: Using List collection makes Hibernate throw stackoverflow error
has comment: http://stackoverflow.com/comment/38997812
answer count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/47436692
has text: Perhaps you can use multiple rayHandler, the problem is that the back light will be darkened by the front rayHandler. I think you can do the trick by not adding ambient light on the foreground
type: Comment
comment on: http://stackoverflow.com/q/25047541
score: 0
type: QuestionComment

http://stackoverflow.com/q/25043508
has answer: http://stackoverflow.com/a/25043764
has comment: http://stackoverflow.com/comment/38952442
score: 4
has title: Interesting Java regexp limitation
tagged with: java
upvote count: 4
has comment: http://stackoverflow.com/comment/38952735
downvote count: 0
type: UnansweredQuestion
has body: I have tried the same expression in Python and it seems to be okay here, while Java fails with a stack overflow. This is the simplified test case to demonstrate the problem: // 10k whitespace. char[] buf = new char[10000]; Arrays.fill(buf, ' '); String post = new String(buf); // All whitespace - works System.out.println(Pattern.compile(" +").matcher(post).matches()); // All whitespace, or whitespace - Stack Overflow System.out.println(Pattern.compile("(?: | )+").matcher(post).matches()); The first regular expression, " +" works fine. The second one, "( | )+" - which obviously should also match this string, however causes a stack overflow. I guess this is a limitation due to the way regular expressions (in particular: alternatives) are implemented in Java... state machine based regexp matchers seem to be okay (they will stay in an accepting state); or does pythons regexp engine just have a much larger stack? Disabling backtracking via atomic groups also works: "(?&gt; | )+" - I guess in this case, Java will no longer add 6 stack frames on each match (and apparently, the stack cannot fit 60000 frames by default). This is not just a theoretical example. Consider e.g. "(apple|banana)+": StringBuilder buf = new StringBuilder(); for (int i = 0; i &lt; 10000; i++) buf.append(Math.random() &lt; .5 ? "apple" : "banana"); String s = buf.toString(); System.out.println(s.replaceAll("(apple|banana)+", "lots of fruits")); With "(?&gt;apple|banana)+" it will print as desired lots of fruits; without the backtracking prevention it will cause a stack overflow. Yes, I know this is a form of catastrophic backtracking... What surprises me is that Java fails early, where Python still hums along happily, fruitfully removing undesired text... is python smarter, and recognizes this can be processed "greedy" without backtracking? Or does it just make better use of memory?
has comment: http://stackoverflow.com/comment/38952848
tagged with: regex
favorite count: 0
type: Question
tagged with: python
tagged with: backtracking
answer count: 1

http://stackoverflow.com/a/24918648
type: Answer
has comment: http://stackoverflow.com/comment/38717767
upvote count: 2
accepted answer of: http://stackoverflow.com/q/24918321
has body: It seems that you launch your app on Android 4.x/3.x. Before Android 3.0 AsyncTasks ran concurrently but later versions(>3.x) of system executes tasks one after another. So you have two choices: a) Use Threads instead of AsyncTasks b) Use executeOnExecutor of AsyncTask to execute tasks concurrently: if (Build.VERSION.SDK_INT &gt;= Build.VERSION_CODES.HONEYCOMB) { task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); } else { task.execute(); }
answers question: http://stackoverflow.com/q/24918321
score: 2
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/25197071
type: Answer
answers question: http://stackoverflow.com/q/25030837
has body: solved it: While importing the war eclipse created another projects with the names of jar which are present in lib folder. Some of those project were showing red marks that is there was some problem with them. I deleted all those project and rerun the project. Now it said that it can't find the following exception class: net.sf.jasperreports.engine.JRException I downloaded the jasper reports jar again and put it in the lib folder and voila!! the project is up. Thanks guys for helping me specially Neeraj.
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25030837

http://stackoverflow.com/q/24935896
has answer: http://stackoverflow.com/a/42997875
has title: ResourceManager : unable to find resource 'emailTemplate.vm' in any resource loader
accepted answer: http://stackoverflow.com/a/24941593
type: AnsweredQuestion
upvote count: 5
tagged with: java
possible better answer: http://stackoverflow.com/a/42997875
type: Question
score: 5
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/24941593
answer count: 3
tagged with: velocity
has body: I am doing an application in springs with maven. i wrote all properties in app.properties file file structure is like this src/main/resource |_ | templates | |_mytempaltefile.vm |_ app.properties i gave the path(absloute) in app.property app.properties file template.base.path=D\:/SVN/trunk/tfbdirect/src/main/resources/templates utilities-spring.xml file org.apache.velocity.runtime.resource.loader.FileResourceLoader ${template.base.path} false my class import java.util.HashMap; import java.util.Map; import org.apache.velocity.app.VelocityEngine; import org.springframework.ui.velocity.VelocityEngineUtils; import com.providerpay.tfbdirect.service.mail.MailSenderService; public class LoginServiceImpl implements ILoginService{ /** * Injected through Spring IOC */ ILoginDAO loginDAO; ClaimRuleProcessServiceImpl claimRuleProcessServiceImpl; PlatformTransactionManager txmanager; //IForgotPasswordDAO forgotPasswordDAO; private VelocityEngine velocityEngine; private String appURL; private MailSenderService mailSenderService; TFBLogger log = TFBLoggerFactory.getLogger(RuleServer.class); public String getAppURL() { return appURL; } public void setAppURL(String appURL) { this.appURL = appURL; } public MailSenderService getMailSenderService() { return mailSenderService; } public VelocityEngine getVelocityEngine() { return velocityEngine; } public void setVelocityEngine(VelocityEngine velocityEngine) { this.velocityEngine = velocityEngine; } public void setMailSenderService(MailSenderService mailSenderService) { this.mailSenderService = mailSenderService; } public ILoginDAO getLoginDAO() { return loginDAO; } public void setLoginDAO(ILoginDAO loginDAO) { this.loginDAO = loginDAO; } public ClaimRuleProcessServiceImpl getClaimRuleProcessServiceImpl() { return claimRuleProcessServiceImpl; } public void setClaimRuleProcessServiceImpl( ClaimRuleProcessServiceImpl claimRuleProcessServiceImpl) { this.claimRuleProcessServiceImpl = claimRuleProcessServiceImpl; } public void setTxmanager(Pla…
tagged with: spring
has answer: http://stackoverflow.com/a/24939416
has comment: http://stackoverflow.com/comment/38755605

http://stackoverflow.com/comment/38725556
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24922776
has text: Can you post your xml?
score: 0

http://stackoverflow.com/q/25069301
tagged with: java
has title: Glassfish whont start on linux server
has answer: http://stackoverflow.com/a/25069846
answer count: 2
has body: First i am a total novice at linux so dont hate. I have done the same thing on windows may times and always gotten it to work. Trying on a linux box for the first time. 1)I have installed Glassfish 4 which needs JDK7 or higher. 2)I installed JDK 8 3)I set JAVA_HOME to the JDK 4)I unziped Glassfish. When i run the following glassfish4/bin/asadmin I get the following error Exception in thread "main" java.lang.UnsupportedClassVersionError: Bad version number in .class file at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:620) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124) at java.net.URLClassLoader.defineClass(URLClassLoader.java:260) at java.net.URLClassLoader.access$100(URLClassLoader.java:56) at java.net.URLClassLoader$1.run(URLClassLoader.java:195) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:188) at java.lang.ClassLoader.loadClass(ClassLoader.java:306) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268) at java.lang.ClassLoader.loadClass(ClassLoader.java:251) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319) What to do. I have seen this before and solution has been to set the JDK path. But i cant find anywhere where i am to set the path. asenv.conf ?
has answer: http://stackoverflow.com/a/25069534
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39002313
accepted answer: http://stackoverflow.com/a/25069846
tagged with: glassfish
possible better answer: http://stackoverflow.com/a/25069534
tagged with: linux
type: Question
has comment: http://stackoverflow.com/comment/39001407
score: 0
has comment: http://stackoverflow.com/comment/39001382

http://stackoverflow.com/q/25027060
favorite count: 0
accepted answer: http://stackoverflow.com/a/25037747
has comment: http://stackoverflow.com/comment/38945428
answer count: 4
has comment: http://stackoverflow.com/comment/38928143
tagged with: javafx-2
type: AnsweredQuestion
upvote count: 3
tagged with: java
tagged with: swing
has title: Running swing application in javaFX
has comment: http://stackoverflow.com/comment/38946819
type: Question
score: 3
has answer: http://stackoverflow.com/a/25037747
has answer: http://stackoverflow.com/a/26916190
has answer: http://stackoverflow.com/a/47222943
has body: I have a code that work perfectly on Swing but I want to integrate it on javaFX. I know that I must use SwingNode but the code dosen't work in javaFX. this is .jar of librarie I use : http://forge.scilab.org/index.php/p/jlatexmath/downloads/694/ this is the result in swing : this is the code in Swing : import org.scilab.forge.jlatexmath.TeXConstants; import org.scilab.forge.jlatexmath.TeXFormula; import org.scilab.forge.jlatexmath.TeXIcon; import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.image.BufferedImage; public class LatexExample extends JFrame implements ActionListener { private JTextArea latexSource; private JButton btnRender; private JPanel drawingArea; public LatexExample() { this.setTitle("JLatexMath Example"); this.setSize(500, 500); Container content = this.getContentPane(); content.setLayout(new GridLayout(2, 1)); this.latexSource = new JTextArea(); JPanel editorArea = new JPanel(); editorArea.setLayout(new BorderLayout()); editorArea.add(new JScrollPane(this.latexSource),BorderLayout.CENTER); editorArea.add(btnRender = new JButton("Render"),BorderLayout.SOUTH); content.add(editorArea); content.add(this.drawingArea = new JPanel()); this.btnRender.addActionListener(this); this.latexSource.setText("x=\\frac{-b \\pm \\sqrt {b^2-4ac}}{2a}"); } public void render() { try { // get the text String latex = this.latexSource.getText(); // create a formula TeXFormula formula = new TeXFormula(latex); // render the formla to an icon of the same size as the formula. TeXIcon icon = formula .createTeXIcon(TeXConstants.STYLE_DISPLAY, 20); // insert a border icon.setInsets(new Insets(5, 5, 5, 5)); // now create an actual image of the rendered equation BufferedImage image = new BufferedImage(icon.getIconWidth(), icon.getIconHeight(), BufferedImage.TYPE_INT_ARGB); Graphics2D g2 = image.createGraphics(); g2.setColor(Color.white); g2.fillRect(0, 0, icon.getIconWidth(), icon.getIconHeight()); JLab…
tagged with: javafx-8
has comment: http://stackoverflow.com/comment/38932556
has answer: http://stackoverflow.com/a/52029775
has comment: http://stackoverflow.com/comment/38946777
has comment: http://stackoverflow.com/comment/38928122
downvote count: 0
possible better answer: http://stackoverflow.com/a/26916190

http://stackoverflow.com/a/24985819
downvote count: 0
has comment: http://stackoverflow.com/comment/38844359
has body: First, your issue - how do you deal with capital letters? Obviously in your use case you do countLetters(s.toUpperCase()) then you do - 'a'. This gives very odd results: (int)'A' - (int)'a' = -25 (int)'Z' - (int)'a' = -7 An easier way to do this is using a Map. With Java 8: final Map&lt;Character, Integer&gt; counts = input.toUpperCase().chars(). collect(HashMap::new, (m, l) -&gt; m.merge((char) l, 1, Integer::sum), Map::putAll);
type: Answer
has comment: http://stackoverflow.com/comment/38844123
score: 1
has comment: http://stackoverflow.com/comment/38844051
has comment: http://stackoverflow.com/comment/38844283
answers question: http://stackoverflow.com/q/24985762
upvote count: 1

http://stackoverflow.com/comment/38811652
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24968804
has text: You mean I have to replace this with the code you mentioned? <meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="AIzaSyDGPcb88FGrYilWxe41RbWog38pSgNfp5o" />
score: 0

spnego
tag name: spnego
tags question: http://stackoverflow.com/q/24966643
type: Tag

http://stackoverflow.com/comment/38904011
comment on: http://stackoverflow.com/q/25017766
type: Comment
type: QuestionComment
score: 2
has text: ... or compile with current computer's Java.

registrykey
tag name: registrykey
tags question: http://stackoverflow.com/q/24995396
type: Tag

http://stackoverflow.com/comment/38871949
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24999490
has text: now can u check my mainactivity code and see if anything wrong

http://stackoverflow.com/q/24955899
favorite count: 0
has answer: http://stackoverflow.com/a/61820275
has answer: http://stackoverflow.com/a/25044547
accepted answer: http://stackoverflow.com/a/25044547
has body: I'm constructing a dynamic query for a Mybatis DB mapper, to access a MySql database. The query is driven by an XML config file containing select fields. So I dynamically create a critera object. My problem is, if one of the select fields is a string, the select returns unwanted records due to it being case insensitive For example, if the select value is 'Analog1', this will match a record with value 'analog1'. Question is, can I force the underlying SELECT to be case sensitive? I know that select * from Label where binary Label_Name = 'analog1'; Will only match 'analog1' and not 'Analog1'. But how to tell the Mybatis query to use the binary qualifier in the query? Here's my code to create the criteria. As you can see it's all dynamically done using reflection, there's nothing hardcoded: private Object findMatchingRecord(TLVMessageHandlerData data, Object databaseMapperObject, Object domainObject, ActiveRecordDataType activeRecordData) throws TLVMessageHandlerException { if (activeRecordData == null) { return false; } String domainClassName = domainObject.getClass().getName(); try { String exampleClassName = domainClassName + "Example"; Class&lt;?&gt; exampleClass = Class.forName(exampleClassName); Object exampleObject = exampleClass.newInstance(); Method createCriteriaMethod = exampleClass.getDeclaredMethod("createCriteria", (Class&lt;?&gt;[])null); Object criteriaObject = createCriteriaMethod.invoke(exampleObject, (Object[])null); for (String selectField : activeRecordData.getSelectField()) { String criteriaMethodName = "and" + firstCharToUpper(selectField) + "EqualTo"; Class&lt;?&gt; selectFieldType = domainObject.getClass().getDeclaredField(selectField).getType(); Method criteriaMethod = criteriaObject.getClass().getMethod(criteriaMethodName, selectFieldType); Method getSelectFieldMethod = domainObject.getClass().getDeclaredMethod("get" + firstCharToUpper(selectField)); Object selectFieldValue = getSelectFieldMethod.invoke(domainObject, (Object[])null); if (sele…
type: AnsweredQuestion
upvote count: 2
has answer: http://stackoverflow.com/a/25007272
score: 1
tagged with: java
tagged with: mysql
downvote count: 1
type: Question
has title: How to force Mybatis to do a case sensitive select using dynamic criteria
answer count: 3
possible better answer: http://stackoverflow.com/a/25007272
tagged with: mybatis